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

USEREXIT_SAVE_DOCUMENT_PREPARE is not showing sales orders ATP allocations

0 Likes
3,490

Hi All ,

USEREXIT_SAVE_DOCUMENT_PREPARE is not showing sales orders ATP allocations when called from BAPI_SALESORDER_CREATEFROMDAT2

As per sap , SAVE_DOCUMENT_PREPARE "This userexit can be used for changes or checks, before a sales document is Saved"

Which means this Exit should have all the lines item details in XVBAP table before order is saved. This works fine when we are using VA01 TCODE.

But for some reason when we are calling BAPI "BAPI_SALESORDER_CREATEFROMDAT2" to create the order, user exit SAVE_DOCUMENT_PREPARE do not have APO confirmation sublines.

Did anybody ever faced such issues ?

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

VeselinaPeykova
Active Contributor

I think that SAP note 2146153 - Sales order enhancements stopped working after upgrade or note 1849230 implementation is relevant for your case. According to it "In case of background processing (edi, bapi call, background job), the atp check is now called only once after the userexit_save_document_prepare."

I suggest that you read the note for possible workarounds (there is even a code snippet).

0 Likes

Thank you so much Veselina. This is the piece of information I was looking for.

Answers (4)

Answers (4)

rupesh_brahmankar
Active Contributor
0 Likes

Hello,

Save user exits are only called when saving the data on the database They are called at the end of program MV45AF0B_BELEG_SICHERN.

For product allocation (PAL) check is skipped when creating the sales order through BAPI_SALESORDER_CREATEFROMDAT2 please refer SAP note 2781796 - PAL not checked with BAPI when field REGION is used in CVC

Best Regards,

R.Brahmankar

Lakshmipathi
SAP Champion
SAP Champion
0 Likes

Not sure in which version you are working. Have a look at OSS notes 191184 and 324171

0 Likes

Thanks Thanga !

ATP is getting called during the BAPI.

but the problem is ATP is getting called after user exit SAVE_DOCUMENT_PREPARE is triggered. so the logic in SAVE_DOCUMENT_PREPARE is not having ATP line items and confirmation. this is creating problems for all the logic in user exit.

while I am debugging in VA01 , ATP is getting called before exit SAVE_DOCUMENT_PREPARE and the same logic in SAVE_DOCUMENT_PREPARE is getting all the ATP line items and hence works fine.

Please help me if you have any idea on any configuration from ATP that is making this issue.

ThangaPrakash
Active Contributor
0 Likes

@Snehal Khasale Did you try with 'USEREXIT_SAVE_DOCUMENT_PREPARE'

0 Likes
Yes , user exit I mentioned in above post is

MV45AFZZ-USEREXIT_SAVE_DOCUMENT_PREPARE.

ThangaPrakash
Active Contributor
0 Likes

@Snehal Khasale

Are you passing schedule line data ( ORDER_SCHEDULES_IN & ORDER_SCHEDULES_INX ) to FM 'BAPI_SALESORDER_CREATEFROMDAT2'.

Refer to below notes.

500176

If the above does not help, then set a breakpoint at FM AVAILABILITY_CHECK_CONTROLLER to ensure that ATP is actually being called during your Bapi process. This is the function responsible for the ATP check.

0 Likes

thanga.prakash yes I am passing schedule lines to ORDER_SCHEDULES_IN & ORDER_SCHEDULES_INX.

Lakshmipathi
SAP Champion
SAP Champion
0 Likes

When you post a query and give further updates, please add the content under "Comments" and not under "Answer" as you were not answering to a query but only providing additional informations as asked by the members. Also, when you add the text under Comments, it will be intimated to the person to whom you are responding whereas, if you add the text under Answer, the member will not be intimated. By the way, your above answer has been converted as comment by me.