Sales order change through bapi

iam uploading va02 changes through bapi..but its not changing the sales order
details in bapi_change function module item number its taking as zero. plz can any one
say where iam going wrong.this is my code
*______BAPI STRUCTURES
data : bapi_header type BAPISDH1 occurs 0 with header line,
       bapi_item type BAPISDITM occurs 0 with header line,
       bapi_header_x like BAPISDH1X occurs 0 with header line,
       bapi_item_x type BAPISDITMX occurs 0 with header line,
     it_return type BAPIRET2 occurs 0 with header line.
data: v_vbeln like BAPIVBELN-VBELN,
      v_bstkd like bapisdh1-purch_no_c,
      v_zterm like bapisdh1-pmnttrms,
      v_inco1 like bapisdh1-incoterms1,
      v_inco2 like bapisdh1-incoterms2,
      v_arktx like  bapisditm-short_text,
      v_koe1n like  bapisditm-currency.
*_____ Internal to hold the records in the text file
DATA : BEGIN OF it_header OCCURS 100,
  VBELN(10) ,
  BSTKD(35) ,
  ZTERM(4) ,
  INCO1(3) ,
  INCO2(28) ,
  POSNR(6) ,
  matnr(18) ,
  ARKTX(40) ,
END OF it_header.
*_____ Internal table to hold excel file data
DATA : it_intern TYPE alsmex_tabline OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK scr1 WITH FRAME TITLE text-111.
PARAMETER : p_file TYPE rlgrap-filename OBLIGATORY .
*paRAMETERS : p_header TYPE i DEFAULT 0.
parameters :  p_begcol TYPE i DEFAULT 1 NO-DISPLAY,
             p_begrow TYPE i DEFAULT 1 NO-DISPLAY,
             p_endcol TYPE i DEFAULT 100 NO-DISPLAY,
             p_endrow TYPE i DEFAULT 32000 NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK scr1.
___________START-OF-SELECTION________________
START-OF-SELECTION.
PERFORM convert_xls_itab. "to convert excel data into internal table
___________END-OF-SELECTION________________
END-OF-SELECTION.
*&      Form  convert_xls_itab
      text
-->  p1        text
<--  p2        text
FORM convert_xls_itab .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  EXPORTING
   filename    = p_file
      i_begin_col = p_begcol
      i_begin_row = p_begrow
      i_end_col   = p_endcol
      i_end_row   = p_endrow
    TABLES
      intern      = it_intern.
EXCEPTIONS
  INCONSISTENT_PARAMETERS       = 1
  UPLOAD_OLE                    = 2
  OTHERS                        = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM move_data. " to move the data into an internal table
ENDFORM.                    " convert_xls_itab
___________END-OF-SELECTION________________
END-OF-SELECTION.
PERFORM upload_so.   "to upload salesorder changes
*&      Form  upload_so
      text
-->  p1        text
<--  p2        text
*&      Form  move_data
      text
-->  p1        text
<--  p2        text
FORM move_data .
  DATA : lv_index TYPE i.
  FIELD-SYMBOLS <fs>.
  SORT it_intern BY row col.  "Sorting Internal Table
  CLEAR it_intern.
  LOOP AT it_intern.
    MOVE it_intern-col TO lv_index.
    ASSIGN COMPONENT lv_index OF STRUCTURE it_header TO <fs>. " assigning each record to internal table row
    MOVE it_intern-value TO <fs>.
    AT END OF row.
      APPEND it_header.
      CLEAR it_header.
    ENDAT.
  ENDLOOP.
ENDFORM.                    " MOVE_DATA
                   " move_data
*&      Form  upload_so
      text
-->  p1        text
<--  p2        text
FORM upload_so .
LOOP AT it_header.
Header
   v_vbeln            = it_header-VBELN.
   bapi_header-purch_no_c  = it_header-BSTKD.
   bapi_header-pmnttrms    = it_header-ZTERM.
   bapi_header-incoterms1  = it_header-INCO1.
   bapi_header-incoterms2  = it_header-INCO2.
APPEND BAPI_header.
    bapi_header_x-updateflag = 'U'.
   bapi_header_x-purch_no_c  = 'X'.
   bapi_header_x-pmnttrms    = 'X'.
   bapi_header_x-incoterms1  = 'X'.
   bapi_header_x-incoterms2  = 'X'.
