Bapi for Sales Order (VA02) change

Hi frnds,
i want to update one field of items in sales order. i understood that BAPI_SALESORDER_CHANGE is right bapi for that. but i dont know how to start this. remember i have to update this thru one report. i mean after executing the report i am displaying the values in ALV report. in that ALV report i am mentioning which sale order items to be changed.
now my doubt after getting the values in internal table how to call that BAPI and what all are should be maintained. if any one have done this or similar to this like calling Stanadard BAPI please send me code to [email protected]
hope it is clear.
Regards,
Balu

See this example.
*& Report  ZTEST1
REPORT  ZTEST1
        NO STANDARD PAGE HEADING
        LINE-SIZE  132
        LINE-COUNT 65(0)
        MESSAGE-ID ZZ.
TABLES: VBAP.
DATA: V_VBELN LIKE VBAP-VBELN.
DATA: ORDERHEADERINX LIKE BAPISDH1X.
*DATA: ORDERHEADERIN LIKE BAPISDH1.
*DATA: BEGIN OF ORDERITEMIN OCCURS 0.
*        INCLUDE STRUCTURE BAPISDITM.
*DATA: END OF ORDERITEMIN.
*DATA: BEGIN OF ORDERITEMINX OCCURS 0.
*        INCLUDE STRUCTURE BAPISDITMX.
*DATA: END OF ORDERITEMINX.
DATA: BEGIN OF IT_EXTENSIONIN OCCURS 0.
        INCLUDE STRUCTURE BAPIPAREX.
DATA: END OF IT_EXTENSIONIN.
DATA: BEGIN OF RETURN OCCURS 0.
        INCLUDE STRUCTURE BAPIRET2.
DATA: END OF RETURN.
DATA: BEGIN OF BAPIRETURN OCCURS 0.
        INCLUDE STRUCTURE BAPIRET2.
DATA: END OF BAPIRETURN.
DATA:      l_zavbak          TYPE bape_vbak,
      l_zavbakx         TYPE bape_vbakx.
* POPULATE BAPI DATA AND RUN BAPI
*  CLEAR: ORDERHEADERINX, ORDERITEMIN, ORDERITEMINX,
*         RETURN, BAPIRETURN.
*  REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
V_VBELN = '0000000153'.
ORDERHEADERINX-UPDATEFLAG = 'U'.
*ORDERHEADERIN-
IT_EXTENSIONIN-STRUCTURE = 'BAPE_VBAK'.
  l_zavbak-vbeln         = V_VBELN.
  l_zavbak-zzplant       = '0020'.
IT_EXTENSIONIN-valuepart1 = l_zavbak.
APPEND IT_EXTENSIONIN.
IT_EXTENSIONIN-STRUCTURE = 'BAPE_VBAKX'.
  l_zavbakx-vbeln         = V_VBELN.
  l_zavbakx-zzplant       = 'X'.
IT_EXTENSIONIN-valuepart1 = l_zavbakx.
APPEND IT_EXTENSIONIN.
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
           EXPORTING
                SALESDOCUMENT    = V_VBELN
*                ORDER_HEADER_IN = ORDERHEADERIN
                ORDER_HEADER_INX = ORDERHEADERINX
                 behave_when_error = 'P'
           TABLES
                RETURN           = RETURN
*                ORDER_ITEM_IN    = ORDERITEMIN
*                ORDER_ITEM_INX   = ORDERITEMINX
                EXTENSIONIN = IT_EXTENSIONIN.
      LOOP AT RETURN.
        WRITE: / RETURN-TYPE, RETURN-ID, RETURN-NUMBER, RETURN-MESSAGE,
        RETURN-LOG_NO, RETURN-LOG_MSG_NO, RETURN-MESSAGE_V1, RETURN-MESSAGE_V2,
        RETURN-MESSAGE_V3, RETURN-MESSAGE_V4.
      ENDLOOP.
      Write: / 'BEFORE COMMITT'.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
                WAIT   = '1'
           IMPORTING
                RETURN = BAPIRETURN.
      Write: / 'AFTER COMMITT'.
            LOOP AT RETURN.
        WRITE: / RETURN-TYPE, RETURN-ID, RETURN-NUMBER, RETURN-MESSAGE,
        RETURN-LOG_NO, RETURN-LOG_MSG_NO, RETURN-MESSAGE_V1, RETURN-MESSAGE_V2,
        RETURN-MESSAGE_V3, RETURN-MESSAGE_V4.
      ENDLOOP.
