In this first step we’ll create the core of ALV – just grab some data and display it in form of ALV grid
- Run TCode SE80 and create new program
- In this program create new screen 0100
- In the object tree double click on screen 0100 and in tab “Flow logic” enter the following code:
PROCESS BEFORE OUTPUT. MODULE STATUS_0100. " Just un-comment this line * PROCESS AFTER INPUT. * MODULE USER_COMMAND_0100.
- Double click on line
MODULE STATUS_0100
and create it’s definition within the main program with the following contents:MODULE status_0100 OUTPUT. PERFORM read_data. PERFORM display_grid. ENDMODULE.
- Now write the program
Note: We will use the whole screen to display the ALV grid so we don’t have to create a container on screen 0100. Screen’s 0100 container is returned by commandcl_gui_container=>default_screen
orcl_gui_container=>screen0
.DATA: gt_data TYPE TABLE OF sflight, g_grid TYPE REF TO cl_gui_alv_grid. CONSTANTS: c_max_rows TYPE i VALUE 100. CALL SCREEN 100. *&---------------------------------------------------------------------* *& Form read_data *&---------------------------------------------------------------------* FORM read_data. SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_data FROM sflight UP TO c_max_rows ROWS. ENDFORM. *&---------------------------------------------------------------------* *& Form display_grid *&---------------------------------------------------------------------* FORM display_grid. CREATE OBJECT g_grid EXPORTING i_parent = cl_gui_container=>default_screen. CALL METHOD g_grid->set_table_for_first_display EXPORTING i_structure_name = 'SFLIGHT' CHANGING it_outtab = gt_data EXCEPTIONS invalid_parameter_combination = 1 program_error = 2 too_many_lines = 3 OTHERS = 4. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDFORM.
- Output will look like this:
code 3º incomplet.
Sorry to give copy did not copy the code well. goes luxury +100
In the object tree double click on screen 0100 and in tab “Flow logic” enter the following code: where u have to do this
Transaction SE80 starts with a navigation tree in the left column…here you§ll get the screen 100 after it has been created. Once you double click on it, you’ll find the screen details in the right(main) window. This window contains several TABs. One of them is called “Flow logic”.
Tried this, but it does not work. Shows empty screen.