Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_SALESORDER_CRATEFROMDAT2 - Sub-item still open after creating my order

0 Kudos
1,222

Hi there,

I have a specific function module called remotely that creates an offer and in some cases the order that goes with it using the BAPI_SALESORDER_CRATEFROMDAT2 function module.

In a test case, I'm using a material that has a sub item set via CS03.

When I only create my offer via my FM and create the order via VA01, I have no problem.
When I create both via my FM, my sub item remains Open (problem with VBUP) and there is no line in VBFA.

Do you have any idea how to solve this problem?

Regards.

6 REPLIES 6
Read only

former_member156446
Active Contributor
0 Kudos
1,137

When you say VBFA is empty, it sounds like you are not passing the REF_DOC in ORDER_HEADER_IN and also using the X in the corresponding ORDER_HEADER_INX.

Read only

0 Kudos
1,137

I expressed myself badly, I have the line of my material (my first item), but not that of my sub-item in VBFA.
REF_DOC is populated.

Read only

0 Kudos
1,137

Thanks ChatGPT 😉

Read only

0 Kudos
1,137

Any ideas ?

Read only

Maciej_Domagała
Contributor
0 Kudos
1,137

I haven't played with BAPI_SALESORDER_CRATEFROMDAT2 in context of offer documents - but I guess it is not enough to fill REF_DOC in ORDER_HEADER_IN only. This way you describe the reference for the header data only - not for item data. The system has still no information about references that should be applied for items.

I would try to fill also fields: REF_DOC, REF_DOC_IT, REF_DOC_CA - in BAPISDITM structure - parameter ORDER_ITEMS_IN (and corresponding 'X' fields in ORDER_ITEMS_INX of course).

This is how it works when you create a return order (with BAPI_CUSTOMERRETURN_CREATE / reference to an invoice for example) - so I think the logic will be the same in BAPI_SALESORDER_CRATEFROMDAT2 when creating with reference to an offer.

regards

Read only

chaouki_akir
Contributor
0 Kudos
1,137

BAPI and transaction VA01 should behave in the same way. If not, it can be because :

  • BAPI parameters are not filled correctly*
  • BAPI limitation (search OSS notes)
  • specific code with special condition

Can you show how do you fill parameters of the BAPI ?