My requirement is as follows:
I have to create a return order with reference to a billing document using the BAPI BAPI_SALESDOCU_CREATEFROMDATA .
I have all my billing documents for which the return orders need to be created and was suggested to use the BAPI BAPI_SALESDOCU_CREATEFROMDATA to create the return orders for all the obtained billing documents.
I observed that the following are the mandatory interface pararmeters for the above BAPI:
ORDER_HEADER_IN and BUSINESS_OBJECT
ORDER_ITEMS_IN and ORDER_PARTNERS
and my input to the BAPI is as follows:
ORDER_HEADER_IN - DOC_TYPE is of type return order
ORDER_HEADER_IN - SALES_ORG
ORDER_HEADER_IN - DISTR_CHAN
ORDER_HEADER_IN - DIVISION
ORDER_HEADER_IN - ORD_REASON
ORDER_HEADER_IN - REF_DOC is my billing document number
ORDER_HEADER_IN - REF_DOC_CA = M (invoice)
BUSINESS_OBJECT = BUS2102 (this business object is for return order)
ORDER_ITEMS_IN MATERIAL = providing the material number
ORDER_ITEMS_IN - REQ_QTY = providing the required quantity as well
ORDER_PARTNERS - PARTN_ROLE is SP(Sold to party)
ORDER_PARTNERS - PARTN_NUMB is the customer number(Sold to party number)
Having given this input to the BAPI, it is creating sales document with document category H(Returns), however the document seems as if the referencing is missing.
So, may i ask you all for your help to provide your inputs on this? Am i passing correct values? anything more needs to be passed to BAPI?
Kindly provide me your inputs ASAP.
Thanks in advance,
For Return Orders you may to use the BAPI: BAPI_CUSTOMERRETURN_CREATE.
Please check this as BAPI_SALESDOCU_CREATEFROMDATA may not support the specific order types.
You may have to populate below items.
CALL FUNCTION 'BAPI_CUSTOMERRETURN_CREATE'
RETURN_HEADER_IN = lst_header_in
RETURN_HEADER_INX = lst_header_inx
CONVERT = ' '
SALESDOCUMENT = l_babi_vbeln
RETURN = ltbl_return
RETURN_ITEMS_IN = tbl_items
RETURN_ITEMS_INX = ltbl_items_inx
RETURN_PARTNERS = tbl_partners
RETURN_SCHEDULES_IN = tbl_schedule_in
RETURN_SCHEDULES_INX = ltbl_schedule_inx
Thanks a lot for your inputs.
here i have a small question:
When i am passing
RETURN_HEADER_IN-REF_DOC = Billing document number (return is to be created with ref to billing document)
RETURN_HEADER_IN-REFDOC_CAT = 'M' (Invoice)
to the bapi 'BAPI_CUSTOMERRETURN_CREATE', it is creating the return order, however, it seems as if it is created without reference to billing document.
i did some investigation on BAPI to understand its flow, but i could not understand why it is not creating the return order with reference to billing document.
kindly do let me know if you have any inputs on this.