Reg : BAPI in sales order

Hi All,
Am using BAPI_SALES ORDER_CREATEFROMDAT2 to create sales order am getting the sales order number the problem is when i opened the sales order the order quantity has not been updated even though i pass it, it is blank. The item data which i appended is below,
*---->Item Data
    itemdata-material      = t_sales-material.
    itemdata-target_qty    = t_sales-target_qty.
    itemdata-itm_number    = t_sales-itm_number.
    itemdata-wbs_elem      = t_sales-wbs_elem.
    APPEND itemdata.
*---->Item Data Checkbox
    itemdatax-material     = 'X'.
    itemdatax-target_qty   = 'X'.
    itemdatax-itm_number   = t_sales-itm_number.
    itemdatax-wbs_elem     = 'X'.
    APPEND itemdatax.
Even though i have passed the target_qty its not updating,canyone come across this scenario like this.kindly provide your solution regarding this scenario.

Hi vijay,
I have already given the schedule data which i shown below,
*---->Schedule Line Data
    scheduledata-req_qty   = t_sales-req_qty.
    scheduledata-itm_number = t_sales-item_numb.
    APPEND scheduledata.
*---->Checkbox Schedule Line Data
    scheduledatax-req_qty   = 'I'.
    scheduledatax-itm_number = t_sales-item_numb.
    APPEND scheduledatax.
but still not working any other idea.
Regards,
Suresh.

