As we have seen in the previous post, how easy it is to call the Standard Table Display from a report program. Today, we will see the more powerful and more efficient way to call the Table Display from the Report.
We will call the function module SE16N_INTERFACE to call the new standard table display.
Code Snippet to call SE16N from Report
*&---------------------------------------------------------------------*
*& Describes a way to call the SE16n with the Selection from report.
*&
*&---------------------------------------------------------------------*
*
REPORT ztest_tmp.
*
START-OF-SELECTION.
*
* data declaration for the FM
DATA: l_tab TYPE se16n_tab,
t_sel TYPE se16n_or_t,
la_sel LIKE LINE OF t_sel,
t_sel_tab TYPE se16n_or_seltab_t,
la_sel_tab LIKE LINE OF t_sel_tab.
*
* Table name
l_tab = 'VBAK'.
*
* Selection for VBELN
la_sel_tab-field = 'VBELN'.
la_sel_tab-sign = 'I'.
la_sel_tab-option = 'BT'.
la_sel_tab-low = '0000001000'.
la_sel_tab-high = '0000002000 '.
APPEND la_sel_tab TO t_sel_tab.
*
* Selection for ERDAT
la_sel_tab-field = 'ERDAT'.
la_sel_tab-sign = 'I'.
la_sel_tab-option = 'BT'.
la_sel_tab-low = '20081001'.
la_sel_tab-high = sy-datum.
APPEND la_sel_tab TO t_sel_tab.
*
* Fill the main selection table
la_sel-pos = 1.
la_sel-seltab = t_sel_tab.
APPEND la_sel TO t_sel.
*
* Function module for the SE16N
CALL FUNCTION 'SE16N_INTERFACE'
EXPORTING
i_tab = l_tab
i_clnt_dep = 'X'
TABLES
* IT_OUTPUT_FIELDS =
it_or_selfields = t_sel
EXCEPTIONS
no_values = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
As we can from the code, here we have passed the Actual Field name instead of the parameter name of the report program. This makes it more powerful and more efficient compare to standard table display using SE16.