‎2007 Mar 21 4:01 PM
Hi all,
is it possible to call in a dynamic way a macro?
thanks
enzo
‎2007 Mar 21 4:11 PM
hi,
I think it is<b> not</b> possible.
It should be defined before we call it.
Regards,
Sailaja.
‎2007 Mar 21 4:11 PM
hi,
I think it is<b> not</b> possible.
It should be defined before we call it.
Regards,
Sailaja.
‎2007 Mar 21 4:15 PM
Hi,
Are you looking something like this
* Macro for controling the update tables
define updatetable.
if v_eflg ne c_y.
if not &2[] is initial.
modify &1 from table &2.
if sy-subrc ne 0.
move c_y to v_eflg.
if not &2[] is initial.
i_idoc_status-docnum = v_docnum.
i_idoc_status-status = '51'.
i_idoc_status-msgty = 'E'.
i_idoc_status-msgid = 'YMAT'.
i_idoc_status-msgno = '733'.
i_idoc_status-msgv1 = &3.
i_idoc_status-msgv2 = ' '.
i_idoc_status-msgv3 = ' '.
i_idoc_status-msgv4 = ' '.
append i_idoc_status.
endif.
else.
i_idoc_status-docnum = v_docnum.
i_idoc_status-status = '53'.
i_idoc_status-msgty = 'S'.
i_idoc_status-msgid = 'YMAT'.
i_idoc_status-msgno = '736'.
i_idoc_status-msgv1 = &3.
i_idoc_status-msgv2 = ' '.
i_idoc_status-msgv3 = ' '.
i_idoc_status-msgv4 = ' '.
append i_idoc_status.
endif.
endif.
endif.
end-of-definition.
updatetable ymatccid i_yccureid 'YMATCCID'.
updatetable ymatrplt i_yccureidt 'YMATRPLT'.
aRs
‎2007 Mar 21 4:21 PM
Can you please expand on it please? A macro itself is a block of executable statements. So you cannot really do a macro execution dynamically without writing down the macro name and passing the macor parameter values. If you have something like CALL MACRO ... then you probably can. But there is no such syntax. You can probably write a subroutine that takes the macro name, its parameters as the subroutine parameters and within the subroutine, you can build a CASE statement on macro name and write the actual macro statement there.
But I don't see why you want to do it dynamically.
‎2007 Mar 21 4:35 PM
hHw about a Dynamic subroutine instead ? something like
PERFORM (form_name) IN PROGRAM (sy-cprog).
~Suresh