TYPE-POOLS SLIS.
TABLES : EKKO.SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN.
TYPES : BEGIN OF TY_FINAL, "DECLARING INTERNAL TABLE
EBELN TYPE EKKO-EBELN,
BEDAT TYPE EKKO-BEDAT,
EBELP TYPE EKPO-EBELP,
NETPR TYPE EKPO-NETPR,
END OF TY_FINAL.
DATA : IT_EKKO TYPE TABLE OF TY_FINAL.
SELECT EKKO~EBELN EKKO~BEDAT EKPO~EBELP EKPO~NETPR INTO TABLE IT_EKKO " FILLING THE DATA IN INTERNAL TABLE
FROM EKKO INNER JOIN EKPO ON EKKO~EBELN = EKPO~EBELN
WHERE EKKO~EBELN IN S_EBELN.
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV, "FIELD CATLOG DECLARATION
WA_FCAT TYPE SLIS_FIELDCAT_ALV.
*OR WA_FCAT LIKE LINE OF IT_FCAT.
WA_FCAT-FIELDNAME = 'EBELN'. " FILL THE FIELDCATLOG
WA_FCAT-COL_POS = '1'.
WA_FCAT-SELTEXT_L = 'PUR.DOC'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-FIELDNAME = 'BEDAT'.
WA_FCAT-COL_POS = '2'.
WA_FCAT-SELTEXT_L = 'DOC DATE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-FIELDNAME = 'EBELP'.
WA_FCAT-COL_POS = '3'.
WA_FCAT-SELTEXT_L = 'ITEM'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-FIELDNAME = 'NETPR'.
WA_FCAT-COL_POS = '4'.
WA_FCAT-SELTEXT_L = 'NETVALUE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = IT_FCAT
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_EKKO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
OUTPUT:
No comments:
Post a Comment