BAPI does not create Sales order

Hi All,
I am using BAPI_SALESORDER_CREATEFROMDAT2 to create sales order.
It is working fine till now.
But I found that whenever there is a material whose condition price is maintained and doesnot match with the valuation type, the Sales order does not get created, neither it gives any error msg.
For e.g For Valuation type Consign , condition type ZPCS is valid and similarly for Turnkey , condition type ZPTK is valid.
if a material has valuation type consign and condition type ZPTK.. The SAP system ofcourse will not allow to create a SO unless we delete the ZPTK entry from the SO and create ZPCS...
BAPI also doesnot create the SO but doesnot return the error messge too.
I try to put the ZPCS value to BAPI thru BAPICOND..but still not working?
How do i handle such case?
Points will be awarded to useful ans

Hi,
If you are saying that you cannot create a sales order with the Valuation type and Condition type mismatch even through VA01 manually, then there is nothing much you can do in BAPI also.
2nd Case is you say that that BAPI RETURN table is not getting populated and it is empty in this issue which is not letting you know that Sales order is not Created.
The one work around for this issue is you can check the exporting parameter SALESDOCUMENT if it has the Sales Order number or not. if the RETURN table is empty and the SALESDOCUMENT field has SO Number, then SO is created and if RETURN table is Initial and SALESDOCUMENT is also Initial, then it is the issue that you are facing.
Also try posting a Query in OSS.
regards,
Mahesh