APPEND BAPI_header_x.
item
   REFRESH BAPI_item.
    bapi_item-ITM_NUMBER = it_header-POSNR.
    bapi_item-material =  it_header-matnr.
    bapi_item-short_text = it_header-arktx.
   bapi_item-currency   = it_item-koein.
    APPEND BAPI_item.
bapi_item_x-updateflag = 'U'.
    bapi_item_x-ITM_NUMBER = it_header-POSNR.
    bapi_item_x-MATERIAL = 'X'.
    bapi_item_x-short_text = 'X'.
   bapi_item_x-currency   = 'X'.
    APPEND  bapi_item_x.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = V_VBELN
     IMPORTING
       OUTPUT        = V_VBELN.
BAPI to change sales order
                   CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
                     EXPORTING
                       SALESDOCUMENT               = v_vbeln
                    ORDER_HEADER_IN             = bapi_header
                       ORDER_HEADER_INX            = bapi_header_x
                     SIMULATION                  =
                     BEHAVE_WHEN_ERROR           = ' '
                     INT_NUMBER_ASSIGNMENT       = ' '
                     LOGIC_SWITCH                =
                     NO_STATUS_BUF_INIT          = ' '
                     TABLES
                       RETURN                      = it_return
                    ORDER_ITEM_IN               = bapi_item
                    ORDER_ITEM_INX              = bapi_item_x
                     PARTNERS                    =
                     PARTNERCHANGES              =
                     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                 =
COMMIT WORK.
ENDLOOP.
  IF IT_return-type = 'E'.
      WRITE: / 'Error :', IT_return-message, / 'for VBELN:',it_HEADER-VBELN.
    ELSEIF IT_return-type = 'S'.
      WRITE: / 'Successfully CHANGED', it_HEADER-VBELN.
    ENDIF.
ENDFORM.                    " upload_so
thanks

hi
You can use ORDER_ITEMS_IN. For further details use the documentation of the function module.This must help you in your requirement.
regards
Aakash Banga

