Application Development 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: 

BAPI "BAPI_SALESDOCU_CREATEFROMDATA"

Former Member
0 Kudos

Hello All,

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:

Import Parameters:

ORDER_HEADER_IN and BUSINESS_OBJECT

Tables Parameters:

ORDER_ITEMS_IN and ORDER_PARTNERS

and my input to the BAPI is as follows:

Import parameters:

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)

and

BUSINESS_OBJECT = BUS2102 (this business object is for return order)

Tables Parameters:

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,

Prasad.

3 REPLIES 3

Former Member
0 Kudos

Hi,

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'

EXPORTING

  • SALESDOCUMENTIN =

RETURN_HEADER_IN = lst_header_in

RETURN_HEADER_INX = lst_header_inx

  • SENDER =

  • BINARY_RELATIONSHIPTYPE =

  • INT_NUMBER_ASSIGNMENT =

  • BEHAVE_WHEN_ERROR =

  • LOGIC_SWITCH =

  • TESTRUN =

  • CONVERT = ' '

IMPORTING

SALESDOCUMENT = l_babi_vbeln

TABLES

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

  • RETURN_CONDITIONS_IN =

  • RETURN_CFGS_REF =

  • RETURN_CFGS_INST =

  • RETURN_CFGS_PART_OF =

  • RETURN_CFGS_VALUE =

  • RETURN_CFGS_BLOB =

  • RETURN_CFGS_VK =

  • RETURN_CFGS_REFINST =

  • RETURN_TEXT =

  • RETURN_KEYS =

  • EXTENSIONIN =

  • PARTNERADDRESSES =

.

0 Kudos

Hello Ashok,

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)

and

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.

Thanks again!

KLN

Former Member
0 Kudos

Hi ,

In items_in there is a parameter ref_doc,ref_doc_ca this needs to be filled out.Once this is filled it will show in the document flow of that document.

Regards,

sasi