Similar Messages

  • Reg:BAPI for sales order creation

    Dear All,
    I am not able to populate  Order Quantity in Sales Oder
    from bapi BAPI_SALESORDER_CREATEFROMDAT2
    in which structure the order quantity field will be there.
    In the structure BAPISDITM there is a field TARGET_QTY but it is not  populeting in Cumulative Order Quantity in Sales Units.
    In the structure BAPISCHDL there is a field REQ_QTY
    is it Cumulative Order Quantity in Sales Units.
    please can you tell me which is the field for Order Quantity througn bapi in BAPI_SALESORDER_CREATEFROMDAT2.
    thanks
    mars

    Pass the quantity in ORDER_SCHEDULES_IN-REQ_QTY.  Also update the field ORDER_SCHEDULES_INX-REQ_QTY with value 'X'.
    Regards
    Vinod

  • BAPI Simulate Sales order issue

    When iam using the BAPI for sales order simulation, it is giving the netvalue of item as
    NET_VALUE  field in the item out table( Description: Net value as num. field - 00000901 equals 9,01 ). How to change that value into actual currency amount ie into vbap-netwr.
    In debugging the value is
    I_BAPIITEMOUT[1]-NET_VALUE     NUMC 15                   000000000005000.
    The actual value should be              P         12
                                   value:                       50.0000.

    Just we need to divide it by 100.
    This is standard method that will be followed by SAP standard programs also.

  • RFC/BAPI For Sales Order Credit Block Release like vkm3 (very urgent )!!

    hi experts,
    I need the RFC/BAPI For Sales Order Credit Block Release like vkm3 function ,please help
    thanks
    Godspeed

    hi
    can get the list of all the bapis..
    http://www.planetsap.com/LIST_ALL_BAPIs.htm
    Reward if USeful
    Thanx & regards.
    Naren..

  • Regarding bapis for sales order creation and modification

    Hi,
    I am trying to create a syncbo for sales order creation, modification and display. The bapis that I am using are
    1.BAPI_SALESORDER_GETLIST
    2.BAPISDORDER_GETDETAILEDLIST
    3.BAPI_SALESORDER_CREATEFROMDATA1
    4. BAPI_SALESORDER_CHANGE
    Am I using the correct bapis. When I tried to create a syncbo it gave the following errors
    BAPISDORDER_GETDETAILEDLIST does not have RETURN parameter in export or tables parameter
    RETURN parameter in Create BAPI Wrapper should refer to structure BAPIRET2
    RETURN parameter in GetList BAPI Wrapper should refer to structure BAPIRET2
    GetDetail BAPI Wrapper does not have RETURN parameter in export or tables parameter
    No Export parameter referring to header structure exists in GetDetail BAPI Wrapper
    No Import parameter referring to header structure exists in Create BAPI Wrapper
    No Import parameter referring to header structure exists in Modify BAPI Wrapper
    No Import parameter referring to a field of header structure exists in GetDetail BAPI Wrapper
    No Export parameter referring to a field of header structure exists in Create BAPI Wrapper
    No Tables parameter referring to item structure exists in Create BAPI Wrapper
    No Tables parameter referring to item structure exists in Modify BAPI Wrapper
    I am informed that the above bapis are standard bapis.
    I am not sure as to why I am getting the errors.
    Does the syncbo require the  bapi's to be in a specific format.
    What would be the header and item structures for sales order bapis
    Regards
    Raja Sekhar

    Hi Raja,
      ya , for creating Sync BOs ,our BAPI wrappers must satisfy certain conditions..
    just go through this link.
    u can use the standard BAPIs of SALES Order in ur Custom BAPI Wrapper
      http://media.sdn.sap.com/public/html/submitted_docs/MI/MDK_2.5/content/appdev/smartsync/what_is_a_bapi_wrapper.html
    the RETURN must be of type BAPIRET2..
                    Regards
                    Kishor Gopinathan

  • LSMW BAPI Open Sales Order Load - How to update conditions?

    Hello gurus,
    I was using the BAPI SALESORDER_CREATEFROMDAT2 to upload open sales orders. Wanted to overwrite the default PR00 pricing condition that gets pulled from the customer-material info record, with the price that was existing in the original legacy system when the order was created there. Used the E1BPCOND structure in the Idoc, but since there is no such thing as a E1BPCONDX structure(corresponding to the structure BAPICONDX in the origial BAPI) where you could specify whether the condition should be updated, added or deleted, it adds a second PR00 condition with the legacy system price. The original PR00 condition with the customer-material record price still stays there. Eventhough the order seems to be taking into consideration only the second one I added, to determine the total pricing, I am worried the original sitting there, might cause problems down the document flow. Is there a way to update the existing PR00 condition(rather than adding a new one) on the order, through some flag in the Idoc structure that I am not aware of?
    Would greatly appreciate an answer ASAP.
    Thanks a lot in advance,
    Wayfarer

    Thanks and appreciate your taking your time to reply, Gerard, I guess my problem is, we are still on 46C, and the only message type available for this BAPI is SALESORDER_CREATEFROMDAT201. Just called a friend who is on ECC 60 who confirmed that the later version of this message type, SALESORDER_CREATEFROMDAT202 has the E1BPCONDX structure. I don't have that option since on LSMW it automatically defaults to the only message type(and method CREATEFROMDAT2) that is available, when you choose business object BUS2032. Guess I am out of luck, unless you have any other options to suggest.
    Thanks,
    Wayfarer

  • To update conditiontype values using change BAPI of sales order

    Hi Gurus,
    i am using the standard bapi 'BAPI_SALESORDER_CHANGE' and i am passing the values for the conditiontypes as follows.......
    vbeln is my sales order number..
    wa_conditions_in-itm_number = '00010'.
    wa_conditions_in-cond_count = '01'.
    wa_conditions_in-cond_type = 'ZCUS'.
    wa_conditions_in-applicatio = 'V'.
    wa_conditions_in-cond_value =  '1000.00'.
    wa_conditions_in-currency = 'INR'.
    wa_conditions_in-cond_p_unt = '1'.
    wa_conditions_inx-itm_number = '00010'.
    wa_conditions_inx-cond_count = '01'.
    wa_conditions_inx-cond_type = 'ZCUS'.
    wa_conditions_inx-updateflag = 'U'.
    wa_conditions_inx-cond_value = 'X'.
    wa_conditions_inx-currency = 'X'.
    wa_conditions_inx-cond_p_unt = 'X'.
        APPEND wa_conditions_in TO conditions_in.
        APPEND wa_conditions_inx TO conditions_inx.
    CLEAR : order_header_in, order_header_inx.
    order_header_in1-purch_no_c = 'Order'.
    order_header_inx1-purch_no_c = 'X'.
    order_header_in1-purch_no_s = 'Order'.
    order_header_inx1-purch_no_s = 'X'.
    order_header_inx1-updateflag = 'U'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument               = vbeln
        order_header_in             = order_header_in1
        order_header_inx            = order_header_inx1
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      TABLES
        return                      = return
       conditions_in               = conditions_in
       conditions_inx              = conditions_inx
      EXTENSIONIN                 =
    while executing in the order it is not updating the value for the condition type 'ZCUS' and it is inserting as new record.
    Please help me in this regard.
    Thanks & Regards,
    R.P.Sastry

    HI,
    Take the below sample code. for example and try to use like that.
    REPORT ZTEST_BAPI .
    Data: salesd like BAPIVBELN-VBELN.
    data: it_BAPISDH1 type BAPISDH1.
    data: it_BAPISDH1X type BAPISDH1X.
    data: it_BAPIPARNR type BAPIPARNR occurs 0 with header line.
    data: it_BAPIRET2 type BAPIRET2 occurs 0 with header line.
    data: it_BAPIPARNRC type BAPIPARNRC occurs 0 with header line.
    data: it_BAPISDITMX type BAPISDITMX occurs 0 with header line.
    data: it_BAPISDITM type standard table of BAPISDITM with header line.
    constants: c_bp(2) type c value 'BP'.
    it_BAPISDH1X-UPDATEFLAG = 'U'.
    it_BAPISDH1X-SALES_ORG = 'X'.
    it_BAPISDH1X-DISTR_CHAN = 'X'.
    it_BAPISDH1X-DIVISION = 'X'.
    it_BAPISDH1X-PURCH_NO_C = 'X'.
    it_BAPISDH1X-CUST_GROUP = 'X'.
    it_BAPISDH1-SALES_ORG = '1000'.
    it_BAPISDH1-DISTR_CHAN = '01'.
    it_BAPISDH1-DIVISION = '00'.
    it_BAPISDH1-PURCH_NO_C = 'Test1'.
    it_BAPIPARNR-PARTN_ROLE = 'RE'.
    it_BAPIPARNR-PARTN_NUMB = '0000000171'.
    it_BAPIPARNR-ITM_NUMBER = '00000'.
    append it_BAPIPARNR.
    it_BAPIPARNR-PARTN_ROLE = 'RE'.
    it_BAPIPARNR-PARTN_NUMB = '0000000179'.
    it_BAPIPARNR-ITM_NUMBER = '000000'.
    append it_BAPIPARNR.
    it_BAPIPARNRC-DOCUMENT = '000000375'.
    it_BAPIPARNRC-ITM_NUMBER = '000000'.
    it_BAPIPARNRC-UPDATEFLAG = 'U'.
    it_BAPIPARNRC-PARTN_ROLE = 'WE'.
    it_BAPIPARNRC-P_NUMB_OLD = '0000000171'.
    it_BAPIPARNRC-P_NUMB_NEW = '0000000179'.
    it_BAPIPARNRC-ADDRESS = '26324'.
    it_BAPIPARNRC-ADDR_LINK = '0000000003'.
    it_BAPIPARNRC-REFOBJTYPE = 'BUS2032'.
    it_BAPIPARNRC-REFOBJKEY = '000000375'.
    append it_BAPIPARNRC.
    data PARTNERADDRESSES like BAPIADDR1 occurs 0 with header line.
    PARTNERADDRESSES-ADDR_NO = '0000000003'.
    PARTNERADDRESSES-NAME = 'Test Cust'.
    PARTNERADDRESSES-STREET = '222nd AVE'.
    PARTNERADDRESSES-NAME_2 = 'NEW Bldg A2'.
    PARTNERADDRESSES-CITY = 'MILPITAS'.
    PARTNERADDRESSES-REGION = 'CA'.
    PARTNERADDRESSES-POSTL_COD1 = '950351'.
    PARTNERADDRESSES-COUNTRY = 'IN'.
    PARTNERADDRESSES-LANGU = 'E'.
    APPEND PARTNERADDRESSES. CLEAR PARTNERADDRESSES.
    it_BAPISDITMX-ITM_NUMBER = '00010'.
    it_BAPISDITMX-UPDATEFLAG = 'U'.
    it_BAPISDITMX-MATERIAL = 'X'.
    it_BAPISDITMX-CUST_GROUP = 'X'.
    append it_BAPISDITMX.
    it_BAPISDITM-ITM_NUMBER = '00010'.
    it_BAPISDITM-MATERIAL = '946'.
    append it_BAPISDITM.
    break-point.
    salesd = '0000000375'.
    call function 'BAPI_SALESORDER_CHANGE'
    exporting
    salesdocument = salesd
    ORDER_HEADER_IN = it_BAPISDH1
    order_header_inx = it_BAPISDH1X
    SIMULATION =
    BEHAVE_WHEN_ERROR = ' '
    INT_NUMBER_ASSIGNMENT = ' '
    LOGIC_SWITCH =
    tables
    ORDER_ITEM_IN = it_BAPISDITM
    ORDER_ITEM_INX = it_BAPISDITMX
    PARTNERS = it_BAPIPARNR
    return = it_BAPIRET2
    PARTNERCHANGES = it_BAPIPARNRC
    PARTNERADDRESSES = PARTNERADDRESSES
    ORDER_CFGS_REF =
    ORDER_CFGS_INST =
    ORDER_CFGS_PART_OF =
    ORDER_CFGS_VALUE =
    ORDER_CFGS_BLOB =
    ORDER_CFGS_VK =
    ORDER_CFGS_REFINST =
    SCHEDULE_LINES =
    SCHEDULE_LINESX =
    ORDER_TEXT =
    ORDER_KEYS =
    CONDITIONS_IN =
    CONDITIONS_INX =
    EXTENSIONIN =
    If sy-subrc = 0. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT =
    IMPORTING
    RETURN =
    . endif.
    You need to sepaeately use the *Update* and *Change*  and *Insert* flags while filling the data
    Thanks!
    Edited by: Mr. M on Jan 9, 2009 6:23 PM

  • BAPI: Create Sales order with reference to Quotation

    Hi ...
    I am using bapi BAPI_SALESOREDER_CREATEFROMDATA2  and
    i want to create sales order with reference Quotation... All quotation data like Materials prices and conditions must be copied from reference quotaion which is allready created .....
    ..Thanks..
    ..Ashish

    Hello,
    nice to see that this has already been solved.
    But it actually doesnt work in my scenario. Do you have an example coding which will explain your solution.
    Mine looks like this:
    * Update Flag
      ls_header_inx-updateflag = 'I'.
    * Angebotskopf einlesen
      SELECT SINGLE * FROM vbak INTO ls_vbak
        WHERE vbeln = iv_vbeln
          AND vbtyp = lc_vbtyp.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
    * Auftragskopf setzen
      ls_header_in-doc_type      =  ls_vbak-auart.
      ls_header_in-sales_org     = ls_vbak-vkorg.
      ls_header_in-distr_chan    = ls_vbak-vtweg.
      ls_header_in-division         = ls_vbak-spart.
      ls_header_in-req_date_h   = ls_vbak-VDATU.
      ls_header_in-ref_doc        = ls_vbak-vbeln.
      ls_header_in-refdoc_cat   = 'B'.
    * Angebots-Partner einlesen (Nur AG und WE)
    * Auftrag anlegen
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
        EXPORTING
    *   SALESDOCUMENTIN               =
          order_header_in               =  ls_header_in
    *      order_header_inx              = ls_header_inx
    *   SENDER                        =
    *   BINARY_RELATIONSHIPTYPE       =
    *   INT_NUMBER_ASSIGNMENT         =
    *   BEHAVE_WHEN_ERROR             =
    *   LOGIC_SWITCH                  =
    *   testrun                       = 'X'
    *   CONVERT                       = ' '
       IMPORTING
          salesdocument                 = ev_vbeln
        TABLES
          return                        = et_return
    *      order_items_in                = lt_items_in
    *      order_items_inx               = lt_items_inx
          order_partners                = lt_partners
    *   ORDER_SCHEDULES_IN            =
    *   ORDER_SCHEDULES_INX           =
    *   ORDER_CONDITIONS_IN           =
    *   ORDER_CONDITIONS_INX          =
    *   ORDER_CFGS_REF                =
    *   ORDER_CFGS_INST               =
    *   ORDER_CFGS_PART_OF            =
    *   ORDER_CFGS_VALUE              =
    *   ORDER_CFGS_BLOB               =
    *   ORDER_CFGS_VK                 =
    *   ORDER_CFGS_REFINST            =
    *   ORDER_CCARD                   =
    *   ORDER_TEXT                    =
    *   ORDER_KEYS                    =
    *   EXTENSIONIN                   =
    *   PARTNERADDRESSES              =  .
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    Unfortunatly this just makes the reference to the quotation but does not takeover ALL data from header and pos level.
    Thanks and regards
    Markus Armbruster

  • Regarding BAPI at sales order

    Dear guys,
    I have CSV file having records, which is read from local PC and has to be uploaded in R/3 screen.
    Concretely speaking, Now Records from CSV files will be displayed in Sales order screen. customer will correct the data changes in screen(if necessary for each record) and save the record to sales table.
    1-Here i want to know should i have to use BAPI or not for saving datas in sales order table.
    (Its purely ABAP programming module)
    2-if Bapi is required could you pls tell what BAPI is required to save in sales table.
    Thanks in advance.
    ambichan.

    Hi Ambichan,
    first of all: don't make changes (/ use exits / BADI) for this task. Only if you need different functionality for sales document creation itself, you might do some enhancements.
    Copy of this transaction doesn't make much sense: to much to delete. Maybe you use screen definition, but the rest you should do on your own.
    Do you need feedback from system?
    Yes: use BAPI_SALESORDER_SIMULATE to get feedback (like delivery days, availability...) and display results in own transaction.
    No: just display the values like an editor (but in corresponding fields and places of VA01).
    If you create only one order at a time, then it's also possible to use a batch input (VA01), started in error mode, to fill all fields. Then your last action is pressing enter (instead of save). Transaction will pop up, because it's not finished -> user is in correct transaction, feedback from system is available, all additional functions (like display customer / article / whatever else data) are at hand...
    Regards,
    Christian

  • BAPI FOR SALES ORDER PROBELM IN PRICING VALUE

    Respected Members
    i have a problem in creating sales order through BAPI
    i will explain you.
    My flat file structure is
    doc_type sales_org dis_Ch division part_num pono itm_num material short_text qty plant price
    OR 1000 20 10 1000 123 10 100-100 abc 50 1000 500
    OR 1000 20 10 1000 254 10 100-200 XYZ 70 1000 800
    Now when i am executing my program with this flat file data , everything is coming but problem is that in second sales order which is getting create is also having the quantity and price value of the first sales order ie 50 and 500 and it is not taking quantity as 70 and price as 800.
    Rest everything is getting changed .
    For eg Material is getting changed and description is getting changed for second po.
    for second sales order it is taking material 100-200 and description XYZ only.
    Then why it is taking values for quantity and price same as first sales order.
    i m using the bapi function module in the loop only and thats why two sales order are getting generated.
    also at the debugging when the values are passed to BAPI function module it is passing the correct values ie 70 and 800 but finally when i am going to tcode VA02 and seeing the sales order then it is showing the values of the previous order.
    Please give me the solution as soon as possible.
    Thanks

    Hello Manish,
    If you are calling the BAPI within a loop, try to put the BAPI_TRANSACTION_COMMIT within the loop as well so every order is commited properly before the next one is created.
    Hope that solves your problem.
    Michael

  • BAPI for sales order creation with Reference

    Hello Experts,
    I have a order, with its reference I have to create a new sales order.
    Am looking for BAPi, with which I can create a sales order with a Reference order (which is in my hand), so I checked SE37 with wild cards, but I did not find any!!
    1) Pls. let me know a BAPI
    2) And just like that I do not want to create a new order with the reference(existing) order, I have to change the PO number & order Reason(2 fileds) in newley creationg order, pls. let me know How to do it
    Thank you

    Hi,
    First try to pass these two parameters to BAPI_SALESORDER_CREATEFROMDAT2
    ORDER_HEADER_IN-REFDOCTYPE = Your Sch. Agreement No. (Please Check) and
    ORDER_HEADER_IN-SD_DOC_CAT = 'E'.
    If the above doesnt work ,than try using BAPI "BAPI_SALESDOCUMENT_COPY"
    I hope you are working in SAP R/3 4.6C and above version because i am not sure whether this BAPI is available in lower version.
    Let us know if this helps you..
    Rgds,
    Mayank

  • Bapi for sales order

    hi all ,
    could any one give me the step by step procedure how to creat a sales order using bapi.  i found BAPI_SALESORDER_CREATEFROMDAT2 this the bapi ... but iam not sure about the passing the parameters. please it would be help ful.
    the fields which i have to upload are
    order type - or
    organisational data -1000 ,10  ,00.
    sold to party - 1000
    purchase oder number- 10
    purchase order date - 31 03 2005
    required dlivery date- 5 4 07
    material - p-103
    quantity 10
    regards
    reena

    Hi,
    Please check the code below:
    DATA ok_code LIKE sy-ucomm.
      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.
      DATA: BEGIN OF lt_itab OCCURS 0,
                           vbeln(10),
                           augru(3),
                           bstkd(10),
                           ean11(18),
           END OF lt_itab.
    START-OF-SELECTION.
      CALL SCREEN 100.
    Build partner information
      CLEAR l_order_partners.
      l_order_partners-partn_role = 'AG'. "Remember German codes !
      l_order_partners-partn_numb = itab-st.
      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 = 'YR30'.
      l_order_header_inx-doc_type = 'X'.
    customer reference
      l_order_header_in-ord_reason = lt_itab-augru.
      l_order_header_inx-ord_reason = 'X'.
    Distribution channel
      l_order_header_in-refdoctype = lt_itab-vbeln.
      l_order_header_inx-doc_type = 'X'.
    Purchase order
      l_order_header_in-purch_no_c = lt_itab-bstkd.
      l_order_header_inx-purch_no_c = 'X'.
    Build order item(s) - Only 1 is used in this example
      l_order_items_in-ean_upc = lt_itab-ean11.
      l_order_items_inx-ean_upc = lt_itab-ean11.
      l_order_items_in-material = itab-matnr.
      l_order_items_inx-material = 'X'.
      l_order_items_in-comp_quant = itab-qty.
      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
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'CREATE'.
      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.
      PERFORM error.
       WHEN 'EXIT'.
         LEAVE PROGRAM.
    ENDCASE.
    *ENDMODULE. " USER_COMMAND_0100 INPUT
    ENDFORM.                    " call_bapi
    Check and write Return table
    FORM error.
      DATA: l_errflag(1) TYPE c,
    Return table from bapi call
      li_return TYPE STANDARD TABLE OF bapiret2,
      l_return TYPE bapiret2.
      LEAVE TO LIST-PROCESSING.
      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.
      PERFORM commit.
    ENDFORM. " ERROR INPUT
    No errors - Commit
    FORM commit.
      DATA: l_errflag(1) TYPE c.
      IF l_errflag IS INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ENDIF.
    ENDFORM. " COMMIT INPUT
    Regards
    Kannaiah

  • BAPI for Sales Order Creation.

    Hello gurus,
    I want to create a sales order using BAPI.
    I have tried some BAPI's like BAPI_SALESORDER_CREATEFROMDAT1, BAPI_SALESORDER_CREATEFROMDAT2, BAPI_SALESORDER_CREATEFROMDATA, BAPI_SALESDOCU_CREATEWITHDIA.
    But I am not able to update the Miscellaneous Information like Mode of transport(VBAP-OIC_MOT), Forwarding Agent(VBAP-OIC_LIFNR), Base Location(VBAP-OIA_BASELO), Truck Number(VBAP-OIC_TRUCKN), Pipeline trip No.(VBAP-OIC_PTRIP), Pipeline operator´s external batch number(VBAP-OIC_PBATCH).
    Is there any other BAPI thru which i can update these fields while creation of Sales Order.
    The Fields which I can provide to BAPI as import parameter is:
    Order Type(VBAK-AUART),
    Contract(VBAK_VGBEL),
    SALES Org (VBAK-VGORT),
    Dist Channel(VBAK-VTWEG),
    Division (VBAK-SPART),
    Open Quantity (VBAK-KWMENG)
    Plant(VBAP-WERKS)
    Storage Location (VBAP-LGORT)
    Mode of transport(VBAP-OIC_MOT), Forwarding Agent(VBAP-OIC_LIFNR), Base Location(VBAP-OIA_BASELO), Truck Number(VBAP-OIC_TRUCKN), Pipeline trip No.(VBAP-OIC_PTRIP), Pipeline operator´s external batch number(VBAP-OIC_PBATCH).
    Thanks In Advance,
    Points will be rewarded for Best Solution......
    Yogesh Sharma

    hi,
    I can give u a suggestion .. try it ..
    its a quite a long process....
    in BAPI_SALESORDER_CREATEFROMDAT2
    there is a table EXTENSIONIN...
    here u can add append structure and carry on ur sales order creation
    Follow the process
    Customer Enhancement for VBAK, VBAP, VBEP
    Description
    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.
    Technical information about Customer Enhancements
    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.
    For example:
    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
    Further Information
    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
    VALUEPART1  |          000010Customermateriallongtext50
                  VBELN     POSNR ZMAT50

  • Bapi for Sale order

    Hi Experts,
    I am using BAPI_SALESDOCU_CREATEFROMDATA to create sale orders.
    As of now i m giving the following inputs to the BAPI
    WA_HEADER-DOC_TYPE = T_UPLOAD-AUART.
        WA_HEADERX-DOC_TYPE = 'X'.
        WA_HEADER-PMNTTRMS = T_UPLOAD-ZTERM.
        WA_HEADERX-PMNTTRMS = 'X'.
    Sales organization
        WA_HEADER-SALES_ORG = T_UPLOAD-VKORG.
        WA_HEADERX-SALES_ORG = 'X'.
    Distribution channel
        WA_HEADER-DISTR_CHAN  = T_UPLOAD-VTWEG.
        WA_HEADERX-DISTR_CHAN = 'X'.
    Division
        WA_HEADER-DIVISION = T_UPLOAD-SPART.
        UNPACK WA_HEADER-DIVISION TO WA_HEADER-DIVISION.
        WA_HEADERX-DIVISION = 'X'.
        WA_HEADER-PURCH_NO_C = T_UPLOAD-BSTKD.
        WA_HEADERX-PURCH_NO_C = 'X'.
        WA_HEADERX-UPDATEFLAG = 'I'.
        UNPACK T_UPLOAD-KUNNR TO T_UPLOAD-KUNNR.
        T_PARTNER-PARTN_ROLE = 'AG'.
        T_PARTNER-PARTN_NUMB = T_UPLOAD-KUNNR.
        APPEND T_PARTNER.
        CLEAR T_PARTNER.
    T_ITEMS-ITM_NUMBER = CNT.
            T_ITEMS-MATERIAL = <MAT>.
            T_ITEMS-TARGET_QTY = <QTY>.
            T_ITEMSX-ITM_NUMBER = 'X'.
            T_ITEMSX-MATERIAL = 'X'.
            T_ITEMSX-TARGET_QTY = 'X'.
            T_SCHEDULES_IN-ITM_NUMBER = CNT.
            T_SCHEDULES_IN-SCHED_LINE = CNT1.
            T_SCHEDULES_IN-REQ_QTY    = <QTY>.
            T_SCHEDULES_INX-ITM_NUMBER  = CNT.
            T_SCHEDULES_INX-SCHED_LINE  = CNT1.
            T_SCHEDULES_INX-UPDATEFLAG  = 'X'.
            T_SCHEDULES_INX-REQ_QTY     = 'X'.
    ALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
          EXPORTING
            SALES_HEADER_IN     = WA_HEADER
            SALES_HEADER_INX    = WA_HEADERX
          IMPORTING
            SALESDOCUMENT_EX    = W_VBELN
          TABLES
            RETURN              = T_RETURN
            SALES_ITEMS_IN      = T_ITEMS
            SALES_ITEMS_INX     = T_ITEMSX
            SALES_PARTNERS      = T_PARTNER
            SALES_SCHEDULES_IN  = T_SCHEDULES_IN
            SALES_SCHEDULES_INX = T_SCHEDULES_INX.
    I am getting the following error
    No item category available (Table T184 ZORT NORM  TAPA)
    I understand Material Determination is not happening.
    Could you please help me in this issue ?
    Regards,
    Prem

    Hi,
    In SPRO-> Sales and distributuin-> Sales-> sales documents-> sales doc item -> assign item category.
    In your case, for ZORT document type , and NORM item category group, TAPA item category is not assigned. make an entry with this combination.
    Regards,

  • How to pass header text in bapi for sale order

    hai to all
    i am using BAPI_SALESORDER_CREATEFROMDAT2 to create sale order
    i can find order_text in tables parameters for creating item texts
    but in my senario i have to maintain header text
    please advice me how to proceed
    rgds
    vijay

    Hi Vijay,
    As I mentioned <b>it is very much possible to create sales order header text with this BAPI only</b>.
    Just check out following working code:
    REPORT yab_testso .
    DATA: orderheaderin LIKE bapisdhd1,
    orderitem TYPE TABLE OF bapisditm,
    wa_orderitem TYPE bapisditm,
    orderitemx TYPE TABLE OF bapisditmx,
    wa_orderitemx TYPE bapisditmx,
    orderpart TYPE TABLE OF bapiparnr,
    wa_orderpartner TYPE bapiparnr,
    ordertext TYPE TABLE OF bapisdtext,
    wa_text TYPE bapisdtext,
    orderret TYPE TABLE OF bapiret2,
    wa_ret TYPE bapiret2,
    lv_lines type i.
    orderheaderin-doc_type = 'ZZOR'.
    orderheaderin-sales_org = 'SS01'.
    orderheaderin-distr_chan = 'SH'.
    orderheaderin-division = 'ST'.
    wa_orderpartner-partn_role = 'SP'.
    wa_orderpartner-partn_numb = '1000000342'.
    APPEND wa_orderpartner TO orderpart.
    wa_orderpartner-partn_role = 'WE'.
    wa_orderpartner-partn_numb = '1000000342'.
    APPEND wa_orderpartner TO orderpart.
    wa_orderitem-itm_number = '10'.
    wa_orderitem-material = '000000111000000185'.
    wa_orderitem-target_qty = '10'.
    APPEND wa_orderitem TO orderitem.
    wa_text-text_id = '0012'.
    wa_text-langu = 'E'.
    wa_text-text_line = 'Test for text creation'.
    APPEND wa_text TO ordertext.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
      SALESDOCUMENTIN               =
        order_header_in               = orderheaderin
      ORDER_HEADER_INX              =
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
    IMPORTING
      SALESDOCUMENT                 =
      TABLES
       return                        = orderret
       order_items_in                =  orderitem
      ORDER_ITEMS_INX               =
        order_partners                = orderpart
      ORDER_SCHEDULES_IN            =
      ORDER_SCHEDULES_INX           =
      ORDER_CONDITIONS_IN           =
      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                    =  ordertext
      ORDER_KEYS                    =
      EXTENSIONIN                   =
      PARTNERADDRESSES              =
    describe table orderret lines lv_lines.
    READ TABLE orderret into wa_ret index lv_lines.
    IF wa_ret-type = 'S'.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      WRITE: / wa_ret-message_v2.
    ENDIF.
    Hope it helps.
    Regards,
    Akshay Bhagwat
    Note: Pls reward points if this helps you.