Similar Messages

  • Sales order uploading through bapi

    hi
    i want to upload sales order to bapi pls give the code and i also error handling through bapi
    regards
    A.K

    Hi Awadhesh,
    pls look at this link you will get a clear idea and the code.
    http://abaplovers.blogspot.com/2008/02/bapi-sales-order-create-code.html
    Happy to help you.
    Regards,
    Viveks

  • Problem in sales order change via BAPI

    We are in AFS system and we try to reduce a quantity in sales order via BAPI.
    We recive back an error 8w 280. We are not able to find wich is and where is a problem.
    Does anyone have experince on that problem/error message
    Thanks in advance
    Andrea

    Hi Andrea,
    Since BAPI invloves more programming stuff, I adivce you to post this thread in the ABAP forums also.
    Regards,
    Senthilkumar SD

  • Sales Order Punching Through Bapi

    Hi Experts, I have got an assignment of doing Salesorder punching in portal and through web dynpro.
    I have used BAPI_SALESORDER_GETLIST through RFC connection. But can you tell me what diffrent Bapi's will be required for my task and where relevant documents can be found so that it may help to insert values in R/#

    answered

  • Regarding Sales order Copy Through BAPI

    HI SAP Gurus,
    My requirement is to create a new SO from existing SO.
    I have tried BAPI_SALESDOCUMENT_COPY by passing SO No. and Doc. Type, It is working fine, but the header details like PO Number, PO Date and Shp.Mode. (In Shipping Tab)are not appearing in the newly created SO.
    Is there any other BAPI to copy an existing SO,
    Please suggest,
    Regards,
    Pavan.

    hi
    You can use ORDER_ITEMS_IN. For further details use the documentation of the function module.This must help you in your requirement.
    regards
    Aakash Banga

  • Updating a child of a BOM material using bapi sales order change

    Hi, Appreciate your thoughts on the following issue..
    We have a batch program which uses a bapi sales order change and updates the plant at the line items of the sales order. when this plant is assigned.. if any of the line item is a BOM item, it explodes and the data from the parent ( like payment terms, fixed val date ) should get copied to the child items same as the parent. This is happening fine if manual mode using va01 and va02 but when plant is updated using bapi the childs are not getting the data from the parent ( which comes through config )...
    Appreciate your inputs and any additional information to be passed to the bapi for the BOM materials to get the same config data as parent to the child when exploded...
    Thanks and will reward helpful answers..

    Hi, Appreciate your thoughts on the following issue..
    We have a batch program which uses a bapi sales order change and updates the plant at the line items of the sales order. when this plant is assigned.. if any of the line item is a BOM item, it explodes and the data from the parent ( like payment terms, fixed val date ) should get copied to the child items same as the parent. This is happening fine if manual mode using va01 and va02 but when plant is updated using bapi the childs are not getting the data from the parent ( which comes through config )...
    Appreciate your inputs and any additional information to be passed to the bapi for the BOM materials to get the same config data as parent to the child when exploded...
    Thanks and will reward helpful answers..

  • Changing Rejected Sales Order Items with BAPI?

    Hi Forum,
    I have the following challenge, would be great if someone of you could help me out. Will help me solve some of my performance problems.
    I have sales orders which are temporary and have 'rejected order items'. Now the requirement is that I have to change the 'rejected order items' (quantity and Delivery dates) based on some XYZ criteria. Now using the BAPI_SALESORDER_CHANGE bapi I have to
    1. first get rid of the 'REJECTION REASON'
    2. Change the order item and then reset the above.
    I tried doing it by populating the order_items internal table with two entries but to my surprise it works once and fails twice!!! I get some errors that are totally irrelated and wierd.
    As for now, I've just adjusted the program(dirtily??) and will be calling the BAPI twice for a change !!!(Huh!)
    Now if anybody knows how to deal with the above problem just drop a few lines, will be of good help to me.
    Thanks and regards,
    ZAM

    Hi Srinivas,
    Thanks for the reply. The rejection reason is set manually, when creating the sales order. I do set the update flag to 'U' and also activating all the X structures. But still it did not work.
    Let me put it very simple. Is it possible to change the rejected order items, through BAPI's? If yes, how?
    Regarding the error messages I will have to change the code again to recreate the messages will let you know as soon as I am finished with some things. But however here are some errors
    Field 'WMENG' cannot be changed, VBEPKOM 000100 0001 ready for input
    Field 'WMENG' cannot be changed, VBEPKOM 000100 0001 ready for input
    Sales document 0030000031 was not changed                           
    there are few others which appear now and then indicating a system error !!
    thanks,
    ZAM

  • Sale Order change BAPI - Storage loc not updated

    Hi Everybody,
    Iam using "BAPI_SALESORDER_CHANGE", to change the sale order items.
    First iam calling above bapi with switch B, for new pricing & then second time for material change.
    When i change any material number, it is getting updated correctly.
    But the storage location, even though iam passing in the bapi it is not updated, & is blank - updation flag is also passed.
    When i execute sale order change again it is updated - ie, for any material change for first bapi call, storage loc is not updated - for 2nd bapi call storage loc is updation - for same input in both the cases.
    Is there any way to update the storage loc is first call of sales order change bapi.
    Below is the parameters iam passing in bapi :
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          SALESDOCUMENT      = LS_SALESDOCUMENT
          ORDER_HEADER_IN    = LT_HEADER_IN
          ORDER_HEADER_INX   = LT_HEADER_X
        TABLES
          RETURN                            = LT_RETURN
          ORDER_ITEM_IN               = LT_ITEMS
          ORDER_ITEM_INX             = LT_ITEM_X
          ORDER_CFGS_REF          = LT_CFGS_REF
          ORDER_CFGS_INST         =  LT_PARTS
          ORDER_CFGS_VALUE     = LT_VALUES
          ORDER_CFGS_BLOB        = LT_CUBLOB
          ORDER_CFGS_VK            = LT_CUVK
          ORDER_CFGS_REFINST   = LT_CUREF
          SCHEDULE_LINES            = LT_SCHEDULE_L
          SCHEDULE_LINESX         = LT_SCHEDULE_X
          ORDER_TEXT                   = LT_TEXT
          CONDITIONS_IN                = LT_CONDITION_L
          CONDITIONS_INX              = LT_CONDITION_X.
    Any help is appreciated.
    Regards,
    Nagarajan.J

    Hi,
    Storage location is updated only when same sale order bapi is called another time with required details.
    rgs,
    Nagarajan J

  • Calling a Sales Order Change BAPI in a Sales Order Exit

    Functional Requirement:
    While creating a Sales Order with Reference to another Sales Order, on saving the new sales order, change something in the referenced sales order.
    I am trying to achieve the same by doing the following:
    In the standard SAP user exit called during saving the new sales order USEREXIT_SAVE_DOCUMENT I am calling the BAPI BAPI_SALESORDER_CHANGE on the referenced Sales Order.
    However the BAPI is unable to change the other sales order giving an error Enter the document number. I am specifying the Document Number while calling the BAPI, so I know that is not the error.
    I just wish to know whether it is technically possible to call a BAPI to update another Sales Order while we are currently saving one Sales Order.

    Hi Girish,
    If it works correctly when run seperately and you are sure the data passed into the BAPI is exactly the same then it may be something like table locks or similar causing your original problems...
    What about packaging up your working Z program into a custom function module and calling that from within USEREXIT_SAVE_DOCUMENT as a seperate task (IN NEW TASK) and building in a slight delay of say 5 seconds at the start of your code?
    I'll be honest, this isn't an ideal solution but might be sufficient to resolve your issues.  I'd be inclined to see if you could just run your Z program as a background process every 5 minutes or so to capture any changes and perform updates but if this is a no no from your functional people I'm not sure what else to suggest sorry.  I've never personally had to update a document from within the save routine of another document so can't give any advice based on my own experiences sorry.
    Gareth.

  • Change only material qunatity in sales order by using BAPI

    Hi All,
    How to change only the material quantity in existing sales order by using BAPI.
    Please help me in this regards.
    Regards
    Deekshitha.

    Hi
    See the sample code and do accordingly
    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.
    Reward points if useful
    Regards
    Anji

  • Extending sales order change BAPI and updating custom fields

    Hi
    i added 3 new fields into VA01/02/03 screen.i added at the header level in the additional data tab B area and appended them in VBAK table.
    i want to change these values using sales order change BAPI.i added the fields in the structure VBAKKOZ,VBAKKOZX,BAPE_VBAK,BAPE_VBAKX.
    may i know what else i need to do?should i move them anywhere with in the code or does the bapi take those values automatically using EXTENSIONIN structure?
    also can some one send me code to actually check if bapi is changing my values?
    if poss tell me how should i populate values into BAPI.

    After adding field in structures VBAKKOZ,VBAKKOZX,BAPE_VBAK,BAPE_VBAKX, create pair of name-value pair extensiot structure and value.
    Fill values as follows :
    Data :   ls_parex  TYPE  bapiparex,
                lt_parex  TYPE STANDARD TABLE OF  bapiparex.
    ls_parex-structure = 'BAPE_VBAK'.
    ls_parex-valuepart1+0(10) = Sales order no
    ls_parex-valuepart1+10(XX) = somevalue.  <---- Value for custom field no 1
    ls_parex-valuepart1+XX(XX) = somevalue.  <---- Value for custom field no 2
    APPEND ls_parex TO lt_parex  .
    clear ls_parex.
    ls_parex-structure = 'BAPE_VBAKX'.
    ls_parex-valuepart1+0(10) = Sales order no
    ls_parex-valuepart1+10(1) = 'X'. <--- checkbox mark for custom field no 1
    ls_parex-valuepart1+11(1) = 'X'. <--- checkbox mark for custom field no 2
    APPEND ls_parex TO lt_parex.
    Same pair for VBAKKOZ & VBAKKOZX
    Updating custom fields
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument    = Sales order number
          order_header_inx = 'U'   <--- U for update
        TABLES
          extensionin      = lt_parex[].
    Edited by: nkarwa on Oct 25, 2010 12:39 PM

  • Credit status change through Sales order - change log

    Hi Friends,
      I'm currently facing a scenario were it was reported by the client that
      credit release is happening automatically.
      Brief details : 
       Order was created on 4th Of Oct and it was blocked (reaches the VKM1 bucket )
       since the customer reaches the credit limit.The same order on 5th Oct was not in VKM1
       bucket were the status of order in Sales document header states that it's  released.
      Initial check : (Sales order change log)
      1, I've checked the change log on 5th Oct were the  field VBUK - CMGST  "Overall status of credit checks changed"  from  B to A.
       ((  Status and details below
          A - Credit check was executed and document is OK.
          B - Credit check was exectued and Document is not OK (credit block).
          C - Credit check was executed document not OK, Partial release.
          D-  Document released by Sales representative. ))
    2, I tried to replicate the order status for block and release, But when I release through  VKM1 / VKM3
         the change logs are getting updated with Status - D .(ie from B to D) .
      I'm  wondering that  what could be the reason that causes the system to update in the table - VBUK  - CMGST from A to B
      or because of what change from the client in the sales document header level could impact this changes.
      Note - There is no payment which received from customer on that day.
      Please let me know in case if you are getting the clue...
      Thanks in Advance..
      - Pugal stalin

    Hi
    A simple credit check, as the name suggests, is very simple in nature. The functionality is limited and considers only open A/R items and open items from special G/L and sales orders for performing the credit checks. When you create/change a sales order that is relevant for a simple credit check, SAP calculates the payer/customeru2019s credit exposure by adding the open A/R balance for the customer, open item balances from the special G/L, and the net sales order value. This credit exposure is then compared against the customer credit limit maintained in the customeru2019s credit master. If the credit exposure is greater than the credit limit, the system sets the credit check status as u201Cfailu201D and shows a warning, generates an error message, or performs a delivery block
    Regards from Pakistan

  • Report for Sales Order Change History   CDPOS and CDHDR

    How to take a report of the data for the Sales Order Change history for a particular period of time. It is required to take a report of all the Sales Orders for which the basic price has been changed. Please let me know the procedure. I could not get the data from the table CDPOS and CDHDR
    Helpful answer would be rewarded.
    Regards
    Praveen

    Dear Praveen Kumar
    Have you tried with VBAP where sale order details at item level would be stored.
    Moreover, to my knowledge, there won't be any changes as for as pricing is concerned at sale order level but there is at billing level.  Normally, any price increase / decrease would reflect in billing.  So why dont you to table join through SQVI VBAP (for sale order details) and VBRP (for billing details) so that you can compare the selling price in sale order with billing. 
    Thanks
    G. Lakshmipathi

  • BAPI_SALESORDER_SIMULATE can be used in case of Sales Order Change?

    Hi All,
    I'm using FM 'BAPI_SALESORDER_CHANGE' to update sales order.
    It's working fine even multiful item (delete, add, changing item).
    But I need to give simulated information to SAP portal before changing Sales order.
    This 'BAPI_SALESORDER_SIMULATE' FM looks like for creating new Sales Order.
    Is there any other simulation BAPI FM for Sales order change?
    Thanks.

    Hi,
    You can use
    BAPI_ORDER_CHANGE_STATUS_GET   Change status for order                                                  
    BAPI_SALESORDER_CHANGE         Sales Order: Change Sales Order                                          
    Thanks
    Sarada

  • Unable to update sales order unsing the BAPI 'BAPI_SALESORDER_CHANGE'

    Hi All,
    I am unable to update the payment method field for some sales orders using the bapi 'BAPI_SALESORDER_CHANGE'. I am getting the reason in the table RETURN as 'Field 'ZLSCH' cannot be changed, VBAPKOM 000050  ready for input'.
    Could anyone throw some light on it.
    Thanks a ton.
    Regards,
    Santosh Kotra.

    Hi
    Without reversing invoice we can't update price and this is standard bevaior which is logical too. For your scenario I am wondering why would you want to change price for a line item or order which is alrady invoiced and posted to FI. What difference would it make to change price in sale order when this has already been posted in FI?
    Thank$

