cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

APO read key figure data from a macro by specifying location

bijit
Explorer
0 Likes
905

In APO macro by default it reads the key figures for the runtime location. Is there any standard SAP macro function or combination of functions to read a key figure by specifying the location, which is different from runtime location. Example.

If

ACT_LOCATION = 5600

Action:

Layout variable, Var1 = Forecast ; by default this is the forecast at location 5600.

Layout variable, Var2 = Forecast @ Location 5700.

Condition

If Var 1 > Var 2

Result

A = B

Endif.

Looking for options to set Var2 using standard macro functions or combination of functions.

Accepted Solutions (1)

Accepted Solutions (1)

0 Likes

Dear Bijit,

the suggestion is to use macro function ORDER_DATA_LOCPRODS, in which you can freely specify the location, product and category group. So only thing you need is to have a category group containing your forecast:

https://help.sap.com/viewer/c95f1f0dcd9549628efa8d7d653da63e/7.0.4/en-US/7f3fc95360267614e10000000a1...

Alternatively you can create a user function macro or BAdI macro and use the released BAPIs via transaction BAPI --> Supply Chain Management --> BAPI_PIRSRVAPS_GETLIST or BAPI_PBSRVAPS_GETDETAIL2 to read the forecast in your z-coding.

Regards, Nico

Answers (2)

Answers (2)

bijit
Explorer
0 Likes

Step4. Use above three steps in a process chain to be triggered by event

Step5. Use z-code to trigger the event.

bijit
Explorer
0 Likes

Thanks Nico for wonderful suggestion. I am working in DP, so tried user function using the BAPI....GETDETAIL2; BADI was next target. User function worked for one CVC, unfortunately for second CVC call of the new user function from the macro step was not taking place. Searched OSS note and somewhere came across that using this BAPI from macro gets into various errors. So explored alternative solution. Here it is.

Set up: KF1 @ LOC1 & LOC2, objective use KF1@LOC1 in macro step for LOC2

Used an additional KF2.

Step1. Copy KF by using macro - KF1@ LOC1 is copied to KF2@LOC1

Step2. Copy by Realignment - KF2@LOC1 to KF2@LOC2;

Now LOC2 has KF1@LOC1 value in KF2@LOC2

Step3. Main Macro:

Used If ACT_LOCATION = LOC2.

....rest of the macro steps to use KF1 values of LOC1 & LOC2.