Similar Messages

  • VA01 BDC does not return sales order number

    Hi All,
    I am using BDC to create sales orders using transaction VA01. Most of the time I have no problems using this method. However, for some orders no order number is returned.
    I know that BDC is not the best way of doing things, but we have customized the sales order screens a lot and therefore can't use BAPI, so we need to use BDC.
    I have used display mode 'A' when calling the transaction and I know that all the screens populate correctly. Then when the order saves, no order number is provided. The just created order can't be found by searching using the sold-to party, so the order appears to not have created. However, when I look in the table of messages returned from the transaction, there are no errors.
    <b><REMOVED BY MODERATOR></b>
    Thanks in advance,
    Dan
    Message was edited by:
            Alvaro Tejada Galindo

    Why don't use update mode called 'S'.
    call transaction 'VA01' using BDCDATA
                           MODE 'N'
                           update 'S' -> use this one.
                           messages into bdcmsgcoll.
    Thanks
    Seshu

  • A bapi problem of create sales order

    hello,experts,
    when I want to try the function of bapi 'BAPI_SALESORDER_CREATEFROMDAT1', the return message is the following,
    'Material 4070111 is not defined for sales org.4050,  distr.chan.01,  language ZH',actually,the sales org.4050 is defined for the material.
    pls help me out.appreciated.
    the content of the program:
    REPORT  ZWY_SALESORDER01.
    --Data Declaration--
    Data: st_BAPISDHEAD like BAPISDHEAD, " Sales Order Header Data
    ta_BAPIITEMIN like BAPIITEMIN occurs 0 with header line, " Ln item
    ta_BAPIPARTNR like BAPIPARTNR occurs 0 with header line, " Partner
    d_BAPIRETURN1 like BAPIRETURN1, " Bapi return msg
    d_vbeln like bapivbeln-VBELN. " Sales Order Number
    *Please note in the following program, sold to party (SP) has been
    *entered as 'AG' and ship to party (SH) as 'RG'.
    *SP----
    AG
    *SH----
    RG
    *Order type 'OR' as 'TA'
    *Please use TA instead of OR
    *Also if you set the * CONVERT_PARVW_AUART = 'X' parameter to 'X' you
    *can use sold to party as SP and ship to party as SH.
    Move the data to create sales order in the repective parameters------*
    move: '4OR' to st_BAPISDHEAD-DOC_TYPE, " Sales document type
    '15493' to st_BAPISDHEAD-PURCH_NO_C,
    '4050' to st_BAPISDHEAD-SALES_ORG,
    '01' to st_BAPISDHEAD-DISTR_CHAN,
    '00' to  st_BAPISDHEAD-DIVISION,
    '00010' to ta_BAPIITEMIN-ITM_NUMBER,
    '4070111' to ta_BAPIITEMIN-MATERIAL,
    '4000' to ta_BAPIITEMIN-PLANT,
    '1' to ta_BAPIITEMIN-REQ_QTY,
    'AG' to ta_BAPIPARTNR-PARTN_ROLE, " Sold to Party
    '0000006648' to ta_BAPIPARTNR-PARTN_NUMB.
    Append the internal tables-------------------------------------------*
    append ta_BAPIPARTNR.
    clear ta_BAPIPARTNR.
    append ta_BAPIITEMIN.
    clear ta_BAPIITEMIN.
    Move ship to party---------------------------------------------------*
    move: 'RG' to ta_BAPIPARTNR-PARTN_ROLE, " Ship to party
    '0000006648' to ta_BAPIPARTNR-PARTN_NUMB.
    Append the internal tables-------------------------------------------*
    append ta_BAPIPARTNR.
    clear ta_BAPIPARTNR.
    break-point.
    Call the Bapi to create the sales order
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
    EXPORTING
    ORDER_HEADER_IN = st_BAPISDHEAD
    WITHOUT_COMMIT = ' '
    CONVERT_PARVW_AUART = ' '
    IMPORTING
    SALESDOCUMENT = d_vbeln
    SOLD_TO_PARTY =
    SHIP_TO_PARTY =
    BILLING_PARTY =
    RETURN = d_BAPIRETURN1
    TABLES
    ORDER_ITEMS_IN = ta_BAPIITEMIN
    ORDER_PARTNERS = ta_BAPIPARTNR
    ORDER_ITEMS_OUT =
    ORDER_CFGS_REF =
    ORDER_CFGS_INST =
    ORDER_CFGS_PART_OF =
    ORDER_CFGS_VALUE =
    ORDER_CCARD =
    ORDER_CFGS_BLOB =
    ORDER_SCHEDULE_EX =
    break-point.
    if d_vbeln <> space.
    write: 'Sales order No. ', d_vbeln.
    endif.

    clear iohead.
      ihead-doc_type   = 'ordertype'.
      ihead-sales_org  = 'sales organisation'.
      ihead-distr_chan = 'distribution ch'.
      ihead-division   = 'division'.
      ihead-req_date_h = sy-datum.
      ihead-ship_cond  = 'shipping codition'.
      ihead-incoterms1 = 'incoterms'.
      ihead-pmnttrms   = 'payment terms'.
      ihead-purch_no_c = 'Purchase document'.
      ihead-purch_date = 'purchase doc date.
      ihead-accnt_asgn = 'account assignment'.
      ihead-pymt_meth = 'payment method'.
      clear ipartner.   refresh ipartner.
      ipartner-partn_role = 'AG'.
      ipartner-partn_numb = 'sold to party'.
      append ipartner.
      clear ipartner.
      ipartner-partn_role = 'WE'.
      ipartner-partn_numb = 'ship to party'.
      append ipartner.
      refresh : iitem, ibapischdl, ibapicond.
      clear   : iitem, ibapischdl, ibapicond.
      item-itm_number = '10'.
      item-material   = 'material'.
      item-plant      = 'plant'.
      item-val_type   = 'BLFG'.
      append item.
      ibapischdl-itm_number = '10'.
      ibapischdl-req_date   = sy-datum.
      ibapischdl-req_qty    = 'quantity'.
      append ibapischdl.
      call function 'BAPI_SALESORDER_CREATEFROMDAT2'
           exporting
              SALESDOCUMENT           =
                order_header_in         = ihead
              ORDER_HEADER_INX        =
              SENDER                  =
              BINARY_RELATIONSHIPTYPE =
              INT_NUMBER_ASSIGNMENT   =
              BEHAVE_WHEN_ERROR       =
              LOGIC_SWITCH            =
              TESTRUN                 =
              CONVERT_PARVW_AUART     = ' '
          importing
               salesdocument_ex        = wvbeln
           tables
               return                  = ibapiret2
               order_items_in          = item
              ORDER_ITEMS_INX         = IBAPISDITMX
               order_partners          = ipartner
               order_schedules_in      = ibapischdl
              ORDER_SCHEDULES_INX     =  ibapischdl
              order_conditions_in     = ibapicond
              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 wvbeln ne space.
        call function 'BAPI_TRANSACTION_COMMIT'
             exporting
                  wait = wwait.
           IMPORTING
                RETURN  =
    sales document will be available in bapi return .
    saravanan

  • Not create Sales order

    hi
    when im create sales order va01.than i have complete sales order i m click on incomplete log some missing item.two item missing this msg display.
    1) profitabolity segement number  this filed is is requer
    2) wbs element this filed also active how to inactive this filed this filed is there account assignment  main field display. please help mee....

    Hi,
    This is due to incompletion procedure for the sales document type. You can remove these from the incompletion procedure for the sales document type in SPRO. Steps as below:
    SPRO->Sales & Distribution->Basic Functions->Log og Incomplete Items->Define Incompleteness procedure.
    Here, for change the prcedure for Sales -Item
    Please close the message, if found useful.
    Muraleedharan.R

  • Delivery date does not match sales orders  proposed delivery date

    when i create sales order the requested delivery date by default is todays date and if nobody changes it, it will stay the same even after i save the order but the acutal delivery date is diffrent in the sales document or delivery document
    can anyone please throw some light on it
    Thanks in advance

    Hi Raj,
    Req D Date is the date on which teh custoemr wants the goods to be delivered. But it wont be possible always. So there will be an availability check on the stock of that material and based on the availability and transportation lead times, the possible delivery date will be determined and populated at the schedule line level of the document.
    Hope this clarifies your doubt.
    Reward if this helps.

  • XVBAP has the new line item but does not update Sales Order

    Hi
    I need to update the sales order with a new line item when the line item has a base unit of measure as the sales unit. I need to then convert the base unit to sales unit with a whole figure and the rest can be in the base unit.
    I am able to see the update in the xvbap but the line item doesn't get updated.
    I am puting this code in a perform within
    MV45AFZB  within   Form  USEREXIT_CHECK_VBAP
    But I guess I am doing something wrong can someone please take a look at it and tell me what is wrong with the coding.
    *&  Include       ZSD_CREATE_NEW_LINE_ITEM              *
    *&      Form  create_new_line_item
          text
    -->  p1        text
    <--  p2        text
    FORM CREATE_NEW_LINE_ITEM .
      CONSTANTS: C_MEINH LIKE MARM-MEINH VALUE 'CSE'.
    Variables Used
      DATA: WS_WMENG LIKE VBEP-WMENG.
      DATA: INPUT  LIKE VBAP-KWMENG,
            WS_EA  LIKE VBAP-KWMENG,
            WS_CSE LIKE VBAP-KWMENG.
      DATA: WS_MVKE_VRKME LIKE MVKE-VRKME.
    Internal Tables and Structures
      DATA: WS_XVBAP LIKE XVBAP.
    DATA:
    it_vbap  LIKE vbap OCCURS 0 WITH HEADER LINE,
    it_vbep  LIKE vbep OCCURS 0 WITH HEADER LINE,
    it_xvbap LIKE vbapvb OCCURS 0 WITH HEADER LINE.
      DATA: BEGIN OF WS_MARM,
              MEINH LIKE MARM-MEINH,
              UMREZ LIKE MARM-UMREZ,
              UMREN LIKE MARM-UMREN,
            END OF WS_MARM.
      CLEAR WS_MVKE_VRKME.
      SELECT SINGLE VRKME INTO WS_MVKE_VRKME
        FROM MVKE
        WHERE MATNR EQ XVBAP-MATNR
        AND   VKORG EQ XVBAK-VKORG
        AND   VTWEG EQ XVBAK-VTWEG.
      IF VBAP-VRKME <> WS_MVKE_VRKME.
       LOOP AT XVBAP.
          SELECT SINGLE MEINH UMREZ UMREN
            FROM MARM
            INTO WS_MARM
            WHERE MATNR = VBAP-MATNR
            AND   MEINH = WS_MVKE_VRKME.
          IF XVBAP-MEINS <> WS_MVKE_VRKME.
            IF NOT XVBAP-KWMENG = 0.
              WS_WMENG = XVBAP-KWMENG / WS_MARM-UMREZ.
              IF WS_WMENG > 1.
    This means that the line item needs to be split into CSE & EA
                  INPUT  = XVBAP-KWMENG.
                  WS_EA  = INPUT / WS_MARM-UMREZ.
                  WS_CSE = WS_EA.
                  WS_EA  = WS_CSE * WS_MARM-UMREZ.
                  WS_EA  = INPUT - WS_EA.
    Now we have the qty. split into EA & CSE. Now to
    assign it to xvbap
                  XVBAP-KWMENG = WS_EA.
                  XVBAP-VRKME  = WS_MVKE_VRKME.
              READ TABLE XVBAP WITH KEY POSNR = XVBAP-POSNR.
                MODIFY XVBAP INDEX SY-TABIX.
                  WS_XVBAP = XVBAP.
                  WS_XVBAP-KWMENG = WS_CSE.
                MOVE-CORRESPONDING WS_XVBAP TO XVBAP.
                INSERT XVBAP INDEX SY-TABIX.
              ENDIF.
            ENDIF.
          ENDIF.
      ENDIF.     " IF xvbap-vrkme 'EA'.
    ENDFORM.    " create_new_line_item

    Hi Clark,
    Pls check the Include MV45AFZZ instead of the one which you are using . Here in this include MV45AFZZ you can have access to the Header and Line items data .
    Here in this include
          FORM USEREXIT_SAVE_DOCUMENT                                   *
          This userexit can be used to save data in additional tables   *
          when a document is saved.                                     *
          If field T180-TRTYP contents 'H', the document will be        *
          created, else it will be changed.                             *
          This form is called at from form BELEG_SICHERN, before COMMIT *
    form userexit_save_document.
    Endform.
    Either you can write the code you want to update the XVABP table here or you can use the form .
          FORM USEREXIT_MOVE_FIELD_TO_VBAP                              *
          This userexit can be used to move some fields into the sales  *
          dokument item workaerea VBAP                                  *
          SVBAP-TABIX = 0:  Create item                                 *
          SVBAP-TABIX > 0:  Change item                                 *
          This form is called at the end of form VBAP_FUELLEN.          *
    form userexit_move_field_to_vbap.
    endform.
    This are the 2 performs in this include where you can do you code and it will defnitely solve your problem.
    Good Luck to you . Let me know if your problem get solved.
    Thanks & Regards,
    Naidu.

  • Hi ,BAPI Needed to create sales order

    Hi,
    i want to create  a salesorder by giving quotation number as an input.
    whenever sales quotation is saved it should check for some conditions and finally it should automatically create the sales order of type ZMS without user intervention.
    Please can any one help in finding the BAPI .Please explain me how to implement same...
    regards
    manju

    Check the Program -
    REPORT ZCREATE_SO.
    DATA : ORDER_HEADER_IN1 TYPE BAPISDHD1.
    DATA: ORDER_PARTNERS1 TYPE BAPIPARNR OCCURS 0 WITH HEADER LINE.
    DATA: ORDER_ITEMS_IN1 TYPE BAPISDITM OCCURS 0 WITH HEADER LINE.
    DATA : SALESDOCUMENT1 TYPE BAPIVBELN-VBELN.
    DATA : RETURN1 TYPE BAPIRET2 OCCURS 0.
    DATA : RETURN2 TYPE BAPIRET2.
    DATA: WA_RETURN1 TYPE BAPIRET2.
    start-of-selection.
    Fill the Header Details
    order_header_IN1-DOC_TYPE = 'TA'.
    order_header_IN1-SALES_ORG = '1001'.
    order_header_IN1-DISTR_CHAN = '10'.
    order_header_IN1-division = '10'.
    Fill the Partner Details
    ORDER_PARTNERS1-PARTN_ROLE = 'WE'.
    ORDER_PARTNERS1-PARTN_NUMB = '0000000008'.
    append ORDER_PARTNERS1.
    Fill the Item details
    ORDER_ITEMS_IN1-MATERIAL = 'A0900002'.
    ORDER_ITEMS_IN1-TARGET_QTY = '10'.
    append ORDER_ITEMS_IN1.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTING
    SALESDOCUMENTIN =
    ORDER_HEADER_IN = order_header_IN1
    ORDER_HEADER_INX =
    SENDER =
    BINARY_RELATIONSHIPTYPE =
    INT_NUMBER_ASSIGNMENT =
    BEHAVE_WHEN_ERROR =
    LOGIC_SWITCH =
    TESTRUN =
    CONVERT = ' '
    IMPORTING
    SALESDOCUMENT =
    TABLES
    RETURN = RETURN1
    ORDER_ITEMS_IN = ORDER_ITEMS_IN1
    ORDER_ITEMS_INX =
    ORDER_PARTNERS = ORDER_PARTNERS1
    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 =
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT = space
    IMPORTING
    RETURN = return2
    loop at return1 into wa_return1.
    endloop.
    Also go through the Documentation in SE37 it is very helpful.

  • BAPI BAPI_BUSPROCESSND_CREATEMULTI to create sales orders in SAP

    Hi
    How can i use this BAPI  "BAPI_BUSPROCESSND_CREATEMULTI." to create mulitple sales orders in CRM from external system. Can you throw some lignt on what will be import parameters ?
    Thanks,
    Vaishnavi

    HI,
    There is a similar requirement in the following thread just check for reference.
    Trying to create a sales order in CRM with BAPI_BUSPROCESSND_CREATEMULTI.
    Regards and Best wishes.

  • IPC requirement does not effect sales order

    Hi,
    I wrote a pricing requirement  in java extending RequirementAdapter.
    I uploaded it to the CRM system. When the requirement  is called, it writes messages to the VMC log and i can see the result of the requirement  : "true" or "false" .
    The problem is that the result of the requirement  does not effect the condition in the sales order - nothing happens no matter what the result value is.
    What should I do in order to get an error message in the sales order when the requirement returns false?
    Thanks
    Tomer

    Hi Michael,
    If the requirement will not trigger any error message by default according to the returned value, what excaly do I need to do in order to achieve that? Is there a BADI or user exist  where I can check the returned value and raise the message?
    Thanks,
    Tomer

  • Not able to create sales order  using BAPI - BAPI_SALESORDER_CREATEFROMDAT2

    Hi Experts,
    I am not able to create sales order . I am using BAPI - BAPI_SALESORDER_CREATEFROMDAT2
    to create sales order .I am passing external sales order number to the parameter
    SALESDOCUMENTIN.
    I am getting following error.
    "524   |Only quantity 1 EA is allowed (Item 00001"
    Here EA is UOM(Unit of measurement).
    Below is the sample program through which i am trying to create the sales order.
    *& Report  ZSDC_SALES_TEST
    report  zsdc_sales_test.
    *DATA: wa_bapi_header    TYPE bapisdhd1.
    Include Name    - ZSDC_SALES_ORD_UPLOAD_TOP
    Program Name    - ZSDC_SALES_ORD_UPLOAD_1393
    Program Title   - Include for Data Declaration  and selection screen
    Created by      - Lalitha W
    Created on      - 18-Nov-2008
    Object ID       - SD_C_1393_SALES_ORDER_UPLOAD
    Request Id      - SD3K905579
    Description - This is a common INCLUDE for data declarations and
    *selection screen details.
                            HISTORY
    Date    |Developer |Req by    | Description              |Reference ID
            |          |          |                          |
            |          |          |                          |
                               TYPE-POOLS
    *TYPE-POOLS: truxs, abap, slis.
                              TABLES
    *TABLES: t100.
                               TYPES
    types:begin of   ty_header,
            auart(4)    type c,    " Sales Order Type
            vkorg(4)    type c,    " Sales Organization
            vtweg(2)    type c,    " Distrubution Channel
            spart(2)    type c,    " Division
            kunnr_1(10) type c,    " Sold to Party
            kunnr_2(10) type c,    " Ship to Party
            augru(3)    type c,    " Order Reason
            bstkd(35)   type c,    " PO Number
            bstdk(10)   type c,    " PO Date
            ketdat(10)  type c,    " Required Delivery Date
            zterm(4)    type c,    " Payment Terms
            inco1(3)    type c,    " Inco Terms -1
            inco2(28)   type c,    " Inco Terms -2
            prsdt(10)   type c,    " pricing date
            waerk(5)    type c,    " Document Currency
            vkbur(4)    type c,    " Sales Office
            vkgrp(3)    type c,    " Sales group
            pltyp(2)    type c,    " Price List type
            kdgrp(2)    type c,    " Customer Group
            bstkd_e(35) type c,    " Ship-to-party PO number
            submi(10)   type c,    " Collective Number
            bname(35)   type c,    " Name
            ihrez(12)   type c,    " Your Reference
            kschl_1(4)   type c,    " Condition Type
            kbetr_1(11)  type c,    " Amount
            kschl_2(4)   type c,    " Condition Type
            kbetr_2(11)  type c,    " Amount
            kschl_3(4)   type c,    " Condition Type
            kbetr_3(11)  type c,    " Amount
           partner_1(25) TYPE c,    "  Partner(Bill To Party Number)
           partner_2(25) TYPE c,    "  Partner(Payer Number)
           partner_3(25) TYPE c,    "  Partner(Sales Responsible Number)
           partner_4(25) TYPE c,    "  Partner(Order admin)
           partner_5(25) TYPE c,    "  Partner(Contact person)
            partner_1(10) type c,    "  Partner(Bill To Party Number)
            partner_2(10) type c,    "  Partner(Payer Number)
            partner_3(10) type c,    "  Partner(Sales Responsible Number)
            partner_4(10) type c,    "  Partner(Order admin)
            partner_5(10) type c,    "  Partner(Contact person)
            tdspras_1(2)  type c,
            text_1(500)   type c,    " Text Before Items Z012
            tdspras_2(2)  type c,
            text_2(500)   type c,    " Invocie Up Z034
            tdspras_3(2)  type c,
            text_3(500)   type c,    " Invocie Down Z035
            tdspras_4(2)  type c,
            text_4(500)   type c,    " Customer Reference Continue Z018
            tdspras_5(2)  type c,
            text_5(500)   type c,    " Dispatch Marks/ Order Z019
            tdspras_6(2)  type c,
            text_6(500)   type c,    " Ordered By  Z003
            tdspras_7(2)  type c,
            text_7(500)   type c,    " Sales Parameters Z002
            kvgr1(3)      type c,    " Industry
            kvgr2(3)      type c,    " customer BU
    end of ty_header.
    types: begin of ty_item,
              bstkd(35)     type c,    " PO Number
              bstdk(10)     type c,    " PO Date
              bstkd_e(35)   type c,    " Ship-to-party PO number
              posnr(6)      type c,    " POSTION NUMBER
              matnr(18)     type c,    " Material Number
              kwmeng(18)    type c,    " Order Quantity
              pstyv(4)      type c,    " Sales doc. item categ
              kursk(18)     type c,    " EXCHANGE RATE****
              ffprf(8)      type c,    " DIP PROFILE
              werks(4)      type c,    " Delivering Plant
              vstel(4)      type c,    " SHIPPING POINT
              lgort(4)      type c,    " STORAGE LOCATION
              route(6)      type c,    " Route
              kurrf(18)     type c,    " EXCHANGE RATE-FI
              ntgew(18)     type c,    " Net Weight
              brgew(18)     type c,    " Gross Weight
              gewei(3)      type c,    " Weight Unit
              prctr(10)     type c,    " profit center
              abgrs(6)      type c,    " RESULT ANALYSIS KEY
              kalsm_k(4)    type c,    " COSTING SHEET
              kschl_1(4)    type c,    " Condition Type
              kbetr_1(11)   type c,    " Amount
              kschl_2(4)    type c,    " Condition Type
              kbetr_2(11)   type c,    " Amount
              kschl_3(4)    type c,    " Condition Type
              kbetr_3(11)   type c,    " Amount
              text_1(500)    type c,    " material Text 0001
              tdspras_1(1)   type c,
              text_2(500)    type c,    " Pr Text 9001
              tdspras_2(1)   type c,
           end of ty_item.
    types:  begin of ty_schedule_line,
             bstkd(35)       type c, "PO number
             bstdk(10)       type c, "PO date
             bstkd_e(35)     type c, "Ship-to-party PO number
             posnr(6)        type c, "sales doc.Item
             etdat(10)       type c, "Schedule line date
             wmeng(2)        type c, "Order Quantity
            end of ty_schedule_line.
    types: begin of ty_err  ,
            auart(4)    type c,    " Sales Order Type
            vkorg(4)    type c,    " Sales Organization
            vtweg(2)    type c,    " Distrubution Channel
            spart(2)    type c,    " Division
            kunnr_1(10) type c,    " Sold to Party
            kunnr_2(10) type c,    " Ship to Party
            augru(3)    type c,    " Order Reason
            bstkd(35)   type c,    " PO Number
            bstdk(10)   type c,    " PO Date
            ketdat(10)  type c,    " Required Delivery Date
            zterm(4)    type c,    " Payment Terms
            inco1(3)    type c,    " Inco Terms -1
            inco2(28)   type c,    " Inco Terms -2
            prsdt(10)   type c,    " pricing date
            waerk(5)    type c,    " Document Currency
            vkbur(2)    type c,    " Sales Office
            vkgrp(3)    type c,    " Sales group
            pltyp(2)    type c,    " Price List type
            kdgrp(2)    type c,    " Customer Group
            bstkd_e(35) type c,    " Ship-to-party PO number
            submi(10)   type c,    " Collective Number
            bname(35)   type c,    " Name
            ihrez(12)   type c,    " Your Reference
            kschl_1(4)   type c,    " Condition Type
            kbetr_1(11)  type c,    " Amount
            kschl_2(4)   type c,    " Condition Type
            kbetr_2(11)  type c,    " Amount
            kschl_3(4)   type c,    " Condition Type
            kbetr_3(11)  type c,    " Amount
            partner_1(25) type c,    "  Partner(Bill To Party Number)
            partner_2(25) type c,    "  Partner(Payer Number)
            partner_3(25) type c,    "  Partner(Sales Responsible Number)
            partner_4(25) type c,    "  Partner(Order admin)
            partner_5(25) type c,    "  Partner(Contact person)
            tdspras_1(2)  type c,
            text_1(500)   type c,    " Text Before Items Z012
            tdspras_2(2)  type c,
            text_2(500)   type c,    " Invocie Up Z034
            tdspras_3(2)  type c,
            text_3(500)   type c,    " Invocie Down Z035
            tdspras_4(2)  type c,
            text_4(500)   type c,    " Customer Reference Continue Z018
            tdspras_5(2)  type c,
            text_5(500)   type c,    " Dispatch Marks/ Order Z019
            tdspras_6(2)  type c,
            text_6(500)   type c,    " Ordered By  Z003
            tdspras_7(2)  type c,
            text_7(500)   type c,    " Sales Parameters Z002
            kvgr1(3)      type c,    " Industry
            kvgr2(3)      type c,    " customer BU
            message(600) type c,
      end of ty_err.
    types: begin of ty_t685a,
            kschl type kschl,
            krech type krech,
          end of ty_t685a.
                       INTERNAL TABLES
    ***header
    data:  g_krech_1(4)    type c,    " Calculation type for condition
           g_krech_2(4)    type c,    " Calculation type for condition
           g_krech_3(4)    type c.    " Calculation type for condition
          g_krech_4(4)    TYPE c,    " Calculation type for condition
          g_krech_5(4)    TYPE c,    " Calculation type for condition
          g_krech_6(4)    TYPE c,    " Calculation type for condition
          g_krech_7(4)    TYPE c,    " Calculation type for condition
          g_krech_8(4)    TYPE c,    " Calculation type for condition
          g_krech_9(4)    TYPE c,    " Calculation type for condition
          g_krech_10(4)   TYPE c,    " Calculation type for condition
          g_krech_11(4)   TYPE c,    " Calculation type for condition
          g_krech_12(4)   TYPE c,    " Calculation type for condition
          g_krech_13(4)   TYPE c,    " Calculation type for condition
          g_krech_14(4)   TYPE c,    " Calculation type for condition
          g_krech_15(4)   TYPE c,    " Calculation type for condition
          g_krech_16(4)   TYPE c,    " Calculation type for condition
          g_krech_17(4)   TYPE c,    " Calculation type for condition
          g_krech_18(4)   TYPE c,    " Calculation type for condition
          g_krech_19(4)   TYPE c,    " Calculation type for condition
          g_krech_20(4)   TYPE c.    " Calculation type for condition
    Items
    data:   g_krech_item_1(4)   type c,    " Calculation type for condition
            g_krech_item_2(4)   type c,    " Calculation type for condition
            g_krech_item_3(4)   type c.    " Calculation type for condition
           g_krech_item_4(4)   TYPE c,    " Calculation type for condition
           g_krech_item_5(4)   TYPE c,    " Calculation type for condition
           g_krech_item_6(4)   TYPE c,    " Calculation type for condition
           g_krech_item_7(4)   TYPE c,    " Calculation type for condition
           g_krech_item_8(4)   TYPE c,    " Calculation type for condition
           g_krech_item_9(4)   TYPE c,    " Calculation type for condition
           g_krech_item_10(4)  TYPE c,    " Calculation type for condition
           g_krech_item_11(4)  TYPE c,    " Calculation type for condition
           g_krech_item_12(4)  TYPE c,    " Calculation type for condition
           g_krech_item_13(4)  TYPE c,    " Calculation type for condition
           g_krech_item_14(4)  TYPE c,    " Calculation type for condition
           g_krech_item_15(4)  TYPE c,    " Calculation type for condition
           g_krech_item_16(4)  TYPE c.    " Calculation type for condition
    data: it_t685a  type standard table of ty_t685a.
    data: wa_bapi_header    type bapisdhd1,
         wa_bapi_headerx   TYPE bapisdhd1x,
          it_bapi_item      type table of bapisditm,
         it_bapi_itemx     TYPE TABLE OF bapisditmx,
          it_bapi_cond      type table of bapicond,
         it_bapi_condx     TYPE TABLE OF bapicondx,
          it_bapi_partner   type table of bapiparnr,
          it_bapi_shdl      type table of bapischdl,
         it_bapi_shdlx     TYPE TABLE OF bapischdlx,
         it_bapi_order_text type TABLE OF BAPISDTEXT,
          it_bapireturn     type table of bapiret2.
    data:  wa_bapi_item       like line of it_bapi_item,
          wa_bapi_itemx      LIKE LINE OF it_bapi_itemx,
           wa_bapi_cond       like line of it_bapi_cond,
          wa_bapi_condx      LIKE LINE OF it_bapi_condx,
           wa_bapi_partner    like line of it_bapi_partner,
           wa_bapi_shdl       like line of it_bapi_shdl,
          wa_bapi_shdlx      LIKE LINE OF it_bapi_shdlx,
          wa_bapi_order_text like LINE OF it_bapi_order_text,
           wa_bapireturn      like line of it_bapireturn.
    *DATA: zmode(1) VALUE 'N'.
    data: it_header      type standard table of ty_header.
    *DATA: it_temp_header TYPE STANDARD TABLE OF ty_header.
    data: it_item        type standard table of ty_item.
    *DATA: it_temp_item   TYPE STANDARD TABLE OF ty_item.
    data: it_err         type standard table of ty_err.
    data: it_fline1 type standard table of tline,
          wa_fline1 type tline.
    data: it_thead1 type thead.
    data: it_fline2 type standard table of tline,
          wa_fline2 type tline.
    data: it_thead2 type thead.
    data: it_fline3 type standard table of tline,
          wa_fline3 type tline.
    data: it_thead3 type thead.
    data: it_fline4 type standard table of tline,
          wa_fline4 type tline.
    data: it_thead4 type thead.
    data: it_fline5 type standard table of tline,
          wa_fline5 type tline.
    data: it_thead5 type thead.
    data: wa_header         like line of it_header,
          wa_item           like line of it_item,
          wa_err            type ty_err,
         wa_bill           LIKE LINE OF it_bill,
         wa_bill1          LIKE LINE OF it_bill,
          wa_iterr          like line of it_err,
          wa_t685a          like line of it_t685a.
         wa_bill_item TYPE ty_bill_item.
    data: it_schedule_line  type standard table of ty_schedule_line,
          wa_schedule_line type ty_schedule_line.
    data: sales_order_no     type bapivbeln-vbeln.
    data: ext_sales_order_no type bapivbeln-vbeln.
    Variable to be used to separate the fields which are concatenated by a
    runtime character
    *DATA: g_tabchar(1) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
    *DATA: wa_truxs_t_text_data TYPE truxs_t_text_data.
    *DATA: g_filename      TYPE string,
         g_path          TYPE string,
         g_fullpath      TYPE string,
         g_user_action   TYPE i,
         g_file_encoding TYPE abap_encoding.
    *DATA : g_text(8192),
    data : g_mstring1(100) type c,
          g_mstring2(100) type c,
          g_mstring3(100) type c,
          g_mstring4(100) type c,
          g_mstring5(100) type c.
    data: g_count1 type ebelp,
          g_str_count1(6) type c.
    data: g_count type ebelp,
          g_str_count(6) type c.
    *DATA: f_subrc      LIKE sy-subrc,
         f_subrc1     LIKE sy-subrc,
         f_error(500) TYPE c,
         item1(27)    TYPE c,
         item2(27)    TYPE c,
         item3(27)    TYPE c,
         item4(27)    TYPE c,
         i            TYPE ekpo-ebelp.
    *DATA: g_billplan_header TYPE c,
         g_billplan_item TYPE c.
    data : g_external_so type vbak-vbeln. "SO
                          SELECTION-SCREEN
    selection-screen begin of block frame1 with frame title text-001 .
    parameters:p_file1 type rlgrap-filename, "OBLIGATORY, "Header data.
               p_file2 type rlgrap-filename, "OBLIGATORY, "Item Data.
               p_file3 type rlgrap-filename,            "Schedule line.
               p_file4 type rlgrap-filename ."OBLIGATORY. "Error file.
    selection-screen end of block frame1.
    start-of-selection.
      wa_bapi_header-doc_type     =  'Z0MX'. "order type
      wa_bapi_header-sales_org    =  '0130'."sales org
      wa_bapi_header-distr_chan   =  '13'.  "distr channel
      wa_bapi_header-division     =  '13'.  "division
    Old code from copied program
    wa_bapi_header-purch_no_s   =  wa_header-kunnr_2.  " Ship to party
    New code as required in Finland project
    We are using to Header ->Order Tab -> Ship to Party -> Purchase order no (BSTKD_E) to store Old legacy SO number
      wa_bapi_header-purch_no_s   =  'MX100443'.  "External SO i.e Old legacey SO number
      wa_bapi_header-ref_1_s      = '0000666666'. "Sold to party
    wa_bapi_header-ord_reason   =  wa_header-augru.
      wa_bapi_header-purch_no_c   =  'ddr1234'.    " PO number
      wa_bapi_header-purch_date   =  sy-datum.    " PO date
      wa_bapi_header-req_date_h   =  sy-datum.   " Required Delivery Date
      wa_bapi_header-pmnttrms     =  '01'.    " Payment Terms
    wa_bapi_header-incoterms1   =  wa_header-inco1.
    wa_bapi_header-incoterms2   =  wa_header-inco2.
    wa_bapi_header-price_date   =  wa_header-prsdt.    " Pricing date
    wa_bapi_header-currency     =  wa_header-waerk.    " Document Currency
    wa_bapi_header-sales_grp  =  wa_header-vkgrp. " Sales group
    wa_bapi_header-price_list   =  wa_header-pltyp. " Price list type
    wa_bapi_header-cust_group   =  wa_header-kdgrp.   " Cust Group
    wa_bapi_header-ship_type    =  wa_header-vsart.   " Shipping Type
    wa_bapi_header-purch_no_s   =  wa_header-bstkd_e. " Ship-to-party po number
    wa_bapi_header-collect_no   =  wa_header-submi.   " Collective No.
    wa_bapi_header-name         =  wa_header-bname.   " Name
    wa_bapi_header-ref_1        =  wa_header-ihrez.   " Your Reference
    wa_bapi_header-cust_grp1    =  wa_header-kvgr1.   " Industry
    wa_bapi_header-cust_grp2    =  wa_header-kvgr2.   " Customer BU
    *ENDFORM.                    " f_header
    IF wa_header-partner_1 IS NOT INITIAL.
        wa_bapi_partner-partn_role = 'AG'.
        wa_bapi_partner-partn_numb = '0000666666'.
        wa_bapi_partner-itm_number = '000000'.
        append wa_bapi_partner to it_bapi_partner.
        clear wa_bapi_partner.
    ENDIF.
      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = wa_header-partner_2
        importing
          output = wa_header-partner_2.
    IF wa_header-partner_2 IS NOT INITIAL.
        wa_bapi_partner-partn_role = 'WE'.
        wa_bapi_partner-partn_numb = '0000666666'.
        wa_bapi_partner-itm_number = '000000'.
        append wa_bapi_partner to it_bapi_partner.
        clear wa_bapi_partner.
    ENDIF.
      perform f_item.
    data : order_items_inx type table of bapisditmx with header line.
      order_items_inx-material          = 'X'.  "
      order_items_inx-target_qty        = 'X'.  "
      order_items_inx-comp_quant        = 'X'.  "
      order_items_inx-trgqty_den        = 'X'.
      order_items_inx-rnddlv_qty        = 'X'.
    order_items_inx-updateflag = 'I'.
    order_items_inx-target_qu = 'X'.
      order_items_inx-plant             = 'X'.  "
      append order_items_inx.
      call function 'BAPI_SALESORDER_CREATEFROMDAT2'
        exporting
          salesdocumentin = 'MX11111152'
      order_header_in      = wa_bapi_header
             order_header_inx     = wa_bapi_headerx
      importing
      salesdocument        = sales_order_no
      tables
      return               = it_bapireturn
      order_items_in       = it_bapi_item
      order_items_inx      =  order_items_inx
      order_partners       = it_bapi_partner
       order_conditions_in  = it_bapi_cond.
      if sy-subrc is initial.
      commit work.
      endif.
    *&      Form  f_item
          text
    form f_item .
      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = wa_item-posnr
        importing
          output = wa_item-posnr.
      wa_item-posnr = '000010'.
    IF sy-subrc EQ 0. "IS INITIAL.
      move wa_item-posnr to g_str_count."commented out by shakti
    ENDIF.
      wa_bapi_item-itm_number        =  wa_item-posnr.  " Line item
    WA_BAPI_ITEM-PO_ITM_NO         =  WA_ITEM-EBELP.
    wa_bapi_item-division          = wa_item-spart.
      wa_bapi_item-purch_no_c        = 'ddr1234'.   " po number
      wa_bapi_item-purch_date        = sy-datum.   " po date
      wa_bapi_item-purch_no_s        = 'MX11111112'. " Ship-to-party po number
      wa_item-matnr = 'MAXIMO_SERVICE'.
      call function 'CONVERSION_EXIT_MATN1_INPUT'
        exporting
          input        = wa_item-matnr
        importing
          output       = wa_item-matnr
        exceptions
          length_error = 1
          others       = 2.
      if sy-subrc is initial.
        wa_bapi_item-material        = wa_item-matnr.  "material
      endif.
      wa_bapi_item-target_qty        = '1'. " Order qty
      wa_bapi_item-comp_quant = '1'.
      wa_bapi_item-target_qu = 'EA'.
        wa_bapi_item-fixed_quan = '1'.
    wa_bapi_item-comp_quant        = wa_item-kwmeng.
    wa_bapi_item-trgqty_den        = '1'.
    wa_bapi_item-rnddlv_qty        = wa_item-kwmeng.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
       EXPORTING
         input  = wa_item-ps_psp_pnr
       IMPORTING
         output = wa_item-ps_psp_pnr.
    IF sy-subrc = 0.
       wa_bapi_item-wbs_elem          = wa_item-ps_psp_pnr.
    ENDIF.
      wa_bapi_item-item_categ        = 'ZMAX'.
    wa_bapi_item-ex_rate_fi        = wa_item-kurrf.
    wa_bapi_item-dli_profil        = wa_item-ffprf.   " Dynamic item processor profile
    wa_bapi_item-route             = wa_item-route.   " route
    wa_bapi_item-exchg_rate        = wa_item-kursk.
      wa_bapi_item-plant             = '2090'.   " Plant
      wa_bapi_item-ship_point        = 'FN11'.   " Shipping point
    wa_bapi_item-store_loc         = wa_item-lgort.   " stg loc
    REPLACE ALL OCCURRENCES OF  ',' IN wa_item-ntgew WITH '.'.
    REPLACE ALL OCCURRENCES OF  ',' IN wa_item-brgew WITH '.'.
    wa_bapi_item-net_weight        = wa_item-ntgew.  "
    wa_bapi_item-gross_wght        = wa_item-brgew.  "
      call function 'CONVERSION_EXIT_CUNIT_INPUT'
        exporting
          input    = wa_item-gewei
          language = sy-langu
        importing
          output   = wa_item-gewei.
       EXCEPTIONS
         unit_not_found = 1
         OTHERS         = 2.
    IF sy-subrc <> 0.
    ENDIF.
      wa_bapi_item-untof_wght        =  'KG'.  " weight unit
      replace all occurrences of  ',' in wa_item-kursk with '.'.
      replace all occurrences of  ',' in wa_item-kurrf with '.'.
    wa_bapi_item-profit_ctr        = wa_item-prctr.   " Profit center
    wa_bapi_item-resanalkey        = wa_item-abgrs.   " RESULT ANALYSIS KEY
    wa_bapi_item-cstg_sheet        = wa_item-kalsm_k. " COSTING SHEET
      append wa_bapi_item to it_bapi_item.
    endform.                    " f_item
    Thanks & regards,
    Chetan

    see the following to create sales order:-
    *& Report  ZSALESORDER
    *&DEVELOPED BY JANI KRUPA 4.10.2008
    REPORT  ZSALESORDER.
    Parameters
    Sales document type
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text FOR FIELD p_auart.
    PARAMETERS: p_auart TYPE auart OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Sales organization
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD p_vkorg.
    PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Distribution channel
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text2 FOR FIELD p_vtweg.
    PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Division.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text3 FOR FIELD p_spart.
    PARAMETERS: p_spart TYPE spart OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SKIP 1.
    Sold-to
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text4 FOR FIELD p_sold.
    PARAMETERS: p_sold  TYPE kunnr OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Ship-to
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text5 FOR FIELD p_ship.
    PARAMETERS: p_ship  TYPE kunnr OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SKIP 1.
    Material
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text6 FOR FIELD p_matnr.
    PARAMETERS: p_matnr TYPE matnr   OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Quantity.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text7 FOR FIELD p_menge.
    PARAMETERS: p_menge TYPE kwmeng  OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Plant
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text9 FOR FIELD p_plant.
    PARAMETERS: p_plant TYPE werks_d .
    SELECTION-SCREEN END OF LINE.
    Complete Deliver
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text10 FOR FIELD p_autlf.
    PARAMETERS: p_autlf TYPE autlf DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    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.
    DATA: lt_schedules_ink    TYPE STANDARD TABLE OF bapisdhead1
                             WITH HEADER LINE.
    Initialization.
    INITIALIZATION.
    v_text   = 'Order type'.
    v_text1  = 'Sales Org'.
    v_text2  = 'Distribution channel'.
    v_text3  = 'Division'.
    v_text4  = 'Sold-to'.
    v_text5  = 'Ship-to'.
    v_text6  = 'Material'.
    v_text7  = 'Quantity'.
    v_text9  = 'Plant'.
    v_text10 = 'Complete delivery'.
    Start-of-selection.
    START-OF-SELECTION.
    Header data
    Sales document type
      header-doc_type = p_auart.
      headerx-doc_type = 'X'.
    Sales organization
      header-sales_org = p_vkorg.
      headerx-sales_org = 'X'.
    Distribution channel
      header-distr_chan  = p_vtweg.
      headerx-distr_chan = 'X'.
    Division
      header-division = p_spart.
      headerx-division = 'X'.
      headerx-updateflag = 'I'.
    *Complete delivery
        header-COMPL_DLV = p_autlf.
        header-COMPL_DLV = 'X'.
    Partner data
    Sold to
      partner-partn_role = 'AG'.
      partner-partn_numb = p_sold.
      APPEND partner.
    Ship to
      partner-partn_role = 'WE'.
      partner-partn_numb = p_ship.
      APPEND partner.
    ITEM DATA
      itemx-updateflag = 'I'.
    Line item number.
      item-itm_number = '000010'.
      itemx-itm_number = 'X'.
    Material
      item-material = p_matnr.
      itemx-material = 'X'.
    Plant
      item-plant    = p_plant.
      itemx-plant   = 'X'.
    Quantity
      item-target_qty = p_menge.
      itemx-target_qty = 'X'.
    item category
      itemx-ITEM_CATEG = 'X'.
      APPEND item.
      APPEND itemx.
      ITEM DATA
      itemx-updateflag = 'I'.
    Line item number.
      item-itm_number = '000020'.
      itemx-itm_number = 'X'.
    Material
      item-material = p_matnr.
      itemx-material = 'X'.
    Plant
      item-plant    = p_plant.
      itemx-plant   = 'X'.
    Quantity
      item-target_qty = p_menge.
      itemx-target_qty = '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.
      Fill schedule lines
      lt_schedules_in-itm_number = '000020'.
      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  = '000020'.
      lt_schedules_inx-sched_line  = '0001'.
      lt_schedules_inx-updateflag  = 'X'.
      lt_schedules_inx-req_qty     = 'X'.
      APPEND lt_schedules_inx.
    Call the BAPI to create the sales order.
      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 the work.
        COMMIT WORK AND WAIT.
        WRITE: / 'Document ', v_vbeln, ' created'.
      ENDIF.

  • Freight Carrier missing while creating sales order using BAPI

    Hi All,
    I am using BAPI BAPI_SALESORDER_CREATEFROMDAT2 to create sales order. At header level, I am passing sold-to-party,ship-to-party and Freight Carrier fields as partners.
    When the sales order is created it is creating partners sold-to-party,ship-to-party but freight carrier is missing in the partners.
    To partners inernal table, I am passing the partner role and partner number as following:
          int_partners-PARTN_ROLE = 'AG'.
          int_partners-PARTN_NUMB = int_order-kunnr.
          append int_partners.
          clear int_partners.
            int_partners-PARTN_ROLE = 'FC'.  "Frieght carrier
            int_partners-PARTN_NUMB = int_order-kunnr2.
            append int_partners.
            clear int_partners.
          int_partners-PARTN_ROLE = 'WE'.
          int_partners-PARTN_NUMB = int_order-kunnr1.
          int_partners-NAME       = int_order-name1.
          int_partners-NAME_2     = int_order-name2.
          int_partners-STREET     = int_order-street.
          int_partners-POSTL_CODE = int_order-post_code1.
          int_partners-COUNTRY    = int_order-country.
          int_partners-CITY       = int_order-city1.
          int_partners-REGION     = int_order-region.
          int_partners-TRANSPZONE = int_order-transpzone.
          int_partners-TAXJURCODE = int_order-taxcode.
          int_partners-district   = int_order-city2.
          append int_partners.
          clear int_partners.
    Freight Carrier is set up as a "Vendor" instead of Customer in our system.
    If anyone has solution to pass "Freight Carrier" through BAPI, please let me know.
    Thanks,
    Sonali.

    For Vendor (Freight carrier) , I checked the master data and it has partner function defined as VN (vendor).
    I have another issue with the salesorder create BAPI:
    I am getting error
    "E - 000010 : Condition rate does not agree with init. indicator for condition PR00"
    when I am updating the PR00 condition value with '0.0' .
    Please advice if anyone has any idea.
    Thanks,
    Sonali.
    Thanks,
    Sonali.

  • MRP Run can not create Planned order to Sales order

    Hi,
    I have a problem with planning run to sales order. We have a configurable material which have make to order strategy. MRP Run does not create planned order to some of our sales order. I think it has relation with schedule lines but i can not understand the problem.
    If schedule line has 1 as confirmed quantity MRP run can not plan but 0 as confirmed quantity MRP Run creates planned order.  How can i solve this problem?
    Regards,
    techmastere

    Hi,
    Order for which qty is confirming, check which schedule line is determined and which requirement type system is determining.
    then in VOV6 for schedule line tick mark availability check & Transfer of requirement
    for requirement class OVZG tick mark availability check & Transfer of requirement
    Note: if schedule line is not relevent for availability check & ToR then system always defaul confirm quantity.
    kapil

  • BAPI:Create sales order from an existing open sales order for open items

    Dear All,
    Could any one suggest me any BAPI that can create sales order from an existing OPEN sales order for OPEN items. since we are closing all open orders and creating new orders with reference to existing open orders.   please suggest, its would be great help.
    Regards,
    Reddy

    hi suresh,
    we are changing tax procedure from formula to condition based, so this is the reason we have close all the open orders and recreate in TAXINN procedure, it is going to be large number of records( open orders), so....
    Regards,
    Reddy

  • BAPI_SALESORDER_CREATEFROMDAT1 - using this to create Sales orders in R3

    Hi
       Does anyone out there - know the limitations of using this BAPI BAPI_SALESORDER_CREATEFROMDAT1 to create sales orders in R3 system - from a functional standpoint ? i.e any known issues - in terms of not being able to pass - all aspects of sales order data using the BAPI , any onscreen validations being done in VA01/VA02 not being done in the BAPI etc.
    Can this BAPI be used for sales order create/change ? Or is there any other BAPI out there that is better suited and more well rounded for sales order creation in R3 ?

    REPORT z_bapi_create_sales_order_test .
    * Order header:
    * - Order type: OR  Important you must use the german code TA
    * - Sales org: 1000
    * - Distrb. chan.: 10
    * - Division: 00
    * - Sold to party: 1032
    * - Ship to party: 1032
    * - Purch order: DG-19970626-3
    * Order item:
    * - Material: P-100
    * - Qty: 1
    DATA:
    * Order partners
    li_order_partners    TYPE STANDARD TABLE OF bapiparnr,
    l_order_partners     LIKE bapiparnr,
    * Structures for order header
    l_order_header_in    LIKE bapisdhd1,
    l_order_header_inx   LIKE bapisdhd1x,
    * Tables for order items
    li_order_items_in    TYPE STANDARD TABLE OF bapisditm,
    l_order_items_in     LIKE bapisditm,
    li_order_items_inx   TYPE STANDARD TABLE OF bapisditmx,
    l_order_items_inx    LIKE bapisditmx,
    * Return table from bapi call
    li_return TYPE STANDARD TABLE OF bapiret2,
    l_return  TYPE bapiret2,
    * Sales document number
      l_vbeln LIKE bapivbeln-vbeln,
    * Error flag
      l_errflag(1) TYPE c.
    START-OF-SELECTION.
    * Build partner information
      CLEAR l_order_partners.
      l_order_partners-partn_role = 'AG'.          "Remember German codes !
      l_order_partners-partn_numb = '0000001032'.
      APPEND l_order_partners TO li_order_partners.
    * Build order header
    * Update flag
      l_order_header_inx-updateflag = 'I'.
    * Sales document type
      l_order_header_in-doc_type    = 'TA'.        "Remember German codes !
      l_order_header_inx-doc_type   = 'X'.
    * Sales organization
      l_order_header_in-sales_org  = '1000'.
      l_order_header_inx-sales_org  = 'X'.
    * Distribution channel
      l_order_header_in-distr_chan = '10'.
      l_order_header_inx-distr_chan = 'X'.
    * Division
      l_order_header_in-division = '00'.
      l_order_header_inx-division = 'X'.
    * Purchase order
      l_order_header_in-purch_no_c = 'DG-19970626-300'.
      l_order_header_inx-purch_no_c = 'X'.
    * Build order item(s) - Only 1 is used in this example
      l_order_items_in-itm_number = '10'.
      l_order_items_inx-itm_number = '10'.
      l_order_items_in-material = 'P-100'.
      l_order_items_inx-material = 'X'.
      l_order_items_in-comp_quant = '1.000'.
      l_order_items_inx-comp_quant = 'X'.
      APPEND l_order_items_in TO li_order_items_in.
      l_order_items_inx-updateflag = 'I'.
      APPEND l_order_items_inx TO li_order_items_inx.
    * CALL Bapi
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
           EXPORTING
                order_header_in  = l_order_header_in
                order_header_inx = l_order_header_inx
                testrun          = 'X'
           IMPORTING
                salesdocument    = l_vbeln
           TABLES
                return           = li_return
                order_items_in   = li_order_items_in
                order_items_inx  = li_order_items_inx
                order_partners   = li_order_partners.
    END-OF-SELECTION.
    * Check and write Return table
      CLEAR l_errflag.
      WRITE: / 'Sales dcoument: ', l_vbeln.
      LOOP AT li_return INTO l_return.
        WRITE: / l_return-type, l_return-message(50).
        IF l_return-type = 'E'.
          l_errflag = 'X'.
        ENDIF.
      ENDLOOP.
    * No errors - Commit
      IF l_errflag  IS INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ENDIF.

  • Minimum mandatry fields for Creating Sales Order

    Hi All,
    I am going to create sales order using <b>BAPI_SALESORDER_CREATEFROMDAT2</b> in the web dynpro for java,
    I want to use minimum fields,  so, what are the <b>minimum</b> fields for creating sales order ?.
    if u have any documents or links realted to this please send me.
    please help me out.
    Thanks & regards,
    Iqbal Ahmad

    chk it
    EXPORTING
    SALESDOCUMENTIN =
    ORDER_HEADER_IN = l_order_header
    ORDER_HEADER_INX =
    SENDER =
    BINARY_RELATIONSHIPTYPE =
    INT_NUMBER_ASSIGNMENT =
    BEHAVE_WHEN_ERROR =
    LOGIC_SWITCH =
    TESTRUN =
    CONVERT = ' '
    IMPORTING
    SALESDOCUMENT = l_salesdocument
    TABLES
    RETURN = it_return
    ORDER_ITEMS_IN = it_order_items
    ORDER_ITEMS_INX =
    ORDER_PARTNERS = it_order_partners
    ORDER_SCHEDULES_IN = it_order_schdl
    ORDER_SCHEDULES_INX =
    ORDER_CONDITIONS_IN = it_order_conditions
    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
    How to create sales order using bapi( test purpose)
    Create Sales Order using BAPI
    creating sales order using bapi

