BASED ON GIVEN PURCHASING DOCUMENT NUMBER DISPLAY PURCHASING DOCUMENT NUMBERS, DOCUMENT DATES AND VENDOR NUMBERS BY USING ALV AND ALSO DISPLAY PURCHASING DOCUMENTS WITH GREEN COLOR & VENDOR WITH HOTSPOT BY USING MERGE FUNCTION MODULE.
REPORT ZALV_FM_MERGE.
TYPE-POOLS SLIS.
TABLES EKKO.
SELECT-OPTIONS S_EBELN FOR EKKO-EBELN.
DATA : BEGIN OF WA_EKKO,
EBELN LIKE EKKO-EBELN,
BEDAT LIKE EKKO-BEDAT,
LIFNR LIKE EKKO-LIFNR,
END OF WA_EKKO.
DATA IT_EKKO LIKE TABLE OF WA_EKKO.
SELECT EBELN BEDAT LIFNR FROM EKKO INTO TABLE IT_EKKO WHERE EBELN IN S_EBELN.
*DECLARING FIELD CATALOG INTERNAL TABLE.
DATA IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT LIKE LINE OF IT_FCAT.
*FILLING FIELD CATALOG.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-CPROG
I_INTERNAL_TABNAME = 'WA_EKKO'
I_INCLNAME = SY-CPROG.
CHANGING
CT_FIELDCAT = IT_FCAT.
*MODIFY FIELD CATALOG BASED ON REQUIREMENT.
WA_FCAT-KEY="**"
WA_FCAT-EMPHASIZE = 'C510'.
MODIFY IT_FCAT FROM WA_FCAT TRANSPORTING
EMPHASIZE KEY WHERE FIELDNAME = 'EBELN'.
WA_FCAT-HOTSPOT = 'X'.
MODIFY IT_FCAT FROM WA_FCAT TRANSPORTING HOTSPOT WHERE FIELDNAME = 'LIFNR'.
*DISPLAY OUTPUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = IT_FCAT
TABLES
T_OUTTAB = IT_EKKO.
TYPE-POOLS SLIS.
TABLES EKKO.
SELECT-OPTIONS S_EBELN FOR EKKO-EBELN.
DATA : BEGIN OF WA_EKKO,
EBELN LIKE EKKO-EBELN,
BEDAT LIKE EKKO-BEDAT,
LIFNR LIKE EKKO-LIFNR,
END OF WA_EKKO.
DATA IT_EKKO LIKE TABLE OF WA_EKKO.
SELECT EBELN BEDAT LIFNR FROM EKKO INTO TABLE IT_EKKO WHERE EBELN IN S_EBELN.
*DECLARING FIELD CATALOG INTERNAL TABLE.
DATA IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT LIKE LINE OF IT_FCAT.
*FILLING FIELD CATALOG.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-CPROG
I_INTERNAL_TABNAME = 'WA_EKKO'
I_INCLNAME = SY-CPROG.
CHANGING
CT_FIELDCAT = IT_FCAT.
*MODIFY FIELD CATALOG BASED ON REQUIREMENT.
WA_FCAT-KEY="**"
WA_FCAT-EMPHASIZE = 'C510'.
MODIFY IT_FCAT FROM WA_FCAT TRANSPORTING
EMPHASIZE KEY WHERE FIELDNAME = 'EBELN'.
WA_FCAT-HOTSPOT = 'X'.
MODIFY IT_FCAT FROM WA_FCAT TRANSPORTING HOTSPOT WHERE FIELDNAME = 'LIFNR'.
*DISPLAY OUTPUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = IT_FCAT
TABLES
T_OUTTAB = IT_EKKO.