Dynamic Perform not calling
There is something interesting i like to share with you all and get your ideas!!
this is about calling a perform dynmaically, its used very wide in SAP
here is a common form of use.
lets say we have two reports: y_main and another report y_caller
inside y_main there is a form
and inside the y_caller
perform trigger in program y_main if found.
this will work for sure!!
but what we want is dynamic call!!
DATA: lv_form_name type tnapr-ronam value 'TRIGGER',
lv_prog_name type tnapr-pgnam value 'Y_MAIN'.
perform (lv_form_name) in PROGRAM lv_prog_name IF FOUND.
this code above will not work very interestingly!!!
but the code below works
DATA: ls_tnapr type tnapr.
ls_tnapr-ronam = lv_form_name.
ls_tnapr-pgnam = lv_prog_name.
perform(ls_tnapr-ronam) IN PROGRAM (ls_tnapr-pgnam) IF FOUND.
when you call with type of a structure the dynamic call works otherwise it wont!!
Did anyone see this before?