cancel
Showing results for 
Search instead for 
Did you mean: 

How to automatically change undefined/blocked/rejected articles on sales order creation with BAPI_SALESORDER_CREATEFROMDAT2?

Former Member
0 Kudos

Hi experts, we have a flow where external systems create sales orders in SAP by BAPI. Sometimes, some order items may not be created, e.g. article is not defined for distr.chain, article is blocked or some other reason, preventing the entire sales order to be created.

We want all the proper sales order items to be created. All items causing an error should also be created with a dummy (text) article.

We are looking for a standard solution, but it seems there is no way to customize a replacement for non-defined or blocked articles.

If no standard solution exists, we need an appropriate place to code the logic.

Thanks for your help & best regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Martin,

There is no standard way to achieve what you need.

You will need to have developped a new function module which runs all the preliminary checks (ex. does the material exist). If the material does not exist, replace the material number by the dummy number. After your checks call BAPI_SALESORDER_CREATEFROMDAT2 with the corrected list of materials.

Assign the new function module in WE57 to your IDOC type and message type.

Bernhard

Answers (1)

Answers (1)

andrea_brusarestelletti
Active Contributor
0 Kudos

Hello,

  we had to manage the same scenario.As Bernhard said, in the interface program, before calling BAPI_SALESORDER_CREATEFROMDAT2, we run all the preliminary checks and remove items which would give a blocking error. On top of that, in order to keep trace of blocked items, we send an inbox message to a list of selected user with the external Sales Order Number reference and item ID of the materials rejected.

I guess that the cases you want to catch are due mainly to errors in the creation of material master data. Otherwise, if there are situations that can be foreseen, (for instance materials with temporary blocks) you can try to use material substitution (transaction VB11).

Best regards,

Andrea