BAPIs to create sales orders for Returns and Debit Memo Request

Hi,
I have to create a sales order for document type Returns as well as a debit memo request.The BAPI 'BAPI_SALESORDER_CREATEFROMDAT2' is giving the following error message for Debit Memo Request document creation as well as for Returns.
761 Unpermitted combination of business object BUS2032 and sales doc. category L
I found BAPIs:
‘BAPI_CUSTOMERRETURN_CREATE’ for creating sales document of type ZDRE and SD document category ‘H’.
‘BAPI_DEBITREQUEST_PROXY_CREATE’ for creating sales document of type ZDDR and SD document category ‘L’.
please let me know if anybody have used them. If so what values need to be passed to I_UPLOAD_ID,I_DESTIN,I_SFA_REL parameters of BAPI_DEBITREQUEST_PROXY_CREATE. Are there any alternative solutions using the Salesorder bapi.
I have to create documents based on the flat file data no reference sales document numbers are available.
Appreciate your help..
Good Day
Regards
Bhargavi

Look at the code done by me
Program Name:                                                        *
SAP Name    : ZAXXXXXX               Version    :                    *
Programmer  : Chris Dong of ITDC                    *
Description :                                                        *
Includes        :                                                    *
Function Modules: XX_XXXXXX                                          *
Transactions    :                                                    *
Programs        :                                                    *
REPORT  XXXXXXXX LINE-SIZE  80
                 LINE-COUNT 65
                 MESSAGE-ID ZA
                 NO STANDARD PAGE HEADING.
CLEAR l_order_partners.
l_order_partners-partn_role = 'AG'.
l_order_partners-partn_numb = '0001202491'.
APPEND l_order_partners TO li_order_partners.
CLEAR l_order_partners.
l_order_partners-partn_role = 'WE'.
l_order_partners-partn_numb = '0001202491'.
APPEND l_order_partners TO li_order_partners.  
Sales document type
l_order_header_in-doc_type = 'ZDR'.  
Sales organization
l_order_header_in-sales_org = '1000'. 
Distribution channel
l_order_header_in-distr_chan = '01'.  
Division
l_order_header_in-division = '04'. 
REF DOCUMENT
l_order_header_in-REF_DOC = '9100000144'.
order reason
l_order_header_in-ord_reason = '925'.
item number
l_order_items_in-itm_number = '000001'. 
material no
l_order_items_in-material = '000000000007000012'. 
Qty
l_order_items_in-target_qty = '0000000000100.000'. 
APPEND l_order_items_in TO li_order_items_in. 
*BUS2094 Credit memo request " OSS NOTE 93091
*BUS2096 Debit memo request " OSS NOTE 93091
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA'
EXPORTING
ORDER_HEADER_IN = l_order_header_in
BUSINESS_OBJECT = 'BUS2096'
WITHOUT_COMMIT = ' '
CONVERT_PARVW_AUART = ' '
IMPORTING
SALESDOCUMENT = l_vbeln
RETURN = li_return
TABLES
ORDER_ITEMS_IN = li_order_items_in
ORDER_PARTNERS = li_order_partners
Message was edited by:
        Chris Dong
null

