Documente Academic
Documente Profesional
Documente Cultură
Table of Contents
Scope of the development ............................................................................................... 3
Our Scenario………………………...…………………………………………………………...3
The Solution.....……………………………………………………………………….………….3
The Code…………………….……………………………………………………………………4
BENEFITS OF THIS TIP ................................................................................................. 6
Credits………………………………………………………………………………………………………………….………………………6
______________________________________________________________
Page 2 of 7
Dynamic Subtotal Text in ALV
______________________________________________________________
The Solution
The solution implemented in one of the IBM projects as a workaround to the above issue
was making the parameters for the enhancement function modules dynamic for such
cases in conjunction with a constant table to hold the parameters(CCD in this case).
Parameters specific to one logic is maintained in CCD along with the function module
name. Before calling the function module, the parameters are retrieved from CCD and
populated dynamically for being called. The rest of the strategy remains as per the TAC
process.
The Code
______________________________________________________________
Page 3 of 7
Dynamic Subtotal Text in ALV
______________________________________________________________
______________________________________________________________
Page 4 of 7
Dynamic Subtotal Text in ALV
______________________________________________________________
EXCEPTIONS
no_data_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
REFRESH li_ccd_data[].
ENDIF. "IF sy-subrc NE 0.
IF li_ccd_data IS NOT INITIAL.
SORT li_ccd_data BY coop2.
*Call Object specific FMs individually
LOOP AT li_funclist INTO lwa_funclist.
CLEAR: l_check,
l_exc.
IF lwa_funclist-funcname IS NOT INITIAL.
li_func_parametrs = li_ccd_data.
DELETE li_func_parametrs WHERE coop2 NE lwa_funclist-
funcname.
*Populate parameters with which FM needs to be called
*Loop within loop is necessary to call the function dynamically and
*number of rows in these
*loops are not more than 100 so perofrmance wise it should not be an
*issue . Besides, we are
*also deleting the 2nd loop internal table keeping only relevent rows i
n
*that
LOOP AT li_func_parametrs ASSIGNING <lfs_func_param>.
IF <lfs_func_param>-coop3 = lc_fm_para_exc.
"Exception parameters
l_exc = l_exc + 1.
lwa_etab_line-name = <lfs_func_param>-coop5.
lwa_etab_line-value = l_exc."
INSERT lwa_etab_line INTO TABLE lih_etab.
ELSE.
lwa_ptab_line-name = <lfs_func_param>-coop5.
CONCATENATE lc_bracket_opn <lfs_func_param>-coop4
lc_bracket_cls <lfs_func_param>-low INTO l_var.
*Take reference of SAP Standard paramter into local variable
ASSIGN (l_var) TO <lfs_name>.
IF <lfs_name> IS ASSIGNED.
CASE <lfs_func_param>-coop3.
WHEN lc_fm_para_exp.
"Populate exporting paramters dynamically
*Exporting paramter for FM means importing paramter while calling FM
lwa_ptab_line-kind = abap_func_importing.
GET REFERENCE OF <lfs_name> INTO lwa_ptab_line-value.
WHEN lc_fm_para_imp.
""Populate Importing paramters dynamically
*Importing paramter for FM means exporting paramter while calling FM
lwa_ptab_line-kind = abap_func_exporting.
GET REFERENCE OF <lfs_name> INTO lwa_ptab_line-value.
WHEN lc_fm_para_chg.
"Populate changing paramters dynamically
lwa_ptab_line-name = <lfs_func_param>-coop5.
lwa_ptab_line-kind = abap_func_changing.
GET REFERENCE OF <lfs_name> INTO lwa_ptab_line-value.
WHEN lc_fm_para_tab.
"Populate Tables paramters dynamically
lwa_ptab_line-kind = abap_func_tables.
______________________________________________________________
Page 5 of 7
Dynamic Subtotal Text in ALV
______________________________________________________________
______________________________________________________________
Page 6 of 7
Dynamic Subtotal Text in ALV
______________________________________________________________
This solution removes any manual intervention of tracking and modifying such
enhancement strategy stub every time a new function module requires new parameters
to be accessed/changed and thereby ensures that the individual function modules uses
only those parameters which it requires and not all. Risk of a break in logic inside the
user exit owing to an addition of a new parameter is also removed.
Credits
The credits for this solution/design/code is to be shared by Arkajeet Dasgupta and Amit
Kumar.
______________________________________________________________
Page 7 of 7