cancel
Showing results for 
Search instead for 
Did you mean: 

Returning two values from user function in macro

Former Member
0 Kudos

Hi Experts,

My requirement is I have to return two values from a user function(Z function module) to a macro.

First I tried returning with F_ARGUMENT. In macro I used LAYOUTVARIABLE_SET to get the values from user function. Here both the values came out in the same variable with a space in between. I had no Idea on how to segregate the values in macro.

Later I tried returning the values in F_TAB table. I passed the values line by line out of user function. Now I am struggling on looping the F_TAB table values and getting them in separate variables in macro.

Request help. Let me know if something is not clear.

Accepted Solutions (1)

Accepted Solutions (1)

babu_kilari4
Active Contributor
0 Kudos

Hi Manjunatha,

I was looking for some documentation on SAP Help related to "SPLIT" function to see if you can segregate the f_argument data. However, I could not find out any such function except a function where it can actually merge the strings together.

Also, I am not sure if it is possible to implement a loop in the planning book macros. At least I have not seen something of that sort.

However, I have an idea to solve the issue that you're facing. May be you can try to see if it works.

Step 1 :- Pass the string that has been already concatenated in the f_argument variable and bring the data to a temporary variable by using the function LAYOUTVARIABLE_SET

Step 2 :- Now, call another user function module Z_USERFUNCTION2 ( LAYOUTVARIABLE ( variable ) ). Inside the function module, write ABAP code to split the string into 2 text strings and pass the first string before the space. So, F_argument would have this information and macro should use the LAYOUTVARIABLE_SET function again to store this information in a temporary variable.

Step 3 :- Similarly, now call another user function module Z_USERFUNCTION ( LAYOUTVARIABLE (variable) ). Inside the function module, write ABAP code to get the second half of the string and assign it to f_argument.

This way you have the values in two different variables which can then be used in your planning book macro.


Hope this helps.

Babu Kilari

Former Member
0 Kudos

Thanks for your time spent Babu,

Right now I have arrived at this solution. I have created two function modules one returning the first value and the other one returning the second. As of now everyone is ok with the solution.

Kindly share the document you mentioned about macro functions and also any other document listing the macro functions and their functionalities.

Thanks again!

babu_kilari4
Active Contributor
0 Kudos

Hello Manjunatha,

Following SAP Help's documentation has all the macro functions listed for SCM 7.0 version.

Operators and Functions in Macros - Planning Area Administration - SAP Library

I think this is the superset as it has all the functions that planning book macros can actually handle. If you want to gain a bit more knowledge in macros, perhaps you could spend sometime on the following links written by one of our SCN experts


Understanding Macros . This link has got links to the previous blogs on the same topic.

Hope the above information helps. Please get back to us if you have any other questions. You may close the thread if there are no other questions.


Thanks & Best Regards,

Babu Kilari

Answers (0)