Skip to Content
author's profile photo Former Member
Former Member

Diff between BAPI_CUSTOMERRETURN_CREATE and BAPI_SALESORDER_CREATEFROMDAT2

Hi,

Can any one tell me the difference between BAPI_CUSTOMERRETURN_CREATE and BAPI_SALESORDER_CREATEFROMDAT2. I knew that BAPI_CUSTOMERRETURN_CREATE is used to create return orders but i am not sure about the second BAPI.

Regards,

Jaya

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 03:13 PM

    Hi,

    BAPI_SALESORDER_CREATEFROMDAT2 is used to create Sales order types like OR. This internally used Business Object BUS2032 which used to create the Sales order.

    where as BAPI_CUSTOMERRETURN_CREATE is used to create Returns sales orders with order type RZ.

    <REMOVED BY MODERATOR>

    Regards,

    Ashok

    Edited by: Alvaro Tejada Galindo on Jan 29, 2008 10:20 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 03:07 PM

    Hi Jaya Sri,

    Sales order: Create Sales Order

    FM - BAPI_SALESORDER_CREATEFROMDAT2

    Functionality

    You can use this method to create sales orders.You must enter at least sales order header data (via ORDER_HEADER_IN structure) and partner data (via the ORDER_PARTNERS table) as input parameters.

    Enter the item data via the ORDER_ITEMS_IN table. You can allocate item numbers manually, by filling in the relevant fields, or the system does it, according to the settings for Customizing, by leaving the relevant fields blank.

    If you have configurable items, you must enter the configuration data in the ORDER_CFGS_REF, ORDER_CFGS_INST, ORDER_CFGS_PART_OF and ORDER_CFGS_VALUE tables.

    Credit cards can be transferred via the BAPICCARD structure, on the one hand, data for card identification, on the other, data for a transaction which has taken place in an external system.

    Once you have created the sales order successfully, you will receive the document number (SALESDOCUMENT field). Any errors that may occur will be announced via the RETURN parameter.

    If no sales area has been created in the sales order header, then the system creates the sales area from the sold-to party or ship-to party, who has been entered in the partner table. If a clear sales area cannot be created, you will receive a system message, and the sales order will not be created.

    Notes

    1. Mandatory entries:

    ORDER_HEADER_IN : DOC_TYPE Sales document type

    SALES_ORG Sales organization

    DISTR_CHAN Distribution channel

    DIVISION Division

    ORDER_PARTNERS..: PARTN_ROLE Partner role, SP sold-to party

    PARTN_NUMB Customer number

    ORDER_ITEMS_IN..: MATERIAL Material number

    2. Ship-to party:

    If no ship-to party is entered, use the following: Ship-to party =

    sold-to party.

    3. Commit control:

    The BAPI does not have a database commit. This means that the relevant application must leave the commit, in order that can be carried out on on the database. The BAPI BAPI_TRANSACTION_COMMIT is available for this.

    4. German key words:

    The following key words must be entered in German, independantly of

    the logon language:

    DOC_TYPE Sales document type, for example: TA for standard order

    PARTN_ROLE Partner role, for example: WE for ship-to party

    Further information

    You can find further information in the OSS. The note 93091 contains general information on the BAPIs in SD.

    Parameters

    SALESDOCUMENTIN

    ORDER_HEADER_IN

    ORDER_HEADER_INX

    SENDER

    BINARY_RELATIONSHIPTYPE

    INT_NUMBER_ASSIGNMENT

    BEHAVE_WHEN_ERROR

    LOGIC_SWITCH

    TESTRUN

    CONVERT

    SALESDOCUMENT

    RETURN

    ORDER_ITEMS_IN

    ORDER_ITEMS_INX

    ORDER_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

    Exceptions

    Sample Code:

    ************SALES ORDER INPUT CREATION.
    
    PARAMETERS: p_auart TYPE auart OBLIGATORY.
    PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    PARAMETERS: p_spart TYPE vtweg OBLIGATORY.
    
    PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
    PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
    
    *ITEM
    PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
    PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
    PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    PARAMETERS: p_itcat TYPE pstyv OBLIGATORY.
    
        * DATA DECLARATIONS.
    
    DATA: v_vbeln LIKE vbak-vbeln.
    DATA: header LIKE bapisdhead1.
    DATA: headerx LIKE bapisdhead1x.
    DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
    DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
    DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
    WITH HEADER LINE.
    DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
    WITH HEADER LINE.
    
        * HEADER DATA
    
    header-doc_type = p_auart.
    headerx-doc_type = 'X'.
    
    header-sales_org = p_vkorg.
    headerx-sales_org = 'X'.
    
    header-distr_chan = p_vtweg.
    headerx-distr_chan = 'X'.
    
    header-division = p_spart.
    headerx-division = 'X'.
    
    headerx-updateflag = 'I'.
    
        * PARTNER DATA
    
    partner-partn_role = 'AG'.
    partner-partn_numb = p_sold.
    APPEND partner.
    
    partner-partn_role = 'WE'.
    partner-partn_numb = p_ship.
    APPEND partner.
    
        * ITEM DATA
    
    itemx-updateflag = 'I'.
    
    item-itm_number = '000010'.
    itemx-itm_number = 'X'.
    
    item-material = p_matnr.
    itemx-material = 'X'.
    
    item-plant = p_plant.
    itemx-plant = 'X'.
    
    item-target_qty = p_menge.
    itemx-target_qty = 'X'.
    
    item-target_qu = 'EA'.
    itemx-target_qu = 'X'.
    
    item-item_categ = p_itcat.
    itemx-item_categ = 'X'.
    
    APPEND item.
    APPEND itemx.
    
        * Fill schedule lines
    
    lt_schedules_in-itm_number = '000010'.
    lt_schedules_in-sched_line = '0001'.
    lt_schedules_in-req_qty = p_menge.
    APPEND lt_schedules_in.
    
        * Fill schedule line flags
    
    lt_schedules_inx-itm_number = '000010'.
    lt_schedules_inx-sched_line = '0001'.
    lt_schedules_inx-updateflag = 'X'.
    lt_schedules_inx-req_qty = 'X'.
    APPEND lt_schedules_inx.
    
        * Call the BAPI
    
    CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
    EXPORTING
    sales_header_in = header
    sales_header_inx = headerx
    IMPORTING
    salesdocument_ex = v_vbeln
    TABLES
    return = return
    sales_items_in = item
    sales_items_inx = itemx
    sales_schedules_in = lt_schedules_in
    sales_schedules_inx = lt_schedules_inx
    sales_partners = partner.
    
        * Check the return table.
    
    LOOP AT return WHERE type = 'E' OR type = 'A'.
    EXIT.
    ENDLOOP.
    
    IF sy-subrc = 0.
    
    WRITE: / 'Error in creating document'.
    
    ELSE.
    
    COMMIT WORK AND WAIT.
    
    WRITE: / 'Document ', v_vbeln, ' created'.
    
    ENDIF.
    

    hope this helps.

    <REMOVED BY MODERATOR>

    cheers,

    Hema.

    Edited by: Alvaro Tejada Galindo on Jan 29, 2008 10:15 AM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.