2009 Nov 03 6:18 PM
Hi Guys , Im facing some troubles with this function i wanted to use originally 'BAPI_SALESORDER_CREATEFROMDAT2' but it give me some troubles because of business object 'BUS2032' which is hardcode in the bapi , I have tried to use Function 'SD_SALESDOCUMENT_CREATE' indicating the lines that i want to use form contract ( parameter SALES_ITEMS_IN ) and i get the error A document with number 'XXX' already exists. where 'XXX' is vbeln . What can i do any advice. Here is some code :
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
SALESDOCUMENT = pt_postab-vbeln
sales_header_in = order_header_in
BUSINESS_OBJECT = ''
TABLES
RETURN = return
SALES_ITEMS_IN = order_items_in
SALES_PARTNERS = order_partners
SALES_SCHEDULES_IN = order_schedules_inthank very much for your advices...
Edited by: José M. Sánchez on Nov 4, 2009 1:14 PM
Edited by: José M. Sánchez on Nov 4, 2009 1:14 PM
2009 Nov 04 6:00 PM
Hi
I had a problem like yours and I created a Z-BAPI as copy of 'BAPI_SALESORDER_CREATEFROMDAT2 where I replaced the business Object BUS2032 with mine: the business object for contract should be BUS2034
Anyway u can use fm SD_SALESDOCUMENT_CREATE
Max
2009 Nov 04 6:00 PM
Hi
I had a problem like yours and I created a Z-BAPI as copy of 'BAPI_SALESORDER_CREATEFROMDAT2 where I replaced the business Object BUS2032 with mine: the business object for contract should be BUS2034
Anyway u can use fm SD_SALESDOCUMENT_CREATE
Max
2009 Nov 05 2:49 PM
Thanks Max , yeap it could be a solution copy de BAPI i meant , I ´ve already awarded some points , now im getting an error
2 E V5 046 Please Enter qty.of order in field qty.with the same name. 000000 VBAPKOM
Did you ever get an error like that ? , I ve checked the mandatory fields in bapi tables but i dont know if there is one thing missing.
2009 Nov 05 2:56 PM
Hi
I think u need to transfer the structure-X where it need to set the flags corrisponding to the fields transfered ti the fm so SALES_ITEMS_INX and SALES_SCHEDULES_INX
Max
2009 Nov 05 3:31 PM
Actually in the same line of the error there is a column called parameter it has the value SALES_ITEM_IN
2009 Nov 05 4:10 PM
Hi
Try to check if you fill the right field for thee quantity
Anyway there's the standard BAPI BAPI_CONTRACT_CREATEFROMDATA for the contract
MAx
2009 Nov 05 4:49 PM
thank you Max , your advices are very helpful , however i have a new problem that is now related with the language , it says Material DIAS_TRABALHO is not defined for sales org.NOE2, distr.chan., language PT . which is a very silly error because i have created sales orders with va01 same material same distrib. chane. even with the BDC in a program (im using a bapi cause the supposed to be more efficient ) ...
2009 Nov 05 4:53 PM
Hi
It seems some parameters of the sales area is missing, I can see sales org. (NOE2) only: where is distr.chan?
Max
2009 Nov 06 5:32 PM
You were right ( again ) , i had some fields empty , now a ihave a new error :
E F5 165 Company code is not defined
my FI consultant executed Va01 and he doesnt has anytrouble , what could be wrng ?
2009 Nov 16 4:56 PM
Hi
The system should be get the company code from Sales Org. (table TVKO)
Max