Sometimes, we need to call the Standard Table display (SE16) from our report program. In option of this we can create a Small ALV program using the Tutorials > SALV Table Display .
To call the Standard Table display, we can Submit the underlying program from our report. SAP creates a table dispaly report for all the database tables which can be viewed using the SE16. So, We can find that program name and Submit the program to call the Standard Table Display. This option does not seem to be the easiet way, as we have to find the underlying report name to call the SE16.
Let’s explore another option. Trasaction SE16 internally calls the function module RS_TABLE_LIST_CREATE to generate the output. Why not we also call that from our program to call the SE16.
Here is the code snippet to call the SE16 using above said FM:
*&---------------------------------------------------------------------*
*& Describes a way to call the SE16 with the Selection from report.
*&
*&---------------------------------------------------------------------*
*
REPORT ztest_tmp.
*
START-OF-SELECTION.
DATA: t_sel TYPE STANDARD TABLE OF rsparams WITH HEADER LINE.
*
* VBELN
t_sel-selname = 'I1'.
t_sel-kind = ' '.
t_sel-sign = 'I'.
t_sel-option = 'BT'.
t_sel-low = '0000001000'.
t_sel-high = '0000002000'.
APPEND t_sel.
CLEAR t_sel.
*
* ERDAT
t_sel-selname = 'I2'.
t_sel-kind = ' '.
t_sel-sign = 'I'.
t_sel-option = 'BT'.
t_sel-low = '20081001'.
t_sel-high = sy-datum.
APPEND t_sel.
*
* Function module to call the SE16 list
CALL FUNCTION 'RS_TABLE_LIST_CREATE'
EXPORTING
table_name = 'VBAK'
action = 'ANZE'
* WITHOUT_SUBMIT = ' '
* GENERATION_FORCED =
* NEW_SEL =
* NO_STRUCTURE_CHECK = ' '
* DATA_EXIT = ' '
* IMPORTING
* PROGNAME =
TABLES
seltab = t_sel
EXCEPTIONS
table_is_structure = 1
table_not_exists = 2
db_not_exists = 3
no_permission = 4
no_change_allowed = 5
OTHERS = 6
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
It will generate an output somewhat like:
Disadvantages of SE16:
As we can see in the example code, instead of the Field name in the Selection Criteria table (T_SEL) we have to pass the Select Option name of the table selection screen. E.g. I1 for the Sales Document (VBELN) and I2 for the Creation Date (ERDAT). Sometimes, this Select-options may not present on the Selection screen when we call the SE16 and in that case we will not get the accurate result.
So, we will explore on how to call SE16N for the Standard Table display.