Skip to Content
0
Oct 31, 2012 at 11:45 AM

BAPI to create sales order with reference

3456 Views

Hi.

I'm looking for a solution to create a sales order with reference, in one week wasted. For example, I wasted some days until discovery the quantity will be filled (in new document) only if I fill schedule lines.

I searched in the forum (and sap notes) and found some suggestions, but I could not solve this issue.

My program is already codificated and I tryied two different BAPI's and also Call transaction. But until now, no one works fine. By BAPI, it creates document but occurs problems liek bellow.

I need create a sales order with reference, but functional asked to:

1- same repeated material items in ref. doc will become only one summarized line in new document; So, copy items will be N (original items) x M (probably less items, by using collect by material code).

2- New document type will be other (I'm filling it, ok).

3- Main problem until now:

-> BAPI BAPI_SALESORDER_CREATEFROMDAT2, does not run copy control rotines:

Here we have some important rotines in control copy, and must be relevant to new document.

-> In BAPI transaction I found BAPI_SALESDOCU_CREATEWITHDIA, but some errors (V2068, V4219, V0102) occurs in dialog way and TI_RETURN comes back empty.

PS: I tryied a lot of configurations to BAPI BAPI BAPI_SALESORDER_CREATEFROMDAT2. One of those was without items and running VA02 after that to add items. But this way also does not rum copy control.

PS.2: I was woundering if I create new document exactly equal to original document and aftar that I delete itens and modify quantities with call VA02.

What do you think ?

Apreciate any help.

best regards.

Glauco