Maybe you are looking for

  • Fields missing in Excise Account Assignment Table

    Hello experts,                      I am doing CIN configuration in ECC 5.0 and  i am assigning Excise GL accounts as per "Excise Transaction". All GL Accounts have been assigned as per excise transaction except 3 Fields ie; " GL A/c for RG23A ECS",

  • External LDAP Server

    Hello. Is it possible to configure WebLogic to use external LDAP server, which in turn is "built in" in other WebLogic (at other physical machine)? And if it is possible, can I use OracleInternetDirectoryAuthenticator provider for this? (sorry for my

  • Block batch change while movement type 311

    Hello all, Is there a simple way to block this behavior: User accidentally post material from batch A to batch B while doing MIGO 311, which messes up traceability in reporting.  I am aware of BADI rule possibility but want to explore simpler (more n

  • ISA Server Internet Explorer content limit

    Have access to a site that has more than 20,000 characters through a Microsoft TMG2010 Server with SP2. We did not get to see the last 50 characters. But if we turn off the Microsoft Forefront TMG firewall service we could access. We Would like to kn

  • Spotlight during start up "Quit Unexpectedly"- Finder, etc won't launch...

    Hi, During start up, I get a crash dialog with the Ignore/Report/Relaunch buttons. Ignore and Relaunch don't do any good. Report says very little (and it cut off when I printed it, so I'll need to go back for more...)- the part I can read says: Libra