cancel
Showing results for 
Search instead for 
Did you mean: 

Calling APO Marco from ABAP Report (custom code)

0 Kudos

Hello Gurus,

We can call a Function module from Macro (from menu, Edit -> Edit user function).

Is it possible to call a Macro from a custom report? Kindly let me know the step.

Thank you in advance..

Regards,

Vishal

Accepted Solutions (1)

Accepted Solutions (1)

peter_casper
Contributor
0 Kudos

Hi Vishal,

I would not try to incoporate a generated macro coding into a wrapper program in case the macro logic is as simple as you described, i.e. copying one KF to another KF for a certain selection.

I would rather enhance the ABAP program and incoprorate the respective BAPI "BAPI_PBSRVAPS_GETDETAIL2" to read time series data from the live cache according to the entries from your selection screen and then write it back to the desired target key figure with BAPI "BAPI_PBSRVAPS_CHANGEKEYFIGVAL".

Firstly this will be much easier instead of trying to artificially incorporate a macro and secondly it will be a supported way by SAP in case of any issues.

Cheers, Peter

0 Kudos

Hello Peter,

Thanks for the reply. Even I had this option in mind and working on this as well.

I've been working for MM,SD and FI as a technical consultant for some time now.. and its my first encounter with APO development.

A bit struggling in reading values from BAPI_PBSRVAPS_GETDETAIL2 based on product/location input parameters as I'm not very much aware what are all required filled to be passed in this BAPI and how to get those values using product/location. And once I get these values again what all parameters will be used to update KF's using BAPI_PBSRVAPS_CHANGEKEYFIGVAL.

Could you please give some hint on this. so that I can quickly move on this..!

Thank you so much again..

Regards,

Vishal

peter_casper
Contributor
0 Kudos

Hi Vishal,

try to get an ABAP developer next to you. The recommended BAPIs are pretty easy to access correctly. You can try to check it out on your own via Trx. SE37 where you mainly need to fill the version, the planning book, data view, key figure and date range.

You can also use the "where used" list to see how SAP fills the same BAPI (in case they use it somewhere).

Additional documentation on the BAPIs can be found via Trx BAPI.

regards, Peter

Answers (1)

Answers (1)

former_member187488
Active Contributor
0 Kudos

Hi Vishal,

I think it would be quite difficult.
Macros are called via FM /SAPAPO/ADVX_MACRO_CALCULATION.
It will only work with correct input.
And also calling this FM and macro program in customizing report is not supported by SAP.

I wonder what is the propose that you want to call a macro via customizing report?

Best Regards,
Ada

0 Kudos

Hello Ada..

Thanks so much for the reply.!

We've a custom report used for Release to Supply Network Planning(similar to /SAPAPO/MC90). It copies data from GPA Planning to SNP Planning Book. During the execution of this report Customer also wants to copy one of the Key Figure's row values to another  key figure values of Global planning book based upon the product and location combination currently being executed.

Currently we've a macro which is triggered through process chain and it copies these key figure row values from one to another while triggered manually.

We've called this macro from customer report using following steps:

a) called an event from customer report

b) this event invokes SM36 background job.

c) this job invokes a process chain job (/SAPAPO/MC8E) which in turn calls macro.

but the issue here is, by doing so our macro is copying key figures from source row to target key row values for all planning books, whereas we want it to be called for a particular product/location combination for which our custom report is being executed.

Kindly suggest how this can be solved.

Thanks again in advance..

Regads,

Vishal

Former Member
0 Kudos

Vishal,

Well, I don't really understand the details of your macro, but the underlying data that is manipulated by a Macro is not specific to a planning book, it is specific to the planning area.  All Macros that make changes to data write their changes to the planning area, not to the planning book.  So, your custom report, once you find a way to write it, would eventually do no differently than what your Background job is currently doing.

You can limit the scope of changes that are executed by a Macro by use of special Selections and special DataViews.  However, these will still write the changes to the Planning Area.

It is sometimes helpful to create new KeyFigures in a Planning Area, that are not displayed in any Planning book, but are used to facilitate the manipulation of data contained in a report.

Best Regards,

DB49

0 Kudos

Hello Dogboy..

I'm very new to APO, with past exp on MM,SD, FI.

So, still trying to understand your reply.. not very much aware of APO terminologies and there working

Thank so much for sharing your knowledge.

Regards,

Vishal

Former Member
0 Kudos

Vishal,

Here are a few high level definitions:

Planning Area is the database where data is stored.

Planning book is a custom program that reads, displays, and allows changes to the content of the Planning Area database.

Data View is a subset of the Planning Book.  There can be multiple Data Views for each Planning Book.

Macros are custom programs that are attached to either the Planning Books or the Data Views.

There can be multiple Planning Books for a single Planning Area.

When you execute an //MC8E-related job, you typically define the Planning area, the Planning Book, the Planning Version, the Data View, and the Selection ID.

Selection IDs are another set of custom programs that are integrated with the Planning books.  These permit restricting the data that is loaded into the planning book for viewing/maintenance.

For more info, see

Planning Book Maintenance - Planning Area Administration - SAP Library

Best Regards,

DB49