cancel
Showing results for 
Search instead for 
Did you mean: 

Sales Order number not populated at the time of Adjust Numbering Phase in RAP

VivekG
Participant
0 Kudos
118

Hi Experts,

We have created ODATA V4 Web API using RAP to create Sales Order using  EML on I_SALESORDERTP in a custom Action.  Once the action method is executed, adjust numbering of this custom API is triggered and the adjust numbering method  of I_SALESORDERTP is triggered after the custom API adjust numbering and due to this we are unable to find the Sales Order number during Custom API adjust numbering method. 

Why is SAP RAP triggering I_SALESORDERTP Adjust numbering method after the custom API adjust numbering? 

Due to this limitation in RAP framework, we are using BAPI - BAPI_SALESORDER_CREATEDAT2 with Destination None as commit is not supported directly in RAP and multiple commits for multiple sales Order update is also not supported. 

Do we have any better straight forward solution to this in RAP?? 

@Andre_Fischer  -  Could u pls help on this issue? 

 

Thanks,

Vivek 

 

Accepted Solutions (0)

Answers (2)

Answers (2)

MioYasutake
Active Contributor
0 Kudos

@VivekG 

When using late numbering BOs such as I_SALESORDERTP, you can get generated keys only at the point of save_modified method, so there is no way to set the key in the response body, as I understand it. However, keys are available in the response header 'sap-messages', which the consumers of your API can receive.

Fullstack_Dev
Discoverer
0 Kudos

In SAP RAP (RESTful ABAP Programming Model), there are specific mechanisms for transaction control and numbering based on underlying frameworks, such as EML (Entity Manipulation Language). The situation you're describing seems to be related to the call sequence and numbering rules within the transaction processing framework. Here are a few things to consider:

  1. Transaction Processing Order: In RAP, various steps are executed within a transaction before the actual commit occurs. When you perform a custom action on an entity like I_SALESORDERTP, adjustments or changes to the data might only be visible after the transaction processing. The numbering of sales orders could happen in a later stage of the transaction (e.g., at a COMMIT), after your custom action has been executed.
  2. Late Number Assignment: In SAP S/4HANA, there is a concept called "late number assignment." This means the final numbering of documents (e.g., the sales order number) happens at the end of the transaction or just before data is saved. If your custom API adjustment takes place before this point, you may not have access to the final sales order number yet.
  3. EML and Numbering: When using EML to create sales orders, the numbering method might be executed separately from RAP transaction control. In this case, the numbering process for I_SALESORDERTP could occur after the custom action or API adjustment, as the final number is generated in a later step.
  4. Numbering Process in the API: Since you mentioned that your custom API triggers a numbering adjustment, you might be in an early stage of the numbering process. If the I_SALESORDERTP numbering method runs after your custom adjustment, it's likely because SAP ensures that all standard numbering steps happen after any custom modifications.

Suggested Solutions:

  • Delayed Access to the Sales Order Number: To ensure you have access to the sales order number, you could modify your custom API so that it either runs after the standard numbering method for I_SALESORDERTP or use a mechanism to trigger another action once the numbering process is complete.
  • Check Extension Points: Consider using extension points or specific hooks to adjust the timing of your custom API, ensuring that it runs after the numbering method.

If you want to dive deeper into the details of the transaction logic and numbering process, debugging sessions or a detailed analysis of the transaction method sequence could help pinpoint the exact cause.