Mass sales order creation using BAPI

Dear All,
Can anyone help in  mass sales order creation using Bapi BAPI_SALESORDER_CREATEFROMDAT2.
For example if i want to create 3 sales order with three item per order . i am populating
HEADER = 3 Records
Item   = 9 records
schedule = 9 records
partner  = 1 record.
Then after populating the records I am calling Bapi BAPI_SALESORDER_CREATEFROMDAT2
to create order. It should have created three order but unfortunately it creates
only one sales order. I debugged and found that records are correct both in header,
item, scheudle and partners.
Could you please guide me what I am missing for creation of mass orders.
I appreciate your time and many thanks in advance.
cheers
chandra

Hi Chandra,
Do like this.
Loop at Header table into wa_header.
*-- Move BAPI Header data
Loop at item table into wa_item where condition.
*--  in this move all Item and Schedule line item  to the BAPI.
  At end of item .
Use the below function modules.
BAPI_SALESORDER_CREATEFROMDAT2
BAPI_TRANSACTION_COMMIT.
Endloop.
Endloop.
Regards,
Balavardhan.K

Similar Messages

  • Reena Prabhakar - Sales order creation Using BAPI

    Hi Reena,
    This is Dinesh,i also face problem in Sales order creation using BAPI if you can send me the code it would be great help to me.
    Regards,
    Dinesh

    Anyhow, here is the code that I am using currently which works perfectly well. Not sure if it will be of any help to you, since the values to the BAPI come from the Webdynpro application. I have values stored in my "Test data directory" which I use for testing from the backend.
    FUNCTION ztest.
    Call the BAPI to create Sales Order
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
        EXPORTING
          order_header_in     = l_order_header
        IMPORTING
          salesdocument       = l_salesdocument
        TABLES
          return              = it_return
          order_items_in      = it_order_items
          order_partners      = it_order_partners
          order_schedules_in  = it_order_schdl
          order_conditions_in = it_order_conditions
          order_text          = it_order_text.
      READ TABLE it_return WITH KEY type = 'E'.
      IF sy-subrc = 0.
    *-- error occured
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      ELSE.
    *-- no error
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ENDIF.
    ENDFUNCTION.

  • Need sales order creation using bapi in oops

    need code for sales order creation using bapi in oops

    hi rocky,
              could you pls give a bit explanation on what you are expecting.
    regards,
    Pavan

  • SALES order creation using BAPI's

    Hai to all,
    I want to create sales order using bapis .I am new to this topic could any body guide me how to create sales order  step by step process using bapis.
    Thanks in advance.
    Regards,
    Chaitanya

    ** プログラムID       : ZBAPI_SALESORDER_CREATE               *
    ** プログラム名称         : Upload Sales Order Creation                   *
    ** 処理概要           :                                       *
    ** 作成者           : Karthik.P                             *
    ** 作成日           : 2006/08/10                            *
    REPORT  ZBAPI_SALESORDER_CREATE LINE-SIZE 132 MESSAGE-ID ZMMBAPI .
           Internal table definition                                     *
    ****<<<<<Communication Fields: Sales and Distribution Document Header>>>>>>>>
    DATA: GT_ORDER_HEADER_IN LIKE BAPISDHD1,
    *******<<<Checkbox Fields for Sales and Distribution Document Header>>>>>>>>>
          GT_ORDER_HEADER_INX  LIKE    BAPISDHD1X,
    *****<<<<<Return Parameter>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
          GT_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,  " Return Messages
    *********<<<Communication Fields: Sales and Distribution Document Item<>>>>>
          GT_ORDER_ITEMS_IN LIKE BAPISDITM OCCURS 0 WITH HEADER LINE, " Item Data
    *********<<<Communication Fields: Sales and Distribution Document Item>>>>>>>
          GT_ORDER_ITEMS_INX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE, "Item Data Checkbox
    *********<<<Communication Fields: Sales and Distribution Document Item>>>>>>>
          GT_SALESDOCUMENT LIKE BAPIVBELN-VBELN , "Number of Generated Document
    *********<<<Communications Fields: SD Document Partner: WWW>>>>>>>>>>>>>>>>>>
          GT_ORDER_PARTNERS  LIKE BAPIPARNR OCCURS 0 WITH HEADER LINE, "Document Partner
    ********<<<<Communications Fields: SD Document Partner: WWW>>>>>>>>>>>>>>>>>>
          GT_ORDER_SCHEDULES_IN LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE, "Schedule Line Data
    ****<<<<<<<<Checkbox List for Maintaining Sales Document Schedule Line>>>>>>>>
          GT_ORDER_SCHEDULES_INX LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE, " Checkbox Schedule Line Data
    *******Communication Fields for Maintaining Conditions in the Order
          GT_ORDER_CONDITIONS_IN  LIKE BAPICOND OCCURS 0 WITH HEADER LINE,
    ******Communication Fields for Maintaining Conditions in the Order
          GT_ORDER_CONDITIONS_INX LIKE BAPICONDX OCCURS 0 WITH HEADER LINE.
           Data definition                                               *
    DATA:  BEGIN OF GT_FT_SALES OCCURS 0,
           DOC_TYPE(4)  ,        "Sales Document Type
           SALES_ORG(4) ,        "Sales Organization
           DISTR_CHAN(2)  ,      "Distribution Channel
           DIVISION(2)   ,       "DIVISION(2)
           SALES_DIST(6)  ,      "Sales district
           INCOTERMS1(3)  ,      "Incoterms (part 1)
           INCOTERMS2(28)  ,     "Incoterms (part 2)
           PMNTTRMS(4)  ,        "Terms of payment key
           PRICE_DATE(8) ,       "Date for pricing and exchange rate
           PURCH_NO_C(35)  ,     "Customer purchase order number
           PURCH_NO_S(35)  ,     "Ship-to Party's Purchase Order Number
           EXCHG_RATE(8)  ,      "Directly quoted exchange rate for pricing and statistics
           CURRENCY(5) ,         "SD document currency
           MATERIAL(18),         "MATERIAL
           TARGET_QTY(13)  ,     "Target quantity in sales units
           ITEM_CATEG(4)  ,      "Sales document item category
           MATL_GROUP(8)  ,      "Material Group
           PURCH_NO_C1(35),      "Customer purchase order number
           SALES_DIST1(6)  ,     "Sales district
           INCOTERMS11(3)  ,     "Incoterms (part 1)
           INCOTERMS21(28),     "Incoterms (part 2)
           PMNTTRMS1(4)  ,     "Terms of payment key
           EXCHG_RATE1(8) ,    "Directly quoted exchange rate for pricing and statistics
           PRICE_DATE1(8) ,    "Date for pricing and exchange rate
           TRG_QTY_NO(5)    , "Factor for converting sales units to base units (target qty)
           DIVISION1(2)     ,                                   "DIVISION1
           SALQTYNUM(5)     , "Numerator (factor) for conversion of sales quantity into SKU
           GROSS_WGHT(3)    , "Gross Weight of the Item
           NET_WEIGHT(15)    , "Net Weight of the Item
           UNTOF_WGHT(3)    ,"Weight Unit
           PARTN_ROLE(2)   ,"Partner function
           PARTN_NUMB(10)   ,"Customer Number 1
    ********<<<<Communications Fields: SD Document Partner: WWW>>>>>>>>>>>>>>>>>>
           ITM_NUMBER(6) ,"Item number of the SD document
           REQ_QTY(8)  , "Schedule line date
           DLV_DATE(8)  , "Schedule line date
           MS_DATE(8)  , "Material availability date
           LOAD_DATE(8) , "Loading time (local time with reference to a shipping point)
           GI_DATE(8), "Time of goods issue (local DATE, with reference to a plant)
           TP_DATE(8)  , "Transportation planning -time (local w/ref. to shipping pnt)
           ITM_NUMBER2(6) , "Condition item number
    END OF GT_FT_SALES,
           MSG(240) TYPE  C,  " Return Message
           E_REC(8) TYPE C,    " Error Records Counter
           REC_NO(8) TYPE C, " Records Number Indicator
           S_REC(8) TYPE C,   " Successful Records Counter
           T_REC(8) TYPE C.   " Total Records Counter
    selection block for EXCEL UPLOAD FILE>>>>>>>>>>>>>>>>>>>>>>>>
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
      PARAMETERS FILE TYPE  IBIPPARMS-PATH OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1.
    *<<<<AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .>>>>>>>>>>>>
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
        IMPORTING
          FILE_NAME     = FILE.
    **<<<<<<<<<<<<<<<<<START-OF-SELECTION.>>>>>>>>>>>>>>>>>>>>>>>>>>>
    START-OF-SELECTION.
      CALL FUNCTION 'WS_UPLOAD'                                 "#EC *
        EXPORTING
          FILENAME                = FILE
          FILETYPE                = 'DAT'
        TABLES
          DATA_TAB                = GT_FT_SALES
        EXCEPTIONS
          CONVERSION_ERROR        = 1
          FILE_OPEN_ERROR         = 2
          FILE_READ_ERROR         = 3
          INVALID_TYPE            = 4
          NO_BATCH                = 5
          UNKNOWN_ERROR           = 6
          INVALID_TABLE_WIDTH     = 7
          GUI_REFUSE_FILETRANSFER = 8
          CUSTOMER_ERROR          = 9
          NO_AUTHORITY            = 10
          OTHERS                  = 11.
      IF  SY-SUBRC <> 0  .
        MESSAGE E000.
      ENDIF.
      SKIP 3.
      FORMAT COLOR COL_HEADING INVERSE ON.
        WRITE 40 TEXT-001.
      FORMAT COLOR COL_HEADING INVERSE OFF.
      SKIP 1.
      FORMAT COLOR COL_NEGATIVE INVERSE ON.
        WRITE :/ TEXT-002, 13 SY-MANDT , 104 TEXT-003, 111 SY-UNAME,
                  / TEXT-004, 13 SY-DATUM , 104 TEXT-005, 111 SY-UZEIT.
      FORMAT COLOR COL_NEGATIVE INVERSE OFF.
      SKIP 3.
      LOOP AT GT_FT_SALES.
          PERFORM SLALE_UPLOAD_DATA.
      ENDLOOP.
      T_REC = E_REC + S_REC.
      SKIP 3.
      FORMAT COLOR COL_TOTAL INVERSE ON.
        WRITE: /38 TEXT-007, T_REC.
      FORMAT COLOR COL_TOTAL INVERSE OFF.
      FORMAT COLOR COL_NEGATIVE INVERSE ON.
        WRITE: /38 TEXT-008, E_REC.
      FORMAT COLOR COL_NEGATIVE INVERSE OFF.
      FORMAT COLOR COL_TOTAL INVERSE ON.
        WRITE: /38 TEXT-009, S_REC.
      FORMAT COLOR COL_TOTAL INVERSE OFF.
    *&      Form  SLALE_UPLOAD_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM SLALE_UPLOAD_DATA .
    *******<<<<<<<<<<Communication Fields: Sales and Distribution Document Header>>>>>>
        GT_ORDER_HEADER_IN-DOC_TYPE =    'TA'.
        GT_ORDER_HEADER_IN-SALES_ORG =  GT_FT_SALES-SALES_ORG . "'0001'
        GT_ORDER_HEADER_IN-DISTR_CHAN = GT_FT_SALES-DISTR_CHAN. "'01'
        GT_ORDER_HEADER_IN-DIVISION  =   GT_FT_SALES-DIVISION.  " '01'
        GT_ORDER_HEADER_IN-SALES_DIST = GT_FT_SALES-SALES_DIST ."'000001'
        GT_ORDER_HEADER_IN-INCOTERMS1 = GT_FT_SALES-INCOTERMS1.  "'CFR'
        GT_ORDER_HEADER_IN-INCOTERMS2 = GT_FT_SALES-INCOTERMS2 . "'HAMBURG'
        GT_ORDER_HEADER_IN-PMNTTRMS = GT_FT_SALES-PMNTTRMS .    "'0001'
        GT_ORDER_HEADER_IN-PRICE_DATE = GT_FT_SALES-PRICE_DATE ."'20060818'
        GT_ORDER_HEADER_IN-PURCH_NO_C =  '32'.
        GT_ORDER_HEADER_IN-PURCH_NO_S =   '32'.
        GT_ORDER_HEADER_IN-EXCHG_RATE =  GT_FT_SALES-EXCHG_RATE ."'1.00000'
        GT_ORDER_HEADER_IN-CURRENCY = GT_FT_SALES-CURRENCY . " 'EUR'
    ********<<<Checkbox Fields for Sales and Distribution Document Header>>>>>>>>>
        GT_ORDER_HEADER_INX-DOC_TYPE   = 'X'.
        GT_ORDER_HEADER_INX-SALES_ORG  = 'X'.
        GT_ORDER_HEADER_INX-DISTR_CHAN = 'X'.
        GT_ORDER_HEADER_INX-DIVISION   = 'X'.
        GT_ORDER_HEADER_INX-SALES_DIST = 'X'.
        GT_ORDER_HEADER_INX-INCOTERMS1 = 'X'.
        GT_ORDER_HEADER_INX-INCOTERMS2 = 'X'.
        GT_ORDER_HEADER_INX-PMNTTRMS =   'X'.
        GT_ORDER_HEADER_INX-PRICE_DATE = 'X'.
        GT_ORDER_HEADER_INX-PURCH_NO_C = 'X'.
        GT_ORDER_HEADER_INX-PURCH_NO_S = 'X'.
        GT_ORDER_HEADER_INX-EXCHG_RATE =  'X'.
        GT_ORDER_HEADER_INX-CURRENCY = 'X'.
    *****<<<<<<Communication Fields: Sales and Distribution Document Item>>>
        GT_ORDER_ITEMS_IN-ITM_NUMBER = '000010'.
        GT_ORDER_ITEMS_IN-MATERIAL  =  GT_FT_SALES-MATERIAL .
        GT_ORDER_ITEMS_IN-PO_ITM_NO = '32'.
        GT_ORDER_ITEMS_IN-CUST_MAT22 = 'AGNI-IV'.
        GT_ORDER_ITEMS_IN-BILL_DATE = '20060808'.
        GT_ORDER_ITEMS_IN-PLANT = '0001'.
    *GT_ORDER_ITEMS_IN-STORE_LOC = '0001'.
        GT_ORDER_ITEMS_IN-TARGET_QTY = GT_FT_SALES-TARGET_QTY . "'1000'
        GT_ORDER_ITEMS_IN-ITEM_CATEG = GT_FT_SALES-ITEM_CATEG . "'TAN'
        GT_ORDER_ITEMS_IN-MATL_GROUP = GT_FT_SALES-MATL_GROUP . "'01'
        GT_ORDER_ITEMS_IN-PURCH_NO_C = GT_FT_SALES-PURCH_NO_C . "'32'
        GT_ORDER_ITEMS_IN-SALES_DIST = GT_FT_SALES-SALES_DIST . "'000001'
        GT_ORDER_ITEMS_IN-INCOTERMS1 = GT_FT_SALES-INCOTERMS1 . "'CFR'
        GT_ORDER_ITEMS_IN-INCOTERMS2 = GT_FT_SALES-INCOTERMS2 . "'HAMBURG'
        GT_ORDER_ITEMS_IN-PMNTTRMS = GT_FT_SALES-PMNTTRMS  .    "'0001'.
        GT_ORDER_ITEMS_IN-EXCHG_RATE = GT_FT_SALES-EXCHG_RATE . "'1.00000'
        GT_ORDER_ITEMS_IN-PRICE_DATE = GT_FT_SALES-PRICE_DATE . "'20060808'
    *GT_ORDER_ITEMS_IN-SALES_UNIT = 'DZ'.
        GT_ORDER_ITEMS_IN-TRG_QTY_NO = GT_FT_SALES-TRG_QTY_NO . "'23'
        GT_ORDER_ITEMS_IN-DIVISION = GT_FT_SALES-DIVISION   .   "'01'
        GT_ORDER_ITEMS_IN-SALQTYNUM = GT_FT_SALES-SALQTYNUM .   "'32'
        GT_ORDER_ITEMS_IN-GROSS_WGHT = GT_FT_SALES-GROSS_WGHT.  " ' 25272000'
        GT_ORDER_ITEMS_IN-NET_WEIGHT = GT_FT_SALES-NET_WEIGHT.  "'24464000'
        GT_ORDER_ITEMS_IN-UNTOF_WGHT = GT_FT_SALES-UNTOF_WGHT . " 'KG'
    *GT_ORDER_ITEMS_IN-CURRENCY = 'EUR'.
        APPEND  GT_ORDER_ITEMS_IN.
    ****<<<<<<Communication Fields: Sales and Distribution Document Item>>>
        GT_ORDER_ITEMS_INX-ITM_NUMBER = '000010'.
        GT_ORDER_ITEMS_INX-MATERIAL = 'X'.
    *GT_ORDER_ITEMS_INX-PO_ITM_NO = 'X'.
        GT_ORDER_ITEMS_INX-CUST_MAT22 = 'X'.
        GT_ORDER_ITEMS_INX-BILL_DATE = 'X'.
        GT_ORDER_ITEMS_INX-PLANT = 'X'.
    *GT_ORDER_ITEMS_INX-STORE_LOC = 'X'.
        GT_ORDER_ITEMS_INX-TARGET_QTY = 'X'.
        GT_ORDER_ITEMS_INX-ITEM_CATEG = 'X'.
        GT_ORDER_ITEMS_INX-MATL_GROUP = 'X'.
        GT_ORDER_ITEMS_INX-PURCH_NO_C = 'X'.
        GT_ORDER_ITEMS_INX-SALES_DIST = 'X'.
        GT_ORDER_ITEMS_INX-INCOTERMS1 = 'X'.
        GT_ORDER_ITEMS_INX-INCOTERMS2 = 'X'.
        GT_ORDER_ITEMS_INX-PMNTTRMS = 'X'.
        GT_ORDER_ITEMS_INX-EXCHG_RATE = 'X'.
        GT_ORDER_ITEMS_INX-PRICE_DATE = 'X'.
    *GT_ORDER_ITEMS_INX-SALES_UNIT = 'X'.
        GT_ORDER_ITEMS_INX-TRG_QTY_NO = 'X'.
        GT_ORDER_ITEMS_INX-DIVISION = 'X'.
        GT_ORDER_ITEMS_INX-SALQTYNUM = 'X'.
        GT_ORDER_ITEMS_INX-GROSS_WGHT =  'X'.
        GT_ORDER_ITEMS_INX-NET_WEIGHT = 'X'.
        GT_ORDER_ITEMS_INX-UNTOF_WGHT = 'X'.
    *GT_ORDER_ITEMS_IN-CURRENCY = 'x'.
        APPEND  GT_ORDER_ITEMS_INX.
    *****<<<<<<Communications Fields: SD Document Partner: WWW
        GT_ORDER_PARTNERS-PARTN_ROLE =   'WE'.
        GT_ORDER_PARTNERS-PARTN_NUMB =  '0000000057'.
    ***GT_ORDER_PARTNERS-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER . " '000010'.
        APPEND  GT_ORDER_PARTNERS.
    *********<<<<Communications Fields: SD Document Partner: WWW>>>>>>>>>>>>>>>>>>
        GT_ORDER_SCHEDULES_IN-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER." '000010'
        GT_ORDER_SCHEDULES_IN-REQ_QTY = GT_FT_SALES-REQ_QTY .   "'234'
        GT_ORDER_SCHEDULES_IN-DLV_DATE = GT_FT_SALES-DLV_DATE  ."  '20060824'.
        GT_ORDER_SCHEDULES_IN-MS_DATE =  GT_FT_SALES-MS_DATE .  "'20060808'
        GT_ORDER_SCHEDULES_IN-LOAD_DATE = GT_FT_SALES-LOAD_DATE.  " '20060822'
        GT_ORDER_SCHEDULES_IN-GI_DATE = GT_FT_SALES-GI_DATE . " '20060823'
        GT_ORDER_SCHEDULES_IN-TP_DATE = GT_FT_SALES-TP_DATE .   "'20060821'
        APPEND  gt_ORDER_SCHEDULES_IN.
    *********<<<<Communications Fields: SD Document Partner: WWW FLAG>>>>>>>>>>>>>>>>>>
        GT_ORDER_SCHEDULES_INX-ITM_NUMBER = '000010'.
        GT_ORDER_SCHEDULES_INX-REQ_QTY = 'X'.
        GT_ORDER_SCHEDULES_INX-DLV_DATE = 'X'.
        GT_ORDER_SCHEDULES_INX-MS_DATE = 'X'.
        GT_ORDER_SCHEDULES_INX-LOAD_DATE = 'X'.
        GT_ORDER_SCHEDULES_INX-GI_DATE = 'X'.
        GT_ORDER_SCHEDULES_INX-DLV_DATE = 'X'.
        APPEND  gt_ORDER_SCHEDULES_INX.
    ********Communication Fields for Maintaining Conditions in the Order
        GT_ORDER_CONDITIONS_IN-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER ." '000010'
        APPEND GT_ORDER_CONDITIONS_IN.
    ***Communication Fields for Maintaining Conditions in the Order
        GT_ORDER_CONDITIONS_INX-ITM_NUMBER = '000010'.
        APPEND GT_ORDER_CONDITIONS_INX.
        CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
          EXPORTING
       SALESDOCUMENTIN               =
            ORDER_HEADER_IN               = GT_ORDER_HEADER_IN
            ORDER_HEADER_INX              = GT_ORDER_HEADER_INX
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
         IMPORTING
           SALESDOCUMENT                  = GT_SALESDOCUMENT
          TABLES
           RETURN                         = GT_RETURN
            ORDER_ITEMS_IN                = GT_ORDER_ITEMS_IN
            ORDER_ITEMS_INX               = GT_ORDER_ITEMS_INX
            ORDER_PARTNERS                = GT_ORDER_PARTNERS
           ORDER_SCHEDULES_IN            =  GT_ORDER_SCHEDULES_IN
           ORDER_SCHEDULES_INX           =  GT_ORDER_SCHEDULES_INX
           ORDER_CONDITIONS_IN           =  GT_ORDER_CONDITIONS_IN
           ORDER_CONDITIONS_INX          =  GT_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              =
        IF GT_RETURN-TYPE EQ 'E' .
          E_REC = E_REC + 1.
          READ TABLE GT_RETURN WITH KEY ID = 'V1'.
          FORMAT COLOR COL_NEGATIVE INVERSE ON.
          REC_NO = E_REC + S_REC.
              CONCATENATE TEXT-006 REC_NO ':'
              GT_RETURN-MESSAGE INTO MSG SEPARATED BY SPACE .
              CONDENSE MSG.
              WRITE: / MSG.
          FORMAT COLOR COL_NEGATIVE INVERSE OFF.
      ELSEIF GT_RETURN-TYPE EQ 'S'.
          S_REC = S_REC + 1.
          FORMAT COLOR COL_POSITIVE INVERSE ON.
              MSG = GT_RETURN-MESSAGE.
              CONDENSE MSG.
              WRITE: / MSG .
          FORMAT COLOR COL_POSITIVE INVERSE OFF.
         PERFORM COMMIT_MM.
    ENDIF.
          CLEAR:  GT_RETURN[], MSG.
    ENDFORM.                    " SLALE_UPLOAD_DATA
    *&      Form  COMMIT_MM
          text
    -->  p1        text
    <--  p2        text
    FORM COMMIT_MM .
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            WAIT   = 'X'
          IMPORTING
            RETURN = GT_RETURN.
      clear:      GT_ORDER_ITEMS_IN[],GT_ORDER_CONDITIONS_IN[].
    ENDFORM.                    " COMMIT_MM

  • Error in sales order creation using bapi

    Hi,
    Iam trying to create sales order by using BAPI_SALESORDER_CREATEFROMDAT1 and when iam trying to execute
    the function module by passing all th eparameters and iam getting the error as
    inspite of entering sold_to_party and ship_to_party details in table ORDER_PARTNERS
    "enter the sold_to_party or ship to party details"
    please help me out in this isue its an urgent.
    Thanks.
    sayed.

    Can you share the codes ?
    Thanks.
    Ashish

  • LSMW Sales Order creation using Bapi method

    Hi folks ,
    iam doing Lsmw bapimethod ,sales order creation .In the step start idoc processing iam getting error "Has Not been Accepted for Processing ",why iam not getting plz let me know points will be awarded for all answers .

    Hi,
              You need to set the IDOC settings in the initial LSMW screen. It will be there in menu path.
           Award points if helpful
    Regards,
    RamaKrishna C

  • How to update VBFA while sales order creation using BAPI

    Hi,
    I am trying to create sales orders for each schedule line items while inquiry creation.
    This I have done in the user exit in the VA11 program MV45AFF using BAPI "BAPI_SALESORDER_CREATEFROMDAT2".
    along with the Inquiry, Sales orders are also getting created. But I am facing 2 problems.
    1) BAPI is not returning the sales order number to the program but when checked from SE37 it is returning the sales order   
        number.
    2) It is not updating the VBFA (SD flow) table.
    Regards,
    Krishna.

    Hello,
    1) BAPI is not returning the sales order number to the program but when checked from SE37 it is returning the sales order
    number.
    - are you passing simulation parameter (TESTRUN) as 'X'
    2) It is not updating the VBFA (SD flow) table.
    - Please use BAPI_SALESDOCUMENT_COPY for copying and updating VBFA table
    Thanks
    Krish

  • Issue regarding Sales Order creation using bapi BAPI_salesorder_createfromd

    Hi Experts,
    Can anyone help me what is the data I'm missing in creating sales order?
    I tried to create sales order using BAPI_salesorder_createfromdat2 and I recieve error regarding my creation.
    here's the lists of RETURN for the BAPI.
    "SALES_HEADER_IN has been processed successfully"
    "SALES_ITEM_IN has been processed successfully"
    "SALES_CONDITIONS_IN has been processed successfully"
    "The sales document is not yet complete: Edit data"
    Iam not able to get the message ""The sales document is not yet complete: Edit data"
    Please help in this regard.
    Regards,
    Sakti

    This is because you are still missing some segments or data.
    Maybe this thread will be helpful:
    BAPI_SALESORDER_CREATEFROMDAT2 to replace VA01, KBETR and NETWR
    You should also check the documentation from transaction BAPI.

  • Sales order creation using BAPI is predefined function

    then what is the necessity of creating again?Can any one explain clearly the need of creation of sales order using BAPI

    Hi Gayathri G,
    We can create that bapi for updating or creating or cancelling the orders etc.
    we cannot update many records at a time in tcode.
    So we use this bapis or BDC programs to create a sales order or whateever it is.
    BAPI is nothing but RFC.
    regards,
    ravi shankar reddy

  • Populating Customized fields in Sales Order Creation using BAPI

    Hi All,
    I have a requirement that, I need to populate 2 customized fields which are appedned in the VBAK tables through Append structure. I am using BAPI_SALESORDER_CREATEFROMDAT2 FM for creating it.
    Could anybody tell me how to send these 2 coustomized field values in this BAPI using EXTERNIN parameter.
    Regards
    Rajesh
    [email protected]

    Hi,
    To add data to custom fields there are two appraoches.
    <b>1)</b>Using the <b>EXTENSIONIN</b> in the Tables option in the FM <b>BAPI_SALESORDER_CREATEFROMDAT2</b>
    Check the Documentation for the same,
    <b>Customer Enhancement for VBAK, VBAP, VBEP</b>
    <i>Description</i>
    You can use this parameter to transfer user-specific enhancments to a BAPI. The customer has to complete the EXTENSION structure and the system automatically continues processing it. If you have not defined any user-specific fields, then you can transfer a blank EXTENSIONIN structure.
    <b>Technical information about Customer Enhancements</b>
    The following description uses an example to explain how to proceed with customer enhancements to the SD tables VBAK, VBKD, VBAP and VBEP.
    The customer has added their own fields to table VBAP using the INCLUDE structure CUTEST. This structure contains 2 fields:
    CFIELD1, CHAR 10
    CFIELD2, CHAR 3.
    The customer also requires that these two fields can be maintained with the BAPI.
    1. Maintain structure CUTEST in table VBAP
    2. Because the BAPIs work with checkboxes, you must also define a CUTESTX checkbox for the customer structure. It should be structured like this:
    Field name       Data element
    CFIELD1            CHAR1
    CFIELD2          CHAR1
    3. Define these customer structures in the structures VBAPKOZ und VBAPKOZX using INCLUDE or APPEND.
    4. Add the customer structures to the BAPE_VBAP and BAPE_VBAPX BAPI structures using the APPEND technique.
    5. Adjust the following structures for customer enhancements to table VBAK:
    a) VBAKKOZ
    b) VBAKKOZX
    c) BAPE_VBAK
    d) BAPE_VBAKX
    6. Adjust the following structures for customer enhancements to table VBEK:
    a) VBEPKOZ
    b) VBEPKOZX
    c) BAPE_VBEP
    d) BAPE_VBEPX
    7. Generally, the data should be added to the BAPI interface in the internal communication structures (VBAKKOM, and so on). There, you can process the data in the SD tables (VBAK, and so on).
    8. If the EXTENSIONIN parameter contains customer data, you must complete at least the key fields in the relevant standard parameters.
    <i>For example:</i>
    You want to change customer field VBAP-CFIELD2 for item 20 to "XYZ" in order 4711.
    The following entries are expected:
    Import:     BAPIVBELN-VBELN       = '0000004711'  Document number
                BAPISDHD1X-UPDATEFLAG = 'U'           UPDKZ for doc header
    Tables:     BAPISDITM-ITM_NUMBER  = '000020'      Item number
                BAPISDITMX-ITM_NUMBER = '000020'      Item number
              + BAPISDITMX-UPDATEFLAG = 'U'           UPDKZ for item
    You must complete the EXTENSION table as follows:
    STRUCTURE                          VALUEPART1       1234561234567890123
    BAPE_VBAP                       0000004711000020                 XYZ
    BAPE_VBAPX                      0000004711000020       X
    <b>Further Information</b>
    You can find more information in the BAPI programming guide in the chapter for enhancements to BAPIs.
    Notes
    You must complete the STRUCTURE field with the name of the relevant enhancement structure (BAPE_VBAK, BAPE_VBAP, BAPE_VBEP). You can complete the remaining fields with the append structures from the enhancement structures.
    At the moment, you can use the BAPI to store enhancements in the following structures:
    VBAK : An enhancement to header data requires an append structure to BAPE_VBAK and an enhancement to structure VBAKKOZ.
    VBAP : An enhancement to item data requires an append structure to BAPE_VBAP and an enhancment to structure VBAPKOZ.
    VBEP : An enhancement to schedule line data requires an append structure to BAPE_VBEP and an enhancement to structure VBEPKOZ.
    VBKD : If you are using an enhancement for header data, you must add an append structure to BAPE_VBAK. You also need to enhance structure VBAKKOZ. If it is for item data, you need to add an append structure to BAPE_VBAP. You must also enhance structure VBAPKOZ.
    If you also want to work with checkboxes, each X-structure must also contain an append structure.
    For example:
    A customer has created an order and wants to include the material long text (50 digits long).
    The EXTENSIONIN structure must be completed with BAPE_VBAP. Two fields have fixed definitions in this structure. These are in the VBAP host key (VBELN, POSNR). The customer sets up an append structure that contains field ZMAT50.
    Because the VBELN is normally blank when you create an order, the data can look like this:
    STRUCTURE   |BAPE_VBAP
    <b>2)</b> Create the Sales Document using the FM and when successfully craeted you will get the Sales Document No in the Export parameter <b>SALESDOCUMENT</b>.
    After its created and Committed using <b>BAPI_TRANSACTION_COMMIT</b> , do a <b>BDC</b> recording for the same to (<b>VA02</b> Change Sales Order) update the fields only and save the document.
    Regards,
    AS

  • Sales Order Creation using bapi BAPI_SALESORDER_CREATEFROMDAT2

    Please help me..
    I am using BAPI_SALESORDER_CREATEFROMDAT2 for creating sales order
    can you please tell me in which field the quantity(of items) is to be populated.
    i am populating in BAPISDITM-TARGET_QTY but i am not getting quantity field after sales order is created.
    i also tried with BAPISDITM-TRG_QTY_NO but i am not getting .
    and also if i provide ship to number it is automatically taking the adress but if i want to give my own adress in which structure i have to populate

    Please help me..
    I am using BAPI_SALESORDER_CREATEFROMDAT2 for creating sales order for replace VA01, 
    can you please tell me in which field the amount KBETR (of items) is to be populated.
    i thing that i will populate COND_VALUE in ORDER_CONDITIONS_IN with field kbetr but I don't know what will I populate field COND_TYPE ? the same problem I have with net value (NETWR).
    Would you explain me what I will populate fields  in differents fields of this BAPI ?

  • Credit check for sales order creation using BAPI

    HI,
    I am using BAPI_SALESORDER_CREATEFROMDAT2 for creating sales order.
    I want the credit check for a customers credit limit done while creating the sales order. Is it possible to make
    credit check with above bapi? If it is possible please give me the solution.
    <b>Helpful answers will be rewarded</b>

    hi,
    it's the same code that is executed for the credit check in the bapi as in va01
    If you put in the correct data, see sap note 366265, the credit check will be executed
    kind regards
    Paul Q

  • Sales order creation using BAPI using IDoc

    Hi all,
    I am getting an IDoc from PI server. I need to process that IDoc in SAP for which I have created a function module.
    I need to read that IDoc in the FM.
    Please give me sample code / procedure of coding step by step to validate the data from Idoc structure and creating sales order from the IDoc data.
    Also tell me which BAPI / FM should I use to create sales order.
    Thanks,
    ~Sachin

    Hi Sachin
    Extended order type ORDERS05 to ZFRORDERS05 with additional fields is goodu2026
    But you can write user exits to populate the additional field to sale order fieldsu2026.
    And FM IDOC_INPUT_ORDERS will post the data and create the SALES ORDERu2026
    This is standard function every industry will followu2026. And this is recommended.
    If you want to create custom FM then call (BAPI_SALESORDER_CREATEFROMDAT2 Sales order: Create Sales Order) in you custom FM.
    Thanks
    Ramesh

  • Sales order creation using bapi

    kindly help me.
    I have created a program which uses a bapi
    BAPI_SALESDOCU_CREATEFROMDATA. I fill the required data  in a  text file and the sales order gets created. but when I go to va03 transaction to check the data the payment terms column shows a different data than the one that I have entered .
    what could be the issue.
    could it be an user exit doing this.
    if so please let me know which user exit is responsibel for this.
    Regards

    hi,
    it might be configuration dependant or as you said it is based on user-exit.
    if it is user-exit then you should look in to <b>MV45AFZZ</b> incldue . then check inside in any of the forms are they doing any thing related to payment terms.
    there are so many user-exits avaliable in that include.
    regards
    vijay

  • Sales order creation using BAPI in LSMW

    Hi ABAPers,
    I am trying to create Sales orders using the BAPI SALESORDER_CREATEFROMDAT2.
    I am supplying the item target quantity in sale units to the field
    E1BPSDITM-- TARGET_QTY. my documents are getting posted but when i go to VA03 to display my documents, the quantity is showing up as 0 for all items. and the document is incomplete.
    please any suggestions on this.
    Regards,
    Raj

    HI Raj M 
    jus refer the following link it has step by step procedure
    http://sapbrain.com/TUTORIALS/TECHNICAL/LSMW_tutorial.html

Maybe you are looking for

  • How to get the values from profileFormHandler

    Hi, here i have problem with how to get the values after setting the values to that , how i have to call repository, what repository i've to call?

  • NW 6.5 SP8 Abend

    I have this server running for almost 3 years. Never a problem. It's a Proliant ML370 G5. Now I had the following abend twice in a week: Wednesday, 3-27-2013 7:37 pm File reset by user: admin Novell Open Enterprise Server, NetWare 6.5 PVER: 6.50.08 S

  • Problem in French translation while writing a file on application server

    I am writing some text symbols to a file on application server using Transfer statement. But for some french characters the data is not transleted correctly. I have maintained the french translation for these text symbols.

  • Pen drive issue of mac and windows????

    I've a SonyClick 8GB pendrive and i formatted the pendrive in my MacBook using FAT partition but when i connect it to the Windows 7 PC, it is not able to open the partition it directly says to format it.... And on Windows 7's disk management it shows

  • Name of bar below status bar and above the dock icons

    What is the name of the grey bar at the bottom of Firefox, version 33 . It sits at bottom of Firefox screen. It is usually empty, nothing on it.. I can also x it out to delete it. It sits just above the dock icons on my Mac desktop.