Similar Messages

  • Creating Sales Order for "Payer" thru VA01 trans.

    Dear All,
    In our project, we have stations which r  <b>Sold-to-party</b> and <b>Credit customers</b> which is a <b>Payer</b>.
    We have to create <b>Sales order</b> for both <b>Stations</b> and <b>Credit customers</b>. Creating Sales order for Station is not a problem but each station has many credit customers, which are maintained in the Station.
    When we are creating Sales Order via <b>VA01</b> for a particular credit customer, we are entering Station as a sold-to-party and it asks for Payer which is the Credit customer for that station.<b>But when we are recording through SHDB transaction it is not asking for payer(credit customer for that station).</b>
    Please let me know  of BAPI or some other method to create sales order for credit customer(Payer). 
    Kindly help at the earliest.
    Thanks and Regards,
    Sudipto.

    Hi,
    There is TABLES parameter where you can pass the PARTNERS information. I am not sure of the parameter name but it would refer to something like BAPIPAR.
    Regards,
    Ravi
    Note : Please mark all the helpful answers.

  • Duplication of Purchase Order while creating sales orders for a customer

    when we try to create sales order for one customer it have to create by picking up the purchase order from the table linearly.
    But the problem is that here when we are trying to create multiple sales orders the same purchase order is being picked.
    for example..when we create sales order 1 the purchase order picked is PO1 and
    for creation of sales order 2 the same purchase order PO1 is being picked up instead of PO2.
    No idocs are being generated in this, even to check them..
    How shall i resolve this...? Please help me out ASAP

    Hi Kumar,
    Thanks for the reply. But actually the problem is that this is related to some customized table in the project. When a EDI Batch job runs in the background then automatically the SO is created and the PO is being picked from the table(custom table) and then posted against the respective SO. we are not aware of that job which is triggering this to debug. Once if we can know that particular batch job or pgm or edi or idoc what ever it is then we can debug.
    Do you have any idea how can we find that particular pgm/edi/idoc/job name which triggers this creation of SO?

  • Creating Sales Order for Item Category TATX (Text)

    How can I create Sales order for text item where no material master has been maintained?
    It does not give me any conditions and no accounting document.
    What I need to do if I want to create that with a value?
    Thanks
    ST

    Hi,
    Its not possible to create an SO w/o material code.
    But you can create an dummy material.
    This dummy material can be just an refer to create an SO.
    Do refer the below help doc which may help you..
    Settings in the Material Master (Dummy-Material) - mySAP Engineering &amp;amp; Construction - SAP Library

  • Create Sales Order for Repair

    Hi All,
    I want to create a Repair Sales Order using BAPI 'BAPI_SALESORDER_CREATEFROMDAT2'.
    When I create the order using tcode VA01 it asks me to enter Material, Servicable Material and the Repair Information.
    How can I pass the Servicable Material and the Repair Information to the above BAPI.
    Any help will be appreciated.
    Regards,
    Shubham

    Hi
    Please refer to the following documentation.
    Method
    SalesOrder.CreateFromDat2
    Sales order: Create Sales Order
    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
    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
    Ship-to party:
    If no ship-to party is entered, use the following: Ship-to party =
    sold-to party.
    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.
    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.
    Regards
    Inder

  • Error while creating sales order for material with another DIVISION

    Hello Friends,
    I have a problem with my sales order creation.
    I have defined a new sales area 0010 / 10 / 01. I have the sales order type assigned to this sales area. (in VOV8 for the sales order type, in the 'General Control' the 'item division' is flagged.
    Now, I have created the sold to party XYZ with all the partner functions defaulted same as the sold to party for the sales area 0010 / 10 / 01.
    NOW, I have the material ABC with the DIVISION 10 in the basic data. I have extended the material to my sales org & dist. channel & plant.
    Now, while creating the sales order for my sales area 0010 / 10 / 01 , I enter the sold to party XYZ - it is OK. But when I enter the material ABC, I get the error - "SHIP TO PARTY IS NOT DEFINED FOR SALES AREA 0010 / 10 / 10"
    Please help to resolve the issue.
    Edited by: Vivek on Aug 13, 2009 9:04 AM

    Hi
    Common division for Material Master data will not work
    Because in the material master Division is a field not an organizational unit
    Means when you create MMR you will give sales org, DC, Plant  as organizational units and then enter but not division
    Division is a field maintained in basic data and sales org data 1
    This is the reason in t code you will find in t code VOR2 Common division only customer and conditions but not materials
    But in t code VOR1 Common DC ,customer  conditions and materials all there are available (you can check these t codes)
    Coming to your issue Item div is clecked in your order type
    This means the division in MMR has the priority or control for that order type
    Your header division is 01 ( taken from customers sales area) and item division is 10 (taken from MMR as per your post)
    So it differs
    To process this order with Item div is clecked in your order type you need to extend your Sold to party ABC to the sales area 0010/10/10 (the sales area where the division of the material falls)
    or alternatively
    There should be a  customer say DEF created in sales area 0010/10/10 who will be a ship to party ( your error is also the same)
    for your ABC  that is sold to party in sales area 0010/10/01 where the order is registered
    Hope yopu are getting it
    ABC in sales area 0010/10/01 will have  or should have ship to paty DEF  in sales area 0010/10/10 
    or
    ABC should operate in in sales area 0010/10/10  too
    If item division is not ticked then these are not necessary as the header division 01 will be valid for all items and syatem will not look MMR at all for division
    Regards
    Raja

  • Bapi To create sales order with reference of sales order.

    Hi all,
          Having requerment To create sales order with reference of onother  open sales order.
    Example: there open sales order which having qty of 20 for that 10 qty as already billed , for remain  10 qty as to create the new sales order with reference to the excsiting one.
    Please guide me how do it.
    Regards,
    Santosh
    Edited by: santosh jajur on May 15, 2010 11:47 AM

    Hi Santhosh,
    check this thread.
    Re: Open Sales Order Migration
    The last part of the thread says done.
    hope you get a hint from that.
    Also this one
    Re: how to create open sales order using BAPI....?
    http://abaplovers.blogspot.com/2008/02/bapi-sales-order-create-code.html
    Regs,
    SuryaD.
    Edited by: SuryaD on May 15, 2010 9:09 PM
    Edited by: SuryaD on May 15, 2010 9:10 PM
    Edited by: SuryaD on May 15, 2010 9:11 PM

  • Created sales order for one division, for which the material belongs to ano

    Dear All,
    A sales order has been created for a division 10, for which the material belongs to some other division 20 in material master.
    When we are  create a sales order for 10 division ( the one which we give at organzational data) at the item level the material which we select should also belong to the same division, if  the material division  is different as 20 the system will throw an error at sales order  saying "ship-to-party so and so is not created for the sales area so and so.."
    But here it's allowing me to create a sales order for division 10 with 20 Division material without any error. But this should not happen.
    Checked in the document type VOV8 where at the Check division field 2 has been there.
    Please suggest

    Hello,
    Let me explain the concept of Header division and item division...the header division is the one which gets copied from the sales area division that gets determined in the sales doc creation from SP.
    The item division is the division that gets copied from the material master in the line item material.
    In the Sales document type , there is a check box "Item Division". If this is marked, then system takes the division from the Mat master. if this is not marked system the system doesnt find from MMR instead it picks up from header division.
    The check division controls, how the system should behave in case the header and item division differ..
    Rgds,
    Rags.

  • BAPI to create Sales Order with reference to contract

    Hi All,
    I am trying to create Sales Order with reference to Contract, but although the
    order gets created, it does not contain reference document information. 
    The BAPI I am using is BAPI_SALESORDER_CREATEFROMDAT2. 
    Would someone know which parameters I have to papulate,or have any other suggestion
    how to accomplish my task? 
    Thank you so much, 
    Mayank

    Hi - Try Filling these three fields in the Item details.
    REF_DOC
    REF_DOC_IT
    REF_DOC_CA
    Reward points if helpful

  • BAPI for Creating Sales Order For Variant Configuration Materials

    Dear Gurus,
    Before posting this thread, we have referred many SDN threads, OSS notes and other sites for any sort of help..but no success..All threads and other referrals are not much of help as they are kind of incomplete( Perhaps, we are unable to understand them..no offense).
    Few checked threads on this subjects are:
    http://scn.sap.com/thread/34590
    http://scn.sap.com/thread/851070
    http://scn.sap.com/community/abap/blog/2014/04/23/update-vc-variant-configuration-data-using-standard-bapi-in-sales-order
    http://scn.sap.com/community/abap/blog/2014/07/15/creating-orders-with-variant-configured-items-using-bapisalesordercreatefromdat2
    http://scn.sap.com/community/abap/blog/2014/04/23/update-vc-variant-configuration-data-using-standard-bapi-in-sales-order
    http://scn.sap.com/thread/120144
    OSS: 549563
    Well, we're using the BAPI (BAPI_SALESORDER_CREATEFROMDAT2) which creates the sales order successfully but without the characteristic values in line items.
    We're passing data to the following parameters - ORDER_CFGS_REF, ORDER_CFGS_INST, ORDER_CFGS_VALUE to create the variant config but not able to see it getting created.
    Pls find attached BAPI coding document for your reference.
    If you could throw any light on this issue will be of great help for us.
    Thank You in Advance!!!
    Reg,
    Jagan-SD.

    Jagan nath
    Try below.
    you would need miimum of 3 segments to pass variant config data using this bapi
    ORDER_CFGS_REF for each configurable item
    POSEX = ITEM #
    CONFIG_id , root_id - Start with 1 and increment it for each configurable line item
    ORDER_CFGS_INST
    CONFIG_ID - from above
    INST_ID - Start with 1 and increment it for each configurable line item
    OBJ_TYPE = "MARA'
    CLASS_TYPE = '300'
    OBJ_KEY = material #
    ORDER_CFGS_VALUE
    CONFIG_ID for the item, INST_ID for the item
    charc for characteristic value
    VALUE for characteristic value
    Reference thread
    How to Fill Configuration Data in BAPI BAPI_SALESORDER_CREATEFROMDAT2
    Hope it will solve your issue.
    Thanks
    Ritesh

  • BAPI to create sales order

    Hi friends i am facing problem in this code , i tried a lot but still some errors are coming  can you please suggest how to remove the errors, anwers will be rewarded , thanks in advance
    *& Report  Z_TEST_BAPI
    REPORT  Z_TEST_BAPI.
    data : ORDER_HEADER_IN like BAPISDHD1.
    data : ORDER_ITEMS_IN like BAPISDITM occurs 0 with
    header line.
    data : RETURN like BAPIRET2 occurs 0 with header line.
    data : ORDER_PARTNERS like BAPIPARNR occurs 0 with
    header line.
    DATA : ORDER_KEYS LIKE BAPISDKEY OCCURS 0 WITH HEADER
    LINE.
    data : ORDER_SCHEDULES_IN like BAPISCHDL occurs 0 with
    header line.
    data : BEGIN OF TAB OCCURS 0,
            SRNO(4),
            DOC_TYPE like ORDER_HEADER_IN-dOC_TYPE,
            SALES_ORG LIKE ORDER_HEADER_IN-SALES_ORG,
            DISTR_CHAN LIKE ORDER_HEADER_IN-DISTR_CHAN,
            DIVISION like ORDER_HEADER_IN-DIVISION,
           REQ_DATE_H(10),
           PURCH_DATE(10),
            PMNTTRMS LIKE ORDER_HEADER_IN-PMNTTRMS,
            PURCH_NO_C LIKE ORDER_HEADER_IN-PURCH_NO_C,
            ITM_NUMBER like BAPISDITM-ITM_NUMBER,
            MATERIAL   LIKE  ORDER_ITEMS_IN-MATERIAL ,
           CUST_MAT22 LIKE ORDER_ITEMS_IN-CUST_MAT22,
            PLANT LIKE ORDER_ITEMS_IN-PLANT,
            TARGET_QTY LIKE ORDER_ITEMS_IN-TARGET_QTY,
           ITM_NUMBER LIKE ORDER_ITEMS_IN-ITM_NUMBER,
           MATERIAL   LIKE  ORDER_ITEMS_IN-MATERIAL ,
            PARTN_ROLE LIKE ORDER_PARTNERS-PARTN_ROLE,
            PARTN_NUMB LIKE ORDER_PARTNERS-PARTN_NUMB,
          END OF TAB.
    *data: tab like alsmex_tabline occurs 0 with header
    *line.
    DATA: gd_currentrow type i.
    data : PURCHASEORDER like ekko-ebeln.
    Data: tot_rec type i,     "Total Records
         gd_update type i,   "Main Table Increement Counter
         gd_lines type i,    "Success Table increement Counter
         w_textout like t100-text. "VARIABLE TO GET ERRORLOG
    data : begin of it_success occurs 0,
            SALESDOCUMENT LIKE BAPIVBELN-VBELN,  "PROJECT
          end of it_success.
    data : begin of it_error occurs 0,
            srno(4),
            err_msg(73) TYPE c,    "TO RETREIVE ERROR MESSAGES
         end of it_error.
    data : srno(4).
    DATA : SALESDOCUMENT LIKE  BAPIVBELN-VBELN.
    selection-screen begin of block b1 with frame.
    skip 3.
    parameter:p_infile like rlgrap-filename obligatory.
    skip 3.
    selection-screen end  of block b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_infile.
      PERFORM value_help.
    start-of-selection.
    CALL FUNCTION 'WS_UPLOAD'
      EXPORTING
        filename                     = p_infile
       FILETYPE                      = 'DAT'
      HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      tables
        data_tab                      = tab.
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    **perform open_group.
    sort tab by row col.
    Get first row retrieved
    read table tab index 1.
    Set first row retrieved to current row
    gd_currentrow = tab-row.
    loop at tab.
    Reset values for next row
       if tab-row ne gd_currentrow.
         append tab .
         clear tab.
         gd_currentrow = tab-row.
       endif.
       SHIFT TAB-VALUE LEFT DELETING LEADING SPACE.
       case tab-col.
         when '0001'.
           TAB-SRNO = tab-value.
         when '0002'.
           TAB-DOC_TYPE = tab-value.
         when '0003'.
           TAB-SALES_ORG = tab-value.
         when '0004'.
           TAB-DISTR_CHAN = tab-value.
         when '0005'.
           TAB-DIVISION = tab-value.
         when '0006'.
           TAB-REQ_DATE_H =  tab-value.
         when '0006'.
           TAB-PURCH_DATE = tab-value.
         when '0007'.
           TAB-PMNTTRMS = tab-value.
         when '0008'.
           TAB-PURCH_NO_C = tab-value.
           when '0009'.
           TAB-ITM_NUMBER = tab-value.
          when '0010'.
           TAB-CUST_MAT22 = tab-value.
         when '0011'.
           TAB-PLANT  = tab-value.
         when '0012'.
           TAB-TARGET_QTY = tab-value.
         when '0013'.
           TAB-PARTN_ROLE = tab-value.
         when '0014'.
           TAB-PARTN_NUMB = tab-value.
       endcase.
    endloop.
    append tab.
    clear tab.
      sort tab by SRNO.
      LOOP AT TAB.
       concatenate tab-REQ_DATE_H+4(4)
    *tab-REQ_DATE_H2(2) tab-REQ_DATE_H0(2) into
    *tab-REQ_DATE_H.
       concatenate tab-PURCH_DATE+4(4)
    *tab-PURCH_DATE2(2) tab-PURCH_DATE0(2) into
    *tab-PURCH_DATE.
        SRNO = TAB-SRNO.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            INPUT  = tab-PARTN_NUMB
          IMPORTING
            OUTPUT = tab-PARTN_NUMB.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            INPUT  = tab-MATERIAL
          IMPORTING
            OUTPUT = tab-MATERIAL.
            CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
              EXPORTING
                input         = tab-ITM_NUMBER
             IMPORTING
               OUTPUT        = tab-ITM_NUMBER .
        IF TAB-SRNO = SRNO.
          ORDER_HEADER_IN-DOC_TYPE = TAB-DOC_TYPE.
          ORDER_HEADER_IN-SALES_ORG = TAB-SALES_ORG.
          ORDER_HEADER_IN-DISTR_CHAN = TAB-DISTR_CHAN.
    ORDER_HEADER_IN-REQ_DATE_H = TAB-REQ_DATE_H.
         ORDER_HEADER_IN-PURCH_DATE = TAB-PURCH_DATE.
          ORDER_HEADER_IN-PMNTTRMS = TAB-PMNTTRMS.
          ORDER_HEADER_IN-PURCH_NO_C = TAB-PURCH_NO_C.
          ORDER_HEADER_IN-DIVISION  = tab-DIVISION.
          ORDER_ITEMS_IN-ITM_NUMBER = tab-ITM_NUMBER.
           ORDER_ITEMS_IN-MATERIAL = TAB-MATERIAL.
         ORDER_ITEMS_IN-material = TAB-CUST_MAT22.
          ORDER_ITEMS_IN-PLANT      = TAB-PLANT.
          APPEND ORDER_ITEMS_IN.
          ORDER_PARTNERS-PARTN_ROLE = TAB-PARTN_ROLE.
          ORDER_PARTNERS-PARTN_NUMB = TAB-PARTN_NUMB.
          APPEND ORDER_PARTNERS.
         ORDER_SCHEDULES_IN-ITM_NUMBER = tab-ITM_NUMBER.
          ORDER_SCHEDULES_IN-REQ_QTY = tab-TARGET_QTY.
          append ORDER_SCHEDULES_IN.
        ENDIF.
        AT END OF SRNO.
          CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
            EXPORTING
               SALESDOCUMENTIN               =
                 ORDER_HEADER_IN               = ORDER_HEADER_IN
               ORDER_HEADER_INX              =
               SENDER                        =
               BINARY_RELATIONSHIPTYPE       =
               INT_NUMBER_ASSIGNMENT         =
               BEHAVE_WHEN_ERROR             =
               LOGIC_SWITCH                  =
               TESTRUN                       =
               CONVERT                       = ' '
           IMPORTING
             SALESDOCUMENT                 = SALESDOCUMENT
            TABLES
             RETURN                        = RETURN
                 ORDER_ITEMS_IN                = ORDER_ITEMS_IN
               ORDER_ITEMS_INX               =
                 ORDER_PARTNERS                = ORDER_PARTNERS
                 ORDER_SCHEDULES_IN            = 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                    = ORDER_KEYS
               EXTENSIONIN                   =
               PARTNERADDRESSES              =
          IF SALESDOCUMENT <> SPACE.
            commit work.
            ADD 1 TO gd_update.
            it_success-SALESDOCUMENT = SALESDOCUMENT.
            append it_success.
            CLEAR :SALESDOCUMENT,ORDER_HEADER_IN.
            REFRESH : RETURN,ORDER_ITEMS_IN,ORDER_PARTNERS.
          ELSE.
            loop at return.
              it_error-SRNO = tab-SRNO.
              it_error-err_msg = return-MESSAGE .
              Append it_error.
            ENDLOOP.
            CLEAR :SALESDOCUMENT,ORDER_HEADER_IN.
            REFRESH : RETURN,ORDER_ITEMS_IN,ORDER_PARTNERS.
          ENDIF.
        endat.
      endloop.
      DESCRIBE TABLE it_success LINES gd_lines.
      IF gd_lines GT 0.
        Display result report column headings
        PERFORM display_column_headings.
        Display result report
        PERFORM DISPLAY_SUCESS.
      ENDIF.
    IF SUCESS FAILS Display Error Report
      DESCRIBE TABLE it_error LINES gd_lines.
      IF gd_lines GT 0.
        PERFORM errorheadings.
        PERFORM errorreport.
      ENDIF.
    *&      Form  display_column_headings
          text
    FORM display_column_headings.
      WRITE:2 ' Success Report '(014) COLOR COL_POSITIVE.
      SKIP.
      WRITE:2 'records inserted sucessfully:'(013).
      WRITE:/ sy-uline(15).
      FORMAT COLOR COL_HEADING.
      WRITE:/      sy-vline,
               (10) 'Sales order'(004), sy-vline.
      WRITE:/ sy-uline(15).
    ENDFORM.                    "display_column_headings
    *Subroutine to display SUCESS REPORT
    FORM DISPLAY_SUCESS.
      FORMAT COLOR COL_NORMAL.
      LOOP AT it_success.
        WRITE:/      sy-vline,
            (10)  it_success-SALESDOCUMENT, sy-vline.
        CLEAR it_success.
      ENDLOOP.
      WRITE:/ sy-uline(15).
      REFRESH: it_success.
      FORMAT COLOR COL_BACKGROUND.
    ENDFORM.                               "DISPLAY_REPORT
    *&      Form  errorreport
          text
    FORM errorreport.
      LOOP AT it_error.
        WRITE:/      sy-vline,
                (10) it_error-SRNO, sy-vline,
                 (40) it_error-err_msg, sy-vline.
      ENDLOOP.
      WRITE:/ sy-uline(104).
      REFRESH: it_error.
    endform.                    "errorreport
    *&      Form  ERRORHEADINGS
          text
    FORM ERRORHEADINGS.
      SKIP.
      WRITE:2 ' Error Report '(007) COLOR COL_NEGATIVE.
      SKIP.
    WRITE:2 'The following records failed during
    *update:'(008).
      WRITE:/ sy-uline(104).
      FORMAT COLOR COL_HEADING.
      WRITE:/      sy-vline,
              (10) 'ERROR.'(009), sy-vline.
      WRITE:/ sy-uline(104).
      FORMAT COLOR COL_NORMAL.
    ENDFORM.                    "ERRORHEADINGS
    **&      Form  value_help
          text
    -->  p1        text
    <--  p2        text
    FORM value_help .
      CALL FUNCTION 'DSVAS_DOC_WS_FILENAME_GET_50'
        EXPORTING
          DEF_FILENAME     = ' '
          DEF_PATH         = ' '
          MASK             = ',.,..'
          MODE             = 'O'
          TITLE            = ' '
        IMPORTING
          FILENAME         = p_infile
        EXCEPTIONS
          INV_WINSYS       = 1
          NO_BATCH         = 2
          SELECTION_CANCEL = 3
          SELECTION_ERROR  = 4
          OTHERS           = 5.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.
    test data
    1     TA     PB01     01     00     0004     45     10     852     B001     10     AG     8101000000

    Hello,
    You need to call BAPI_TRANSACTION_COMMIT instead of the commit after each BAPI call to commit the data to the database.
    Usually you also have to fill in the _INX structures for header item and schedule line to indicate what fields are to be changed.
    Hope that helps,
    Michael

  • Sales order for noraml and VC materials with BAPI_SLSTRANSACT_CREATEMULTI

    Hi all,
    I created a sales order in CRM with Zfuction module in which I used the bapi BAPI_SLSTRANSACT_CREATEMULTI for a configurable material. I dint hard coded any thing and passed the product data and partner data using import paramters.
    Now I am using this function module to create a sales order with normal item and it does not work and throws a runtime error.
    My actual requirement is to create a Zfunction module that creates a sales order in CRM for both noramal material and VC material.
    What modification should I do?
    Edited by: jessica sam on Jan 19, 2009 2:09 PM

    You are almost there..
    Here are some tips about what data needs to be filled and where. Check this out. Use the report program (not function module) CRM_ORDER_READ. Use a transaction that has all the required information you are interested in. In your case - The requested delivery date.
    The program displays the transaction data in a nice way - browseable data sets - run and see to know what I am talking about.
    Look for the RDD, where it is found.... Use that as a tip to popluate your sturctures in your function module... Use this tip for any data in the transaction.

  • Error while creating sales order for a new company code

    Hello SD Gurus,
    The client wanted us to create a new Company Code, Plant, and Sales Organization. We created them. I extended the customer and material in QAS. Now, I'm trying to create one sales order in QAS but the system is throwing one error: "Maintain Profit Center Value in Custom Table in YSD_PROFIT_CNTR".
    I googled for this error but found nothing. Could you please give me the solution asap. I need to prepare test script.
    Thanks in advance
    Regards,
    Anwar

    Dear Mohammed,
    The error message itself states where is the issue. You need to maintain the profit center in table
    YSD_PROFIT_CNTR. This is not SAP Standard provided solution. I guess during the time of implementation team has suggested to maintain the profit center in custom table.
    If the table is"maintenance view" then you can check through SM30 and maintain the relevant entry. If not check if there is any transaction code with attached to this table. This you can check by going through SE93 and by entering Z* or ZSD* or Y* or YSD* and press F4, If the transaction code is starting with Z or Y it will open all the list of transaction codes. By going through the description of the transaction code. you can pick the right transaction code in case if any exists for this table.
    Hope this information is useful to you.
    Regards
    Murali

  • BAPI to create sales order with reference to another sales order

    hi all,
    is there a bapi that allows you to create a sales order with reference to another sales order?
    thanks,
    V

    Hi Valencia,
    I think the normal BAPI (BAPI_SALESORDER_CREATEFROMDAT1)will do. You will have to fill the fields REF_DOC, REF_DOC_IT, REF_DOC_CA of the table ORDER_ITEMS_IN (and make sure that Customizing settings allow you to copy from order to order).
    Regards,
    John.

  • Create Sales Order with ES and LORD throws "not an input field"

    Hello,
    Im am getting the error:: "Field AUART is not an input field"
    I am trying to use the enterprise service: PurchaseOrderRequest_In for creating a Sales Order in ERP. I have done the settings under:
    - (IMG: Sales and Distribution -> Electronic Data Interchange -> EDI Messages -> Configure EDI Partners -> Convert External To Internal Partner Numbers )
    - (IMG: Sales and Distribution -> Electronic Data Interchange -> EDI Messages -> Configure EDI Partners -> Assign Customer/Vendor To Sales Organization Data )
    - Customizing transaction WUFWUF -> Transformations , application CL_PUR_PURCHASEORDER_RQ
    - SD_01 business function is activated
    Now when I send in a message I can monitor the errors in /SAPPO/PPO2 I get a list of errors telling me:
    "Field AUART is not an input field" and the same error for 5 other fields. If I debug the method I can see that the table LORD_MAPPING is read. It also looks like the service actually calls program SAPMV45A with screen 4440. This screen does not contain the fields with error. The errors are caught in
    class: CL_LORD_OBJECT
    Method: DO_IMPORT_MAPPING
    Line: 58-72
    , due to <field_inpmod> eq '0'. This is the input mode for the screen used.
    Any pointers to what I have missed would be greatly appreciated.
    Best regards,
    Emil Jessen

    check function group XVED. Within this function group there are some includes that allows you to change the behavior of SAP while creating the sales order after EDI inbound.
    There are the two includes ZXVEDU03 (to add additional data from the IDOC to the sales order) and ZXVEDU04 (to modify the batch input for creating the sales order). Maybe you can find your fields in here and clear them, so that SAP doesnt try to change the order-type field in EDI processing.
    In case you want to allow certain fields to be editable, check userexit MV45AFZZ form "userexit_field_modification". There you can set fields editable or not.
    Example:
    CASE screen-name.
        WHEN 'VBAP-MVGR3'.
          IF sy-tcode = 'VA01'.
            screen-input = 0. " 0 = field NOT editable, 1 = field editable
          ENDIF.
    ENDCASE.
    Regards
    Ralf

Maybe you are looking for

  • Print Statements in AR

    Hello, When we go to Receivables->Print Documents->Statements, it submitting the standard report, I want to replace it with my custom report. How can I do this, Can we have any option on the application to attach our custom program to statements? or

  • License in Failover/Backup Portal - Ep6 SP2

    Hello, We run EP6 SP2 and we copy the database and portal server file system to different hardware as a diaster recovery method.  We we bring up the portal on this new server it loads fine, but it says that it is not licensed since the Hardware key i

  • Raid5 issue after upgrade

    TLDR = scared to death to answer 'yes' to the following from e2fsck: Superblock has an invalid journal (inode 8). Clear<y>? cancelled! After upgrading to linux 3.2.14-1 (along with others important packages like udev, mkinitcpio, etc) my raid5 array

  • Error in PSA load

    hi all experts , I am new in BI. When I am lodaing data from SRM to PSA through data source 0BBP_MS_0COSTCENTER_TEXT then I am getting this error. Error message from the source system Diagnosis An error occurred in the source system. System Response

  • SharePoint Workspaces 2010

    I repaired my Windows 8 Pro installation preserving all my data. I realized too late that all my applications, including SharePoint Workspaces 2010 were deleted. I reinstalled the applications. I had one year old account file for SP Workspaces but my