Maybe you are looking for

  • How to get the itunes 7.4.1 work from my computer?

    Hi: I just bought an Ipod, and installed the itunes 7.4.1. But I found the Itunes cannot run from my Windows XP, it simply doesnot appear the Itunes window after I launch it, on the other hand the Itunes.exe appears in the Windows Task Manager, and i

  • Weird problem with strobe light footage

    Hey all, I've been shooting a music video with a Sony HDR-SR1 (AVCHD) where the lighting was all strobe lights. The video plays back fine through the camera, but when imported into FCE @ 1080i (both 50 and 60hz) i get this weird oscillating black 'bl

  • Masters related to SAP

    Hello Professionals, I'm looking to pursue my Masters degree (MSc) preferably in courses related to SAP. What I'm looking for is which course should I opt for, MIS or is there any other course related to SAP? Where should I go for doing my MSc degree

  • Limit shopping carts in extended classic scenario

    How can we implement limit shopping carts in extended classic scenario. Has anyone done it? Thanks in advance

  • "Font.properties not found" error when runInstaller in Suse 7.3 + 9iDB_R2

    when I try to install 9iDB_R2 in Suse 7.3, the runInstaller have this error: " Font specified in font.properties not found [--Symbol -medium -r-normal--*-%d-*-*-p-*-adobe-fontspecific] " the [Next] button in the installer does not response, but the [