Maybe you are looking for

  • Battery and Icon Issues

    My battery is not holding a charge and shuts down when unplugged from the charger. In addition the icon at the top of the screen shows an X in the battery icon. When placed on percent or time remaining it still only will show the X. The computer is l

  • Mouse runs slow

    Hello, i'm experiencing strange problem with mouse. When i'm listeting to music (i use newest players such as Winamp, Foobar2000, Windows Media Player) and press "pause" button my mouse starts to run slowly (when i moving my pointer it makes gaps, it

  • Sticky load balancing without clustering?

    I don't need any type of session replication. I just want to run two           instances of Weblogic on one machine, one IP, two different ports.           If I run a third instance of Weblogic for proxying on the same machine           on yet anothe

  • How to display with zenity or yad when Pacaur solicits password root

    Hi, I am new using pacaur, and also I am making a shell script with yad.  I need a way to captures with zenity/yad the autentication, when a package comes from AUR, also when comes from official repositories. Example: pacaur -S --noconfirm --noedit t

  • Suddenly WebLogic Server shutting down while doing testing

    Hi All, While we doing testing weblogic server shutting down.Here is the log generated by weblogic. Tue Aug 22 12:38:27 EDT 2000:<E> <ListenThread> Listen failed. Failure count: 1 Tue Aug 22 12:38:27 EDT 2000:<E> <ListenThread> ListenThread:run faile