How to see data selected from a database
In order to exercise SELECT
, we need to know which values were selected from the database. How to show data is covered in Chapter 7, Building User Interfaces. For now, I will get you a fragment of code to display data, which is selected from your SELECT
statement.
The following is an example of code to show data from an internal table:
DATA: gr_alv TYPE REF TO cl_salv_table, gr_columns TYPE REF TO cl_salv_columns_table. CALL METHOD cl_salv_table=>factory IMPORTING r_salv_table = gr_alv CHANGING t_table = YOUR TABLE. gr_columns = gr_alv->get_columns( ). gr_columns->set_optimize( value = 'X' ). gr_alv->display( ).
Do you see YOUR TABLE
in this piece of code? This is where you can input the name of your table.
For instance, if you want to see data stored in gt_sflight
, you use the following code:
DATA: gr_alv TYPE REF TO cl_salv_table, gr_columns TYPE REF TO cl_salv_columns_table. CALL METHOD cl_salv_table...