Determine Sales Order change (ECC6.0 using Enhancement-point)

Hi all,
I want to determine Sales Order change e.g. if any item added to sales order or any item deleted fron sales order and also if Sales Order is deleted .... how can I achive this???
I am using ECC6.0 , in which I am using Include          MV45AFZZ and FORM USEREXIT_SAVE_DOCUMENT to determine change at SAVE. The table XVBAK and structure VBAP is available but from this I am not able to determine the change.
How to do this..?
Regards,
NiLesH.

Hi Nilesh,
Please see USEREXIT_SAVE_DOCUMENT_PREPARE instead of the one you are using in the Include MV45AFZZ.
SAP comments this customer form as:
* This userexit can be used for changes or checks, before
* a document is saved.                                           
* If field T180-TRTYP contents 'H', the document will be  
* created, else it will be changed. This form is called at the
* beginning of form BELEG_SICHERN
For the deletion, try to code your check in the form USEREXIT_DELETE_DOCUMENT in the Include MV45AFZZ provided for the customers.
I feel these would be more suited for your requirement.
Cheers,
Sougata.
You can use tables CDHDR/CDPOS for change documents but on a large scale reporting this would be very slow.
Alternatively, for performance reasons, you can use the form USEREXIT_READ_DOCUMENT to capture the sales order at its original state (in an internal table) then use form USEREXIT_CHECK_VBAP for any changes made while in the sales order create. Then in USEREXIT_SAVE_DOCUMENT, compare the previous and current condition values. If any changes exist, insert a row in a custom table with the change information. At the end you can base your report on your custom table rather than change document tables which will be slow on processing large volume of data.
Note: Go the user-exit way only if you are dealing with high volume of data
Edited by: Sougata Chatterjee on Jan 1, 2008 11:38 PM
Added after considering Ranjith's post

