on 01-16-2012 2:11 PM
Hi APO experts,
can I design one macro so that it will call another macro? I have one macro containing complicated logic and this logic needs to be reused in different macro(s). I want to avoid multiple-place maintenance of the included logic and I want to simplify my result macro.
Thanks a lot, points will be rewarded indeed...
Zdenek Stastny
Hi Zdenek,
Write a macro containing the logic that you want to repeat.
Remaining logic should be kept in other macros.
If you want to combine the macros above now, then create a new macro and choose macro type as "COLLECTIVE".
The required component macros can now be specified in sequence in this collective macro. When the collective macro will execute, all the component macros will get executed as required.
Hope this helps.
Thanks - Pawan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Zdenek,
>
> Write a macro containing the logic that you want to repeat.
> Remaining logic should be kept in other macros.
>
> If you want to combine the macros above now, then create a new macro and choose macro type as "COLLECTIVE".
> The required component macros can now be specified in sequence in this collective macro. When the collective macro will execute, all the component macros will get executed as required.
>
> Hope this helps.
>
> Thanks - Pawan
Hi Pawan, thanks for this tip. But actually this doesn't solve my problem completely since the component macros are always executed in sequence. In my case I have something like:
IF something
do Marco 1
ELSEFI something differenent
do Marco 2
ENDIF
so I need to be able to influence whether the component macros are getting executed or not.
Does it have some solution?
Hi Zdenek,
As far as I know, SAP doesn't provide the functionality to call a macro from another macro.
One thought comes to my mind. See if you could use it this way.
You have 2 macros: say macro1 & macro2.
Take your below kind of scenario:
IF something
do Marco 1
ELSEFI something differenent
do Marco 2
ENDIF
In macro1 itself, do the check for "IF something".
Similarly in macro2, do the check corresponding to "ELSEIF".
Whatever type your macro is e.g. default, step change, etc, you can give the sequence number in macro definition, so that macros would be executed in the sequence that you want.
Give the numbering in macro definitions similar to the sequence in which you wanted to run the macros. Not sure if this could take care of your requirement, but this is the only way ahead I can think of. If you need more info on above, please let me know.
Thanks - Pawan
How about putting that logic in a Z function module and calling that from the different macros
Thanks
Aparna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How about putting that logic in a Z function module and calling that from the different macros
>
> Thanks
> Aparna
Hi Aparna,
yes, this is of course possible but in this case I don't want to make sub-macro in ABAP since it is already made very
elegantly as macro and also our team for APO maintenance is able to understand and change this themselves. If I would make this as Z function module than me as abaper will be needed for any changes.
Edited by: Zdenek Stastny on Jan 17, 2012 8:11 AM
User | Count |
---|---|
9 | |
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.