Skip to Content
0
Former Member
Jun 10, 2013 at 06:01 AM

BAPI to create Sales Order with reference to Inquiry ??

1849 Views

Hi Experts ,

i want to create Sales Order with reference to inquiry , currently i am Using BAPI : BAPI_SALESORDER_CREATEFROMDAT2 , but it's giving me error as

"SD document 10000070 is not in the database or has been archived " type 'E' ID 'V1' number '302'.

"Sales document was not changed"

10000070 is my inquiry number which i am passing as reference number to BAPI.

when i try to execute this BAPI through se37 , it's creating sales order but not copying all data from inquiry and incomplete SO created .

my code is :




IT_HEADER_IN-REFDOCTYPE = 'ZIND'.
IT_HEADER_IN-DOC_TYPE = 'ZBDS'.
IT_HEADER_IN-SALES_ORG = '1000'.
IT_HEADER_IN-DISTR_CHAN = '10'.
IT_HEADER_IN-DIVISION = '10'.
IT_HEADER_IN-REF_DOC = '10000070'
IT_HEADER_IN-REFDOC_CAT = 'A'.
APPEND IT_HEADER_IN.

IT_HEADER_INX-UPDATEFLAG = 'I'.
IT_HEADER_INX-DOC_TYPE = 'X'.
IT_HEADER_INX-SALES_ORG = 'X'.
IT_HEADER_INX-DISTR_CHAN = 'X'.
IT_HEADER_INX-DIVISION = 'X'.
IT_HEADER_INX-REF_DOC = 'X'.
IT_HEADER_INX-REFDOC_CAT = 'X'.
APPEND IT_HEADER_INX.

IT_PARTNERS-PARTN_ROLE = 'AG'.
IT_PARTNERS-PARTN_NUMB = WA_VKORG-KUNNR.
APPEND IT_PARTNERS.

IT_PARTNERS-PARTN_ROLE = 'WE'.
IT_PARTNERS-PARTN_NUMB = WA_VKORG-TS_CUST.
APPEND IT_PARTNERS.



CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
* SALESDOCUMENTIN =
ORDER_HEADER_IN = IT_HEADER_IN
ORDER_HEADER_INX = IT_HEADER_INX
* SENDER =
* BINARY_RELATIONSHIPTYPE =
* INT_NUMBER_ASSIGNMENT =
* BEHAVE_WHEN_ERROR =
* LOGIC_SWITCH =
* TESTRUN =
* CONVERT = ' '
IMPORTING
SALESDOCUMENT = SO_NUM
TABLES
RETURN = IT_RETURN
* ORDER_ITEMS_IN =
* ORDER_ITEMS_INX =
ORDER_PARTNERS = IT_PARTNERS
* ORDER_SCHEDULES_IN =
* ORDER_SCHEDULES_INX =
* ORDER_CONDITIONS_IN =
* ORDER_CONDITIONS_INX =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CFGS_BLOB =
* ORDER_CFGS_VK =
* ORDER_CFGS_REFINST =
* ORDER_CCARD =
* ORDER_TEXT =
* ORDER_KEYS =
* EXTENSIONIN =
* PARTNERADDRESSES =
.
IF SY-SUBRC = 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = L_RETURN.



ENDIF.

Please help me to resolve this 😕 .