Similar Messages

  • 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

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

  • Addition Item getting added while posting Sales Order Changes - ORDCHG

    Hello,
    I have a requirement to post sales order changes - ORDCHG. Now, when I am adding the qualifier 002 at the item segment E1EDP01 with the existing Item number, it is creating another Item in the sales order rather than changing the existing one. What could be the reason? I am passing the below values in to the respective segments.
    E1EDK01-ACTION = '003' - Changes in one or more items
    E1EDP01-ACTION = '002' Item Changed.
    Please advise.
    Regards,
    Venkata Phani Prasad K

    I encountered the same problem.  As Vinit pointed out, it looks up the line item using field POSEX on VBAP instead of POSNR.  If you want to look up POSNR,  you can implement either user-exit ZXVDBU07 or ZXVDBU09 in IDOC_INPUT_ORDCHG and do the following.
    Loop through YVBAP and modify the internal table to set POSEX to be equal to POSNR.
    This will cause the IDOC to select the correct line item based on POSNR.  The only side-effect is that when the order is updated, it will also update field POSEX on table VBAP.

  • Have to provide a popup when there is a Sales order change(VA02)

    Hello,
    I would like to know how to capture Sales order changes(VA02) through an enhancement. Based upon users changes which can be either a addition or deletion in sales order then I have to provide a popup. I am unable to find out whether Sales order has undergone a change or not. Field r185d-dataloss is alway having 'X' whether data has changed or not. System field SY-DATAR is not capturing any deletion is sales order.
    I am using USEREXIT_SAVE_DOCUMENT_PREPARE but unable to check sales order is changed or not.
    I need to provide popup after user clicks on Save. Tables CDPOS & CDHDR won't have current sales order change.
    Thanks for your replies.
    Edited by: harryibm on Dec 11, 2011 8:07 PM

    I am using USEREXIT_SAVE_DOCUMENT_PREPARE but unable to check sales order is changed or not.
    Donot do any changes and hit save. check if this routine is triggered if you are not changing anything.
    In program MV45AF0B_BELEG_SICHERN there is a condition
    IF R185D-DATALOSS = SPACE       FORCE_UPDATE   = SPACE     AND
           UPD_VBUK IS INITIAL        AND
           UPD_VBUP IS INITIAL.
    The else part will only tirgger if its changed. The routine USEREXIT_SAVE_DOCUMENT_PREPARE is called in the else part.

  • Sale Order changes View

    Dear Guru's
    Is there any T-Code for verifying Sale Order changes (Step wise), as in my company Invoices are generated with lot of changes which not matching with Sale Order conditions. So I would like to moniter the Sale Order conditions changes. Kindly help me out.
    Thanks in advance

    Hi
    Sales order changes can be seen in the report only if the changes are made by any user(userid). If your problem is with changes in pricing conditons...then before comparing the sales orders and invoices, I advise you to check the copy controls and the price type used in the copy controls. If the price type selected is to redetermine the pricing, then you should check the validity of the conditon records. Sometimes, the conditon records may be different during sales order creation and invoice creation.
    Thanks,
    Ravi

  • 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

  • Sales Orders Change Log question

    Hi All,
    I am currently working on a project that involves querying SAP Database to get custom reports via web browser, I've made a lot of advances and most of the site is ready but I'm missing just one item that I hope you could help me.
    Thing is I am working with the Sales Order change log and the problem comes one a user deletes a row. If I go to the change log inside SAP and see the differences a new record will be shown saying that row X was deleted and
    if I go to the database (ADOC and ADO1 tables) I don't have a way to see wich row was deleted.
    My way of doing this is to check for the number of rows on the current state of the sales order and check the same on the previous instance of the SO and see if a line was deleted. Then I would have to check row by row between instances what rows are there and what row is missing and store that info. I think this kind of approach will definitively kill the server.
    I was wondering if some one can give me a hint about how to approach this problem. Does any body know how SAP works on this area?
    I'm working with SAP2005A and SQL Server 2005 Standard Edition.
    Any help is greatly appreciated.
    Thanks!
    Alejandro.-

    Hola Alejandro,
    Thanks for your answer, as I see it I'm doing exactly what you proposed but the problem comes with the following scenarios:
    a.- If I post a new SO with two lines I will have on the ADO1 table two records with the values 0 and 1 for each line respectively but if I delete the item on LineNum = 1 and then I add a new item, this last item will be also created with LineNum value = 1. This is not a complicated thing to do but the problem comes when the user is used to work with SOs with several items at detail level and is used to add and erase lines once in a while and as I see it it's very difficult for me to track those specific changes. There's also the fact that on the Log table a new instance is created every time the user hits the update button regardless if a modification was actually made or not. I mean I would know that a line was deleted or added but I would have to start comparing each field on each line of a sales order with it's previous instance to check what was actually added/deleted and I'm afraid that this may affect the server performance. I know that SAP does this without affecting to much the system resources and that is what I'm trying to find.
    I forgot the other scenario I was considering he he I will post again as soon as I remember it but I hope I'm explaining this ok (I'm not very good at explaining...) If not let me know and I'll try to explain again.
    I'm also working on trying to get another approach to see what comes up...
    Thanks for checking this thread, your answers are helpful.
    Regards.

  • How can we remove an unwanted # in sales order texts created using a bapiFM

    Hi,
    i've written the following code which splits the record fetched from apllication server and moves it into a workarea.
    CONSTANTS:c_sep VALUE cl_abap_char_utilities=>horizontal_tab, "for separation
    SPLIT wa_tab1-rec1 AT c_sep INTO wa_inf_itm-inf_vbeln
                                           wa_inf_itm-itm_number
                                           wa_inf_itm-material
                                           wa_inf_itm-req_qty
                                           wa_inf_itm-uom
                                           wa_inf_itm-amount_pr00
                                           wa_inf_itm-amount_pi02
                                           wa_inf_itm-amount_mwst
                                           wa_inf_itm-amount_vprs
                                           wa_inf_itm-currency
                                           wa_inf_itm-text.
    Here c_sep will have a value '#' instead of 'space' in Flatfile from application server.
    The field 'wa_inf_itm-text' though it doesnot contain any value in debugging, when the sales order is created using FM 'BAPI_SALESORDER_CREATE_FROM_DAT2' the item texts are having a # character at the end of the text if it has any text(when checked in va03--sales order item text) or if it doesnot contain any text ,then also # character is seen in texts.
    Thanks & Regards,
    Prasad Reddy.

    hi
    use
    Replace all occurrence of '#' with space from .......
    I think it will solve ur problem.
    Rewards with point if helpful.
    Regards
    Santosh.

  • Authorization at Sales Order Change (Item level)

    Hello Experts,
    Is there any standard authorization object at sales order for adding new items? As I want to restrict some users to add new item lines at sales order change ( VA02 )
    Regards,
    Amr

    Hello,
    How can I use this object V_VBAK_AAT to disallow users to add
    some item lines from VA02 but users can change any other functions
    at the sales order (e.g. update pricing conditions)?
    As I see on this object V_VBAK_AAT, If I revoked ACTVT = 02 'Change',
    It will revoke all change functions from users.
    I think the best solution for your requirment would be to seek the help of Basis folk to create a new User ID which would be having access to Change mode of Sales Order (VA02). Then you can restrict addition of Material line item with the help of Technical consultant by putting up code in following User exit.The logic in the code will be addition of Material line item will be restricted if the User Name is the newly created one...
    1:- MV45AFZB -- USEREXIT_CHECK_VBAP
    2:- MV45AFZZ -- USEREXIT_MOVE_FIELD_TO_VBAP
    3:- MV45AFZZ -- USEREXIT_SAVE_DOCUMENT_PREPARE
    Regards,
    Sarthak
    PS : On information note, you can refer the t-code SU24 to see the standard authorization object for change mode of Sales Order.

  • Need code for sales order create report using bapi's

    need code for sales order create report using bapi's

    Hi,
    Go through below link
    http://www.saptechies.com/bapi_salesorder_createfromdat2/
    <b>Reward points if it helps,</b>
    Satish

  • Sale Order Changes

    Hai..
    Please tell me the table to find out the history of changes in sale order.
    Thanks.

    You can get  history of sales order changes from CDHDR,CDPOS tables.
    Alternatively you can also use these FM.
    CHANGEDOCUMENT_READ_HEADERS.
    CHANGEDOCUMENT_READ_POSITIONS.

  • EDI Outbound sales order change

    Hello,
        I am triggering an EDI outbond sales order change.
    I am useing ORDCHG and ORDERS05.
    While setting up the Outband Partner profile,In the Message conterol tab
    what is the Application,message function and process code.
    Thanks in advance...

    I am triggering an EDI outbond sales order change.
    I am useing ORDCHG and ORDERS05.
    While setting up the Outband Partner profile,In the Message conterol tab
    what is the Application,message function and process code.
    -The application is V1.
    -You should enter in the Messagetype the Outputtype as used in NACE and the Sales Order Output creation. That can be BA00.
    Make sure you make 2 entries in the partner profile: one where in the messagecontrol tab the change message Tab is ticked (in case the order changes) and one where it is not ticked (initial change).
    -Message functionion can be used optionally, to differentiate to make it unique.
    -The Processcode can be SD10 (or ME02 for PO change). You can use the dropdownbox if there is something configred yet.

  • Sales order details uploading using BAPI method in LSMW

    Hi Guys,
    Sales order details uploading using BAPI in LSMW, could you please suggest me, is any standard method or programs is available for this.
    I have some queries about this.
    1) One header line having multiple line items, in this case  we able to upload use the  LSMW method,
        if possible please tell me the steps.
      2) Do we need to do any config changes while uploading data?     
      3) Flat file should be which format.
      4) Steps to process each step wise if possible.
    Please help me
    Thanks,
    Gourisanakar.

    Hi Gouri Sankar,
    would you be able to upload the sales orders with multiple line items using BAPI LSMW?
    if so could you plz suggest?
    Thanks in advance.
    Suresh/

  • 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

