cancel
Showing results for 
Search instead for 
Did you mean: 

Simsession short dump when calling BAPI

HighTechDom
Advisor
Advisor
0 Kudos

Hello,

I have created a macro in Demand Planning that calls BAPI_APO_AVAILABILITY_CHECK.

When running this is SE37 or SE38, everything works fine. But when calling this from //SDP94 I got a shortdump, because the BAPI wanted to create a simsession, but there was already an existing simsession.

Do you think, this is an error in the BAPI, or do i have to handle this in the calling FM?

Would this be the right approach:

FM "Z_TEST"

CALL FUNCTION //RRP_SIMSESSION_GET -


Save SIMSESSION from DP

CALL FUNCTION //RRP_SIMSESSION_LEAVE -


Clear Simsession

CALL FUNCTION //BAPI_APO_AVAILABILITY_CHECK

CALL FUNCTION //RRP_SIMSESSION_SET -


Set old SIMSESSION back

I do not understand the purpose of the SIMSESSION, so I rely on your comments and help.

Thanks for any feedback,

BR,

Dominik

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Domink

Simsessions are simulation sessions or work areas for transactional live cache data. You must create a simsession in order to retrieve and work with data from live cache. When finished you should close the simsession however most times the end of a LUW will delete the simsession. If data created/changed in a simsession needs to be saved an explicit LC commit may be required but in most cases that is taken care of within SAP code. In fact, the leave simsession fm will determine that data in the simsession has changed and ask if you want to save.

I am not sure if you can get around the simsession creation problem in the ATP BAPI. If you had control over the code such as in a Zfunction module you could either not create the simsession or force a merge of simsessions. Do not code the leave simsession because that will delete (rollback) or force the save of the changed data from your planning book before you entered the macro - in addition when you return to your planning book from the macro there will not be a simsession for you to save or change data.

Why are you running ATP from within a DP planning book? Are you looking for what stock is available to update another KF? Do you need to run through the entire ATP process to retrieve an available qty or can you use a simpler function module to retrieve the stock? Another option is to read the planning book in a stand alone program, do the ATP check and whatever logic is necessary before writing back to the planning book.

Hope this helps

Andy

Answers (0)