Code :
REPORT ZVP_ALV.
TYPE-POOLS: SLIS.
TABLES: EKKO.
DATA: IT_EKKO TYPE TABLE OF EKKO,
WA_EKKO TYPE EKKO,
LV_EBELN TYPE EKKO-EBELN.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
SELECT-OPTIONS: S_EBELN FOR LV_EBELN.
START-OF-SELECTION.
SELECT EBELN
BUKRS
BSTYP
BSART
FROM EKKO INTO TABLE IT_EKKO
WHERE EBELN IN S_EBELN.
PERFORM FUNC_EKKO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_GRID_TITLE = 'Purchase Document Details'
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_EKKO.
FORM FUNC_EKKO.
DATA: LV_COL TYPE I.
CLEAR: LV_COL, WA_FIELDCAT.
LV_COL = LV_COL + 1.
WA_FIELDCAT-COL_POS = LV_COL.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'Purchasing Document Number'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
LV_COL = LV_COL + 1.
WA_FIELDCAT-COL_POS = LV_COL.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'Company Code'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
LV_COL = LV_COL + 1.
WA_FIELDCAT-COL_POS = LV_COL.
WA_FIELDCAT-FIELDNAME = 'BSTYP'.
WA_FIELDCAT-SELTEXT_M = 'Purchasing Document Category'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
LV_COL = LV_COL + 1.
WA_FIELDCAT-COL_POS = LV_COL.
WA_FIELDCAT-FIELDNAME = 'BSART'.
WA_FIELDCAT-SELTEXT_M = 'Purchasing Document Types'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
WA_LAYOUT-EDIT = 'X'.
ENDFORM.
Output :
IDE Used To Test This Code : SAP Login 730.
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.
REPORT ZVP_ALV.
TYPE-POOLS: SLIS.
TABLES: EKKO.
DATA: IT_EKKO TYPE TABLE OF EKKO,
WA_EKKO TYPE EKKO,
LV_EBELN TYPE EKKO-EBELN.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
SELECT-OPTIONS: S_EBELN FOR LV_EBELN.
START-OF-SELECTION.
SELECT EBELN
BUKRS
BSTYP
BSART
FROM EKKO INTO TABLE IT_EKKO
WHERE EBELN IN S_EBELN.
PERFORM FUNC_EKKO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_GRID_TITLE = 'Purchase Document Details'
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_EKKO.
FORM FUNC_EKKO.
DATA: LV_COL TYPE I.
CLEAR: LV_COL, WA_FIELDCAT.
LV_COL = LV_COL + 1.
WA_FIELDCAT-COL_POS = LV_COL.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'Purchasing Document Number'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
LV_COL = LV_COL + 1.
WA_FIELDCAT-COL_POS = LV_COL.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'Company Code'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
LV_COL = LV_COL + 1.
WA_FIELDCAT-COL_POS = LV_COL.
WA_FIELDCAT-FIELDNAME = 'BSTYP'.
WA_FIELDCAT-SELTEXT_M = 'Purchasing Document Category'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
LV_COL = LV_COL + 1.
WA_FIELDCAT-COL_POS = LV_COL.
WA_FIELDCAT-FIELDNAME = 'BSART'.
WA_FIELDCAT-SELTEXT_M = 'Purchasing Document Types'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
WA_LAYOUT-EDIT = 'X'.
ENDFORM.
Output :
IDE Used To Test This Code : SAP Login 730.
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.
Post a Comment