‎2007 Feb 21 1:37 PM
Hi ,
I want to create a sales order using bapi BAPI_SALESORDER_CREATEFROMDAT2.
I have created a program but its giving some errors (like please mention either sold to party or ship to party , and sales order was not <b>Changed</b>) .
can any body provide some code which is creating sales order successfully.
Regards,
sandeep.
‎2007 Feb 21 1:41 PM
Hello,
In the Item table being passed into the BAPI...
You need to fill
<b> ORDER_PARTNERS..: PARTN_ROLE Partner role, SP sold-to party
PARTN_NUMB Customer number</b>
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
ORDER_HEADER_IN = hdr
convert = 'X'
IMPORTING
SALESDOCUMENT = salesdoc
TABLES
return = ret_tbl
ORDER_ITEMS_IN = itm
ORDER_PARTNERS = prtnr
ORDER_ITEMS_inx = itmx
ORDER_CONDITIONS_IN = conds
ORDER_CONDITIONS_INX = condsx
order_schedules_in = schd_lin.
Make sure that you fill in:
* Assigning ref doc to create line item entries in VBFA.
itm-REF_DOC = i_vakgu-vbeln. "ref doc
itm-REF_DOC_IT = i_vbap-posnr. "line item of ref doc
itm-REF_DOC_CA = 'B'. "doc type of ref docReward points accordingly.
Vasanth
‎2007 Feb 21 1:41 PM
Hello,
In the Item table being passed into the BAPI...
You need to fill
<b> ORDER_PARTNERS..: PARTN_ROLE Partner role, SP sold-to party
PARTN_NUMB Customer number</b>
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
ORDER_HEADER_IN = hdr
convert = 'X'
IMPORTING
SALESDOCUMENT = salesdoc
TABLES
return = ret_tbl
ORDER_ITEMS_IN = itm
ORDER_PARTNERS = prtnr
ORDER_ITEMS_inx = itmx
ORDER_CONDITIONS_IN = conds
ORDER_CONDITIONS_INX = condsx
order_schedules_in = schd_lin.
Make sure that you fill in:
* Assigning ref doc to create line item entries in VBFA.
itm-REF_DOC = i_vakgu-vbeln. "ref doc
itm-REF_DOC_IT = i_vbap-posnr. "line item of ref doc
itm-REF_DOC_CA = 'B'. "doc type of ref docReward points accordingly.
Vasanth
‎2007 Feb 21 1:42 PM
I'm sure lots of people can supply code that works.
But then they would be doing YOUR job. You need to work through the documentation of the function module and speak to a functional person who can help you get the data set up correctly to create an order.
As a start, try creating a sales order in VA01 and write down the data that you used, then transfer this to a test case in SE37 and once that works transfer it to your program.
Gareth.
‎2007 Feb 21 1:47 PM
//like please mention either sold to party or ship to party
error will be the customer number which from ur code might not be a valid one for the particular sales area.
see in order to rectify this error fetch the suitable customer for the sales area you are using .
search for the customer in table KNVV
KUNNR
VKORG
VTWEG
SPART
regards,
vijay