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

Problem with VA01 - Function 'SD_SALESDOCUMENT_CREATE'

Former Member
0 Likes
1,470

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_in

thank 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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,218

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

9 REPLIES 9
Read only

Former Member
0 Likes
1,219

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

Read only

0 Likes
1,218

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.

Read only

0 Likes
1,218

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

Read only

0 Likes
1,218

Actually in the same line of the error there is a column called parameter it has the value SALES_ITEM_IN

Read only

0 Likes
1,218

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

Read only

0 Likes
1,218

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 ) ...

Read only

0 Likes
1,218

Hi

It seems some parameters of the sales area is missing, I can see sales org. (NOE2) only: where is distr.chan?

Max

Read only

0 Likes
1,218

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 ?

Read only

0 Likes
1,218

Hi

The system should be get the company code from Sales Org. (table TVKO)

Max