What are The Steps to Create ALV Interactive Report in SAP ABAP
What are The Steps to Create ALV Interactive Report in SAP ABAP
As a SAP ABAP Developer,our first and basic challenge is to create ALV Interactive Report .For that purpose ,I have covered steps to create Interactive ALV report with example Program.Let us start creating Report.
Interactive ALV Report Steps
1.Select the Header and Item Tables.
2. create Structures of Both Tables.
3.Create the Selection Screen.
4.Select the Header Data.
5. Create Field Catalog for Header Structure.
7.Call the Function Module REUSE_ALV_GRID_DISPLAY.
8.Next create the USER_COMMAND Subroutine.
9.in which fetch the item details .
10.create Filed catalog for Item Table.
11.pass the table to REUSE_ALV_GRID_DISPLAY.
12.Pass the User_command event for export parameter of Function module.
ALV Program
REPORT INTERACTIVE _ALV_REPORT
NO STANDARD PAGE HEADING
LINE-SIZE 500
MESSAGE-ID zz_8821.
TYPE-POOLS: slis.
TYPES: BEGIN OF i_ekko,
ebeln LIKE ekko-ebeln,
aedat LIKE ekko-aedat,
bukrs LIKE ekko-bukrs,
bsart LIKE ekko-bsart,
lifnr LIKE ekko-lifnr,
END OF i_ekko.
TYPES: BEGIN OF i_ekpo,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
matnr LIKE ekpo-matnr,
menge LIKE ekpo-menge,
meins LIKE ekpo-meins,
netpr LIKE ekpo-netpr,
END OF i_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF i_ekpo ,
wa_ekpo TYPE i_ekpo ,
it_ekko TYPE STANDARD TABLE OF i_ekko,
wa_ekko TYPE i_ekko.
DATA: v_repid LIKE sy-repid .
*declaration for fieldcatalog
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM display_alv_report.
FORM build_fieldcatlog.
wa_fieldcat-tabname = 'IT_EKKO'.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-seltext_m = 'PO NO.'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'IT_EKKO'.
wa_fieldcat-fieldname = 'AEDAT'.
wa_fieldcat-seltext_m = 'DATE.'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'IT_EKKO'.
wa_fieldcat-fieldname = 'BUKRS'.
wa_fieldcat-seltext_m = 'COMPANY CODE'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'IT_EKKO'.
wa_fieldcat-fieldname = 'BUKRS'.
wa_fieldcat-seltext_m = 'DOCMENT TYPE'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'IT_EKKO'.
wa_fieldcat-fieldname = 'LIFNR'.
wa_fieldcat-no_out = 'X'.
wa_fieldcat-seltext_m = 'VENDOR CODE'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. "BUILD_FIELDCATLOG
FORM data_retrieval.
SELECT ebeln aedat bukrs bsart lifnr FROM ekko INTO TABLE it_ekko.
ENDFORM. "data_retrieval
FORM display_alv_report.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = i_fieldcat[]
TABLES
t_outtab = it_ekko.
ENDFORM. "display_alv_report
*&--------------------------------------------------------------------*
*& Form USER_COMMAND
*&--------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
PERFORM build_fieldcatlog_ekpo.
PERFORM data_retrieval_ekpo.
PERFORM display_alv_ekpo.
ENDCASE.
ENDFORM. "user_command
FORM build_fieldcatlog_ekpo.
wa_fieldcat-tabname = 'IT_EKPO'.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-seltext_m = 'PO NO.'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'IT_EKPO'.
wa_fieldcat-fieldname = 'EBELP'.
wa_fieldcat-seltext_m = 'LINE NO'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'I_EKPO'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-seltext_m = 'MATERIAL NO.'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'I_EKPO'.
wa_fieldcat-fieldname = 'MENGE'.
wa_fieldcat-seltext_m = 'QUANTITY'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'I_EKPO'.
wa_fieldcat-fieldname = 'MEINS'.
wa_fieldcat-seltext_m = 'UOM'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'I_EKPO'.
wa_fieldcat-fieldname = 'NETPR'.
wa_fieldcat-seltext_m = 'PRICE'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. "BUILD_FIELDCATLOG_EKPO
FORM data_retrieval_ekpo.
SELECT ebeln ebelp matnr menge meins netpr FROM ekpo INTO TABLE it_ekpo.
ENDFORM. "DATA_RETRIEVAL_EKPO
FORM display_alv_ekpo.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = i_fieldcat[]
TABLES
t_outtab = it_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. "DISPLAY_ALV_EKPO
Simple ALV Report
ALV Reports
ALV Field Catalog in ABAP
Simple ALV Report Example
ABAP ALV Interactive Report
ALV reports Interview Questions
ABAP Debugger
Creating Message Class Tutorial in SAP ABAP
SAP and ABAP Memory Tutorial
Creating Selection Screen Tutorial in SAP ABAP
SAP ABAP Programming Example Tutorials for Beginners
Disable Icons in SAP ALV Toolbar
ALV Reports
ALV Field Catalog in ABAP
Simple ALV Report Example
ABAP ALV Interactive Report
ALV reports Interview Questions
ABAP Debugger
Creating Message Class Tutorial in SAP ABAP
SAP and ABAP Memory Tutorial
Creating Selection Screen Tutorial in SAP ABAP
SAP ABAP Programming Example Tutorials for Beginners
Disable Icons in SAP ALV Toolbar
Comments
Post a Comment