Maybe you are looking for

  • Get back to mac os 10.5.2

    Okay, so I have an iBook G4 12in 1.33 ghz. A few months ago I had installed leopard, but realized that I still needed os 9, so I went back to Tiger (with classic support) a few weeks ago. Today, I no longer needed that app, so looking forward to bein

  • Microsoft Office Files Auto Launch when Application is Opened

    Every time I launch Excel I have several files that auto launch.  I have searched for these files using spotlight and see that these files have somehow gotten saved with the application.  With the open file I go to File>Properties>General Tab it show

  • The curious incident of iMovie 11 and one very unhappy customer.

    I've posted before, my previous discussion: https://discussions.apple.com/message/15057943#15057943 is about the problems I'm currently experiencing with iMovie.  It opens, but is invisible.  I wont repost the screenshots, but in the previous post I

  • TS4337 Why are the colors for my calendar reseting to a color I never chose?

    Why are the colors for my calendar in iCal reseting to a color I never chose?  It won't stay blue when I choose that color and keeps changing to a custom lavendar color on its own....  Incredibly annoying...

  • BI server start/stop services

    Hi, We have OBIEE installed on a unix server. Previoulsy I worked on OBIEE on windows server and would go to services and start/stop services. My question is if we modify the rpd and ftp it to unix server, do we have to stop and start the BI server f