** WRITE OUT RETURN
      LOOP AT BAPIRETURN.
        WRITE: / BAPIRETURN-TYPE, BAPIRETURN-ID, BAPIRETURN-NUMBER, BAPIRETURN-MESSAGE,
        BAPIRETURN-LOG_NO, BAPIRETURN-LOG_MSG_NO, BAPIRETURN-MESSAGE_V1, BAPIRETURN-MESSAGE_V2,
        BAPIRETURN-MESSAGE_V3, BAPIRETURN-MESSAGE_V4.
      ENDLOOP.
**      WRITE: / BAPIRETURN.

Similar Messages

  • 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..

  • BAPI for Sales Orders items

    I'm looking for BAPI, which returns all items for sales order.
    Returned items must have included all information, which we can see in transaction va02 on card Item Overview
    I'll reward with points for good BAPI.
    BR Tomek

    In the i_bapi_view structure, populate which tables you would like to have returned by using a value of X.
    Use the sales documents table to pass which documents you want information on.
    So if you wanted item details:
    i_bapi_view-item       = 'X'.
    sales_documents-vbeln = '0000012345'.
    append sales_documents.
          call function 'BAPISDORDER_GETDETAILEDLIST'
               exporting
                    i_bapi_view         = i_bapi_view
               tables
                    sales_documents     = sales_documents
                    order_items_out     = order_items_out.

  • 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

  • BAPI for Sales Order & Production Order

    Hi Experts,
    1)i need to Identify standard  BAPI's for Sales Order & Production Order.ie for one BAPI need both sales order and production order.
    2)i need to Identify standard BAPI to return delivery number and shipment number for a particular Sale Order. If any one give me answer thanks for advance. it's really helpful for my project.
    thanks and regards,
    bala.

    Hi Bala
    Kindly do not open duplicate threads for the same topic. Help to close one thread and continue with the other to avoid confusion.
    Kind Regards
    Eswar

  • Function module/ Bapi for Sales order change

    Hi Experts,
    I require to have a Bapi/ function module to change a existing sales order to insert value in the field VBAP-SOBKZ.
    Please suggest.
    Thanks,
    Shibaji.

    HI,
    I have identified this Bapi but this Bapi does not contain the relevant field to update. Can you suggest any other Function module/ Bapi to update the field.
    Thanks & Regards,
    Shibaji

  • Bapi for sales order change

    Hi ,
    Iam using BAPI_SALESORDER_CHANGE  in order to change the material and  to change the customer with new customer .so what are the input fields that i should enter?
    thanks & Regards,
    Gangadhar.

    Hi Sathish,
    Check this code,
    REPORT  Z_SALES_ORDER_CHANGE
            NO STANDARD PAGE HEADING
            LINE-SIZE  132
            LINE-COUNT 65(0)
            MESSAGE-ID ZZ.
    TABLES: VBAP.
    DATA:
    V_FILEIN(90)   TYPE C,
    V_RECIN        TYPE I,
    V_RECVBAP      TYPE I,
    V_RECORDER     TYPE I,
    V_VBELN        LIKE VBAP-VBELN,
    ORDERHEADERINX LIKE BAPISDH1X.
    DATA: BEGIN OF I_ORDERS OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    BRGEW(18) TYPE C,
    VOLUM(18) TYPE C,
    END OF I_ORDERS.
    DATA: BEGIN OF I_OUTPUT OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    GEWEI LIKE VBAP-GEWEI,
    BRGEW LIKE VBAP-BRGEW,
    VOLUM LIKE VBAP-VOLUM,
    CKWGT TYPE C,
    CKVOL TYPE C,
    END OF I_OUTPUT.
    DATA: BEGIN OF ORDERITEMIN OCCURS 0.
            INCLUDE STRUCTURE BAPISDITM.
    DATA: END OF ORDERITEMIN.
    DATA: BEGIN OF ORDERITEMINX OCCURS 0.
            INCLUDE STRUCTURE BAPISDITMX.
    DATA: END OF ORDERITEMINX.
    DATA: BEGIN OF RETURN OCCURS 0.
            INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF RETURN.
    DATA: BEGIN OF BAPIRETURN OCCURS 0.
            INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF BAPIRETURN.
    PARAMETERS:
    P_PATH(45) TYPE C DEFAULT '/usr/users/ftpsapom/' LOWER CASE,
    P_FNAME(32) TYPE C DEFAULT '/sweetjo.txt' LOWER CASE.
    START-OF-SELECTION.
    CONCATENATE PATH AND FILE NAME INTO ONE VARIABLE
      CONCATENATE P_PATH P_FNAME INTO V_FILEIN.
    OPEN DATASET
      IF V_FILEIN IS INITIAL.
        MESSAGE E002 WITH 'FILE' V_FILEIN 'DOES NOT CONTAIN ANY DATA!'.
      ELSE.
        OPEN DATASET V_FILEIN
             FOR INPUT
             IN TEXT MODE.
        IF SY-SUBRC = 0.
    READ DATASET
          DO.
            READ DATASET V_FILEIN INTO I_ORDERS.
            IF SY-SUBRC = 0.
              APPEND I_ORDERS.
            ELSE.
              EXIT.
            ENDIF.
          ENDDO.
    CLOSE DATASET
          CLOSE DATASET V_FILEIN.
          IF SY-SUBRC <> 0.
            MESSAGE E002 WITH 'ERROR - CLOSING' V_FILEIN.
          ENDIF.
        ELSE.
          MESSAGE E002 WITH 'ERROR - COULD NOT OPEN' V_FILEIN.
        ENDIF.
      ENDIF.
    SORT AND REMOVE DUPLICATES FROM I_ORDERS
      SORT I_ORDERS BY VBELN POSNR.
      DELETE ADJACENT DUPLICATES FROM I_ORDERS.
    POPULATE I_OUTPUT
      LOOP AT I_ORDERS.
        SHIFT I_ORDERS-POSNR LEFT  DELETING LEADING SPACE.
        CONCATENATE '0' I_ORDERS-POSNR INTO I_ORDERS-POSNR.
        SELECT SINGLE BRGEW VOLUM
        FROM VBAP
        INTO (VBAP-BRGEW, VBAP-VOLUM)
        WHERE VBELN = I_ORDERS-VBELN
          AND POSNR = I_ORDERS-POSNR.
        IF SY-SUBRC = 0.
          IF VBAP-BRGEW = 0.
            I_OUTPUT-CKWGT = 'X'.
          ENDIF.
          IF VBAP-VOLUM = 0.
            I_OUTPUT-CKVOL = 'X'.
          ENDIF.
          I_OUTPUT-VBELN = I_ORDERS-VBELN.
          I_OUTPUT-POSNR = I_ORDERS-POSNR.
        I_OUTPUT-GEWEI = 'ST'.
          I_OUTPUT-BRGEW = I_ORDERS-BRGEW.
          I_OUTPUT-VOLUM = I_ORDERS-VOLUM.
          APPEND I_OUTPUT.
          CLEAR: I_OUTPUT.
        ENDIF.
        V_RECIN = V_RECIN + 1.
      ENDLOOP.
    POPULATE BAPI DATA AND RUN BAPI
      CLEAR: ORDERHEADERINX, ORDERITEMIN, ORDERITEMINX,
             RETURN, BAPIRETURN.
      REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
      ORDERHEADERINX-UPDATEFLAG = 'U'.
      LOOP AT I_OUTPUT WHERE CKWGT = 'X' OR CKVOL = 'X'.
        V_RECVBAP = V_RECVBAP + 1.
        IF I_OUTPUT-VBELN <> V_VBELN AND SY-TABIX <> 1.
          V_RECORDER = V_RECORDER + 1.
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
               EXPORTING
                    SALESDOCUMENT    = V_VBELN
                    ORDER_HEADER_INX = ORDERHEADERINX
               TABLES
                    RETURN           = RETURN
                    ORDER_ITEM_IN    = ORDERITEMIN
                    ORDER_ITEM_INX   = ORDERITEMINX.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
               EXPORTING
                    WAIT   = 'X'
               IMPORTING
                    RETURN = BAPIRETURN.
    WRITE OUT RETURN
          LOOP AT RETURN.
            WRITE: / RETURN.
          ENDLOOP.
          WRITE: / BAPIRETURN.
          SKIP.
          CLEAR: ORDERITEMIN, ORDERITEMINX,
                 RETURN, BAPIRETURN.
          REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
        ENDIF.
        ORDERITEMIN-ITM_NUMBER = I_OUTPUT-POSNR.
      ORDERITEMIN-UNTOF_WGHT = I_OUTPUT-GEWEI.
        IF NOT I_OUTPUT-CKWGT IS INITIAL.
          ORDERITEMIN-GROSS_WGHT = I_OUTPUT-BRGEW.
          ORDERITEMINX-GROSS_WGHT = 'X'.
        ENDIF.
        IF NOT I_OUTPUT-CKVOL IS INITIAL.
          ORDERITEMIN-VOLUME = I_OUTPUT-VOLUM.
          ORDERITEMINX-VOLUME = 'X'.
        ENDIF.
        APPEND ORDERITEMIN.
        ORDERITEMINX-ITM_NUMBER = I_OUTPUT-POSNR.
      ORDERITEMINX-UNTOF_WGHT = 'X'.
        ORDERITEMINX-UPDATEFLAG = 'U'.
        APPEND ORDERITEMINX.
        V_VBELN = I_OUTPUT-VBELN.
      ENDLOOP.
    RUN BAPI ON LAST ORDER
      IF NOT ORDERITEMIN IS INITIAL.
        V_RECORDER = V_RECORDER + 1.
        CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
             EXPORTING
                  SALESDOCUMENT    = V_VBELN
                  ORDER_HEADER_INX = ORDERHEADERINX
             TABLES
                  RETURN           = RETURN
                  ORDER_ITEM_IN    = ORDERITEMIN
                  ORDER_ITEM_INX   = ORDERITEMINX.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
             EXPORTING
                  WAIT   = 'X'
             IMPORTING
                  RETURN = BAPIRETURN.
    WRITE OUT RETURN
        LOOP AT RETURN.
          WRITE: / RETURN.
        ENDLOOP.
        WRITE: / BAPIRETURN.
        SKIP.
      ENDIF.
    WRITE OUT RECORD COUNT FROM FILE
      WRITE: / 'RECORD COUNT FROM FILE ', V_RECIN.
      SKIP.
    WRITE OUT RECORD COUNT FROM FILE
      WRITE: / 'RECORD COUNT OF LINES TO CHANGE ', V_RECVBAP.
      SKIP.
    WRITE OUT RECORD COUNT FROM FILE
      WRITE: / 'RECORD COUNT OF ORDERS TO CHANGE ', V_RECORDER.
      SKIP.
    TOP OF PAGE
    TOP-OF-PAGE.
      WRITE:/1(5)    TEXT-H01,    6(8) SY-DATUM MM/DD/YY,
            100(8)   TEXT-H02,  126(8) SY-PAGNO.
      WRITE:/1(5)    TEXT-H03,    6(8) SY-UZEIT USING EDIT MASK '__:__:__',
            20(77)   TEXT-H04,
           100(8)    TEXT-H05, 108(25) SY-REPID.
      WRITE:/1(6)    TEXT-H06,   8(12) SY-UNAME,
            20(4)    TEXT-H07,  25(32) SY-HOST,
           100(13)   TEXT-H08,  121(8) SY-SYSID,
           129 '/',             130(3) SY-MANDT.
      ULINE.
      SKIP.
    Good Luck and thanks
    AK

  • 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 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 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

  • User exit for sale order qty change

    Hi all,
    In our industry we are creating Sale Order for MTO Scenario by using T.Code VA01 . Most of the time after taking the MRP run and raising PO for BOM components, Users are changing the qty in the sale order . eg. and due to that it is becoming difficult to make necessary change in production programe. .Now please give me solution/ userexit  so that anybody cannot change the sale  order qty and it must be check the authorised userid to do necessary change in sale order.
    I am waiting for your valuable suggestion.
    Thanks & Regards

    Hi LIMAYE,
      You can use user exit include 'MV45AFZZ'.
    Make necessary changes in FORM USEREXIT_MOVE_FIELD_TO_VBAP.
    XVBAP will contain the old values before making the changes. You can comapare the quantity wtih VBAP field.

  • 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,

  • RG BAPI FOR SALE ORDER

    HAI TO ALL
    CAN I KNOW WHERE TO PASS THIS SHIP-TO PARTY AND SOLD-TO PARTY IN BAPI_SALESORDER_CREATEFROMDAT2
    SIMILARLY I HAVE TO PASS PARTNER DETAILS IN HEADER DOCUMENT DETAILS IN WHICH PARAMETER I HAVE TO PASS
    PLEASE ADVICE ME ASAP
    REGARDS
    VIJAY

    <b>Notes
    1. Mandatory entries:
    ORDER_HEADER_IN : DOC_TYPE     Sales document type
                       SALES_ORG    Sales organization
                       DISTR_CHAN   Distribution channel
                       DIVISION     Division
    ORDER_PARTNERS..: PARTN_ROLE   Partner role, SP sold-to party
                       PARTN_NUMB   Customer number
    ORDER_ITEMS_IN..: MATERIAL     Material number
    2. Ship-to party:
    If no ship-to party is entered, use the following: Ship-to party =
    sold-to party.
    3. Commit control:
    The BAPI does not have a database commit. This means that the relevant application must leave the commit, in order that can be carried out on on the database. The BAPI BAPI_TRANSACTION_COMMIT is available for this.
    4. German key words:
    The following key words must be entered in German, independantly of
    the logon language:
    DOC_TYPE     Sales document type, for example: TA for standard order
    PARTN_ROLE   Partner role, for example: WE for ship-to party
    Further Information
    You can find further information in the OSS. The note 93091 contains general information on the BAPIs in SD.</b>
    regards
    Prabhu

  • 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

  • In Finder I have many images

    I have 10,000 images & documents(if you click on the finder icon & go to images or documents) on my computer - my question is:  can I delete these? Some I do not know how they got there. Or do I just leave them alone.  Some of the documents are gobel

  • Adobe RGB Monitor Problem

    I own a dell 2408wfp monitor that works with adobe rgb. photoshop seems to realize that and automatically adjusts the preview colors of srgb images so that it "matches" the srgb color settings. when exporting the image and previewing them in a browse

  • Uploading pp data to sap

    hi you all, i need to upload a csv file to the sap in the pp module. i wanted to know what is the best way to do it using java rfc conector or creating an abap program. i wanted to use the rfc BAPI_REFSETOFOPERATIONS_CREATE... can any one tell me wha

  • What needs to be done to rebuild a current Sharepoint 2010 Server farm to work as a Sharepoint 2013 Server farm?

    Hello Community     Currently I have a Sharepoint 2010 Server farm.     One server contains the database and DNS server because it is the the domain controller.     The other server Contains the Sharepoint 2010 Server software and is the the applicat

  • Setting the Author and Modified Time of Files and Folders via 2013 Rest

    Hi We've got an 3-legged-oAuth, `permissions on the fly` app that interacts with Sharepoint via the Rest AP. We're running into some hurdles preserving ownership and modification metadata on files migrated into the system.  With Sharepoint, the typic