Create ALV ABAP program in Eclipse IDE

1
6437

Hello everyone, in this ‘ABAP in Eclipse’ tutorial we will learn how to create ALV ABAP program in Eclipse.

We all know developing ALV programs using SAP GUI in SE38 transaction.Today we are re-writing the same program in Eclipse.

If you have not introduced to ABAP in Eclipse, please click here to know more about it.

So let’s get started.

Prerequisites

Step-by-Step Procedure

1. Creation of every ABAP Repository Object in Eclipse starts with creation of ABAP Project. To know how to create a ABAP Project please click here.

2. After successful creation of ABAP Project in the above step, we need to create ABAP Program.To create an ABAP Program right click on package → New → ABAP Program.

New ABAP Program

3. In Selection of Transport Request window, choose the transport request in which you want to save the program and hit Finish button.Here we are saving the program in $TMP package so transport request is not required.

Selection of Transport Request

4. ABAP editor will be available in a window beside, right to Project Explorer.Here you can write the same ABAP code as we were in ECC system using SE38 transaction.

  Data Declarations

DATA: lo_alv       TYPE REF TO cl_salv_table,
      gt_materials TYPE STANDARD TABLE OF bapi_epm_product_header,
      ls_maxrows   TYPE bapi_epm_max_rows.

 Data Retrieval Logic

ls_maxrows-bapimaxrow = 20.
CALL FUNCTION 'BAPI_EPM_PRODUCT_GET_LIST'
  EXPORTING
    max_rows   = ls_maxrows
  TABLES
    headerdata = gt_materials.

Display ALV Code Snippet

TRY.
    CALL METHOD cl_salv_table=>factory
      IMPORTING
        r_salv_table = lo_alv
      CHANGING
        t_table      = gt_materials.
  CATCH cx_salv_msg.
ENDTRY.

CALL METHOD lo_alv->display.

5. After adding above code in the code editor, save and active the program.

Save and Activate ABAP Program

6. Execute the program by clicking on execute button in the application toolbar. A new window will open to display the ALV output in Eclipse.

Execute ABAP Program

You have successfully created an ALV report ABAP program in Eclipse. Stay tuned to us for more ABAP in Eclipse tutorials. Please feel free to comment and let us know your feedback.

Thank you.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here