Skip to Content
0
Former Member
Dec 27, 2012 at 10:04 AM

creation of Sales order with Reference to other sales document

1214 Views

Hi all,

as per requirement i need to create sales order with reference to other sales document, now i am using BAPI_SALESORDER_CREATEFROMDAT2 Fm to create sales document..

the code as follows:

CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'

EXPORTING

input = 'OR'

IMPORTING

output = ls_BAPISDHD1-DOC_TYPE

EXCEPTIONS

others = 1.

ls_BAPISDHD1-ref_doc = '0000000722'. " order number

ls_BAPISDHD1-REFDOC_CAT = 'C'. " order catagory

ls_BAPISDHD1X-DOC_TYPE = 'X'.

ls_BAPISDHD1X-ref_doc = 'X'.

ls_BAPISDHD1X-REFDOC_CAT = 'X'.

ls_BAPIPARNR-PARTN_ROLE = patner_role.

ls_BAPIPARNR-PARTN_NUMB = sold_to_party.

APPEND ls_BAPIPARNR to lt_BAPIPARNR.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

* SALESDOCUMENTIN =

ORDER_HEADER_IN = ls_BAPISDHD1

ORDER_HEADER_INX = ls_BAPISDHD1X

* SENDER =

* BINARY_RELATIONSHIPTYPE =

* INT_NUMBER_ASSIGNMENT =

* BEHAVE_WHEN_ERROR =

* LOGIC_SWITCH =

* TESTRUN =

* CONVERT = ' '

IMPORTING

SALESDOCUMENT = lv_vbeln

TABLES

RETURN = lt_BAPIRET2

* ORDER_ITEMS_IN =

* ORDER_ITEMS_INX =

ORDER_PARTNERS = lt_BAPIPARNR.

the problem is the new sales document is creating but it is incomplete. the new document did not getting the data from reference doc(provided in ref_doc of header parameter), Is i need to pass any other parameters or use any other FM's to create sales document. please suggest me.

Thanks in Advance

Ram