Purpose
I have been asked to make simple reports just for retrieving data from tables with all nice functions which you can use at SE16N, SE16H sort of SE transactions .
Well, there are many fancy UI report tools that you can create a fancy report, which are something like POWL or Fiori List, FPM, and WebUI. Of course, if you are good at using conventional SAP report tools like Report Painter, SAP QUERY, QuickView, and so on .. Wouldn’t be any problem considering that SAP has been providing lots of report tools for user to avoid building SAP reports from scratch.
But, What is the simplest way to meet user’s requirements if end users do not want to know how to use the fancy report tools, and just want to call a transaction? And want to something like SE16N outputs and the out-of-box functions only ? Moreover, user wants simple UI interface with customer selection criteria & layout variant on top of the SE16N ?
Adopting SAP stand functions
Answer is simple, Call SE16N_EXTERNAL_CALL.
Here is the very simple steps to make a customer SE16N report.
Create a report transaction
Create a report calling FM ‘SE16N_EXTERNAL_CALL’
Restricted the selection criteria and input parameters,
Optionally, you can preset the layout, filter, group by, sub-sum, and all functions come with SE16N
Example
In my reference program, I restricted 2 selection-options as input Selection Criteria
REPORT xxxxxx….
**// Definition
TABLES lfbk.
DATA : lr_stab TYPE TABLE OF se16n_seltab WITH HEADER LINE.
DATA lc_se16n_tab TYPE se16n_tab VALUE ‘LFBK’.
*—–> Pick selection criteria from field list of table LFBK
SELECT-OPTIONS : s_bankn FOR lfbk–bankn .
SELECT-OPTIONS : s_lifnr FOR lfbk–lifnr NO INTERVALS NO–EXTENSION.
**// START-OF-SELECTION.
START-OF-SELECTION.
*—-> you can check of the authorization of tcode SE16N, but it’s optional.
*** Authorization Check
** Check for SE16N access when it called by customer t-codes
* IF sy-tcode NE ‘SE16N’. “1757450
* CALL FUNCTION ‘AUTHORITY_CHECK_TCODE’
* EXPORTING
* tcode = ‘SE16N’
* EXCEPTIONS
* ok = 0
* not_ok = 1.
* IF sy-subrc NE 0.
* MESSAGE e059(eu) WITH ‘SE16N’. ” no authority
* ENDIF.
* ENDIF. “1757450
*—-> Build Selection Tab for Sel-Option S_BANKN & S_LIFNR
** Build SelTab
lr_stab[] = CORRESPONDING #( s_bankn[] ).
** Fill the Field Name in SelTab
lr_stab–field = ‘BANKN’.
MODIFY lr_stab TRANSPORTING field WHERE field EQ space .
lr_stab[] = CORRESPONDING #( BASE ( lr_stab[] ) s_lifnr[] ).
lr_stab–field = ‘LIFNR’.
MODIFY lr_stab TRANSPORTING field WHERE field EQ space .
*—–> Call the SE16N function Module
**// END-OF-SELECTION.
END-OF-SELECTION.
**// Call SE16N with a restriction of selection criteria
CALL FUNCTION ‘SE16N_EXTERNAL_CALL’
EXPORTING
i_tab = lc_se16n_tab
* i_variant = p_vari
* I_HANA_ACTIVE =
* I_DBCON =
* I_OJKEY =
* i_max_lines = p_max_l
* I_GUI_TITLE =
* I_FCAT_STRUCTURE =
* I_LAYOUT_GROUP =
* I_NO_LAYOUTS =
* I_DISPLAY_ALL = ‘ ‘
* I_TEMPERATURE = ‘ ‘
* I_TEMPERATURE_COLD = ‘ ‘
* I_SESSION_CONTROL =
* I_EDIT = ‘ ‘
* I_NO_CONVEXIT = ‘ ‘
* I_CHECKKEY = ‘ ‘
* I_FORMULA_NAME = ‘ ‘
TABLES
it_seltab = lr_stab
* IT_SUM_UP_FIELDS =
* IT_GROUP_BY_FIELDS =
* IT_ORDER_BY_FIELDS =
* IT_AGGREGATE_FIELDS =
* IT_TOPLOW_FIELDS =
* IT_SORTORDER_FIELDS =
* IT_CALLBACK_EVENTS =
* IT_OUTPUT_FIELDS =
* IT_HAVING_FIELDS =
EXCEPTIONS
no_values = 1
OTHERS = 2.
*// No Need to populate error
IF sy–subrc <> 0.
MESSAGE w002(wusl).
* Implement suitable error handling here
ENDIF.
Output
This screen becomes ….
No comments:
Post a Comment