How to change price in Sales order using user exit ?

The scenario is -  when the user creates a sales order,  there has to be an RFC called to another system to get the price of the materials in that system. Then it has to overwrite that price in this S.O.
Which exit in S.O can be used for this and then what processing needs to be done after the RFC call to get price. Like how the price can be overwritten on this S.O ? (Lets say to get price we use some BAPI to the other system).  Any help ?

Dear Theodorous,
1)Please check the Material has been extended to the second plant.
2) Assign the second Plant to Sales Org and Dist Channel
If you have any concern revert back the same
Regards
Amjath

Similar Messages

  • How to ChangePlantfor each item of Sales order using User Exit SAVE_DOCUMEN

    Hi All,
    I have to change plant for Each line item of sales order using (MV45AFZZ) (USEREXIT_SAVE_DOCUMENT) based on first Schedule line.
    if Confirmed Quantity is Less than Ordered Quantity.
    based on first Schedule line.
    it has to select other Plant and need to populate it in line item of sales order.Please see the below code and let me knoe if any changes required... Thanks in Advance.
    data : wa_vbep like xvbep,
           Lv_matnr type mara-matnr,
           lv_werks type marc-werks.
    DATA: it_vbap TYPE STANDARD TABLE OF vbap,
          wa_vbap TYPE vbap.
    field-symbols: <wa_vbap> type VBAPVB.
    clear wa_vbap.
    *loop at xvbap into wa_vbap.
    loop at xvbap assigning <wa_vbap>.
    read table xvbep into wa_vbep with key posnr = <wa_vbap>-posnr.
    if wa_vbep-ETENR = '0001'.
    if sy-subrc = 0.
    IF wa_VBEP-BMENG LT wa_VBEP-WMENG.
        SELECT SINGLE DWERK
                     INTO lv_werks
                     FROM MVKE WHERE matnr = <wa_VBAP>-matnr
                                and  DWERK ne <wa_VBAP>-werks.
    if not Lv_werks is initial.
    if lv_werks EQ 1033.
    move '1002' to <wa_vbap>-werks.
    if sy-subrc eq 0.
      xvbap-werks =  <wa_vbap>-werks.
    modify xvbap from <wa_vbap> .
    endif.
    elseif lv_werks EQ 1003.
    move '1003' to <wa_vbap>-werks.
    elseif lv_werks EQ 1010.
    move '1010' to <wa_vbap>-werks.
    endif.
    endif.
    endif.
    endif.
    endif.
    endloop.
    endif.
    Regards,
    Sudhakar Reddy.A

    You have to use the form routine "USEREXIT_SAVE_DOCUMENT_PREPARE"
    regards
    Vinod

  • How to capture an address change for a sale order in user exit MV45AFZZ?

    Hi ,
    My requirement is to capture the address change in sale order .
    I have to write the code in my own z-include in MV45AFZZ of SAPMV45A.
    Here I have to use VBAP-KUNNR for PARVW = ‘AG’ or ‘WE’. And  ADDR1_DATA.
    Could you please give me idea , how to capture the address change?
    Thanks ,
    Suresh.

    Farshid,
    As I understand it it is the RCS software that replaces the $Revision$ with $Revision: 1.2$. Is that correct?
    There are two things that you need to be aware of if this is the case.
    First, the length of the text fields are saved as part of the SystemBuild model file. This means that when the revision control software replaces the tag the length is no longer correct, and SystemBuild will not be able to load the file correctly. You can still change the text as long as you make sure the the length of the tag stays the same. For example if the version number is a single digit decimal then single digit, then when you create the file you could store the revision as $Revision: x.x$. When the tag gets replaced by the revision control software you would get
    $Revision: 1.2$ which is the same length.
    Next you need to be aware of potential line breaks. When the SystemBuild model is saved as ASCII then line breaks are added at regular intervals, so the tag might be broken up on two lines. This could prevent the revision control software from recognizing the tag. To prevent this save the file as binary.
    In short make sure that the text the revision control software adds is the same length as the text that it replaced and save the files as binary files.
    Carl L
    National Instruments
    www.ni.com/matrixx

  • To add line items to sales order using User exit.

    Hi ,
    I have to add line items to sales order .
    I have tried adding the code in usr exit move field _VBAP // Check VBAP and in savedocument _prepare . But in all the places I dont see it in VA01 . I can see it in the VA02 and VA03 . But I am not able to save the order as they have made the flooring term as mandatory field, and I am supposed to populate the XVBKD structure for this.
    Pls tell me whts the procedure like say , should I popluate the XVBKD / XVBAP / and should i use the bapi_SALES_ITEM_CHECK to populate the structures at the save_document prepare.

    Hi,
    1. It is not possible to delete records using DTW, only importing new records or updating existing ones are supported. These are the only valid operations via DTW.
    2. It is possible to delete the contents of an edit text field by using the character / or -1. However it is not possible to clear an entire row/line using this notation.
    Thanks & Regards,
    Nagarajan

  • Change of open sales order : using BAPI

    Hi
       this  is ravi
                      can any one help me on this  topic
            1)change of open sales order  using BAPI .With appropriate reason( like header level reason)
                       thanks & regards

    hI,
        chk this FM BAPI_SALESORDER_PROXY_UPLOAD how the FM BAPI_SALESORDER_CHANGE was used
    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
    <b>Reward points</b>
    Regards

  • How to Change Division On sales order

    Hii Guy,
    How to change Division on sales order after been save ?
    my user wrongly enter division code while creating sales order. the SO already have PGI and not yet been invoice.

    Best Practice is to go PGR and then cancel Delivery.Then Go to VA02 and change the Division.
    You can customize the Division at Sales Docuement Type by De-Selecting the Check Box of Item Division.It means the division will be copied from the Header Level of Customer Master Data.
    Best Regards,
    Ankur

  • Sales Order Pricing User Exit Problem

    Hi,
    I am facing a problem related to coding in Sales Order pricing user exits. Scenario is as mentioned below:
    Based on Material Entered and Sold To in Sales Order, auto determination of a manual pricing condition happens. For doing this, coding has been done in USEREXIT_PRICING_PREPARE_TKOMP by changing XKOMV table. Auto determination of the manual price is happening properly.
    From Sales Overview Screen when user goes to the Conditions tab, Net Value is not getting calculated. When we navigate away to Schedule line tab and then come back to COnditions tab, Net Value is automatically getting calculated.
    AM i missing something in the coding part? As the data is getting populated automatically I guess some piece of code needs to be triggered. Can anyone shed some light into this.
    Thanks in advance,
    thunderans.

    Prabhu: After filling in XKOMV structure, I am calling FM PRICING. On doing this, the Sales Pricing is getting calculated but even then net value of order at header i.e VBAK-NETWR is not getting populated when we are in Sales Overview screen. When, I am getting into Conditions tab and coming back to Sales Overview screen, Net value is getting populated correctly. This portion of everything not getting populated at the same time is bothering me. The pricing conditon that I am  filling is a manual pricing condition.
    I put a breakpoint after FM PRICING which correctly populates XKOMV structure. How do I properly update Order Net Value in Sales Overview screen wihtout having to navigate to any other tab?
    Nicklas: I am looping at Order line within the user exit USEREXIT_PRICING_PREPARE_TKOMP and determining price. Once all line items are processed, I am using the FM PRICING for calculating Sales Prices.
    J@Y: Request to send me a bit more details into your approach.

  • Change price in Sales Order created with reference with Quote

    Hi Experts,
    Need to change price (eg..1000USD to 1100USD) in sales order (va02). Here Sales Order is created (va01)with reference with Quote(va21) where price in maintained (as 1000USD). so price in Sales Order is copied from Quote. Now, If I want to do the change in Sales Order (from 1000USD to 1100USD) kindly suggest me what are all the possible ways. Can I do the changes within the existing documents rather than creating new docs. due to the change.
    Note: User is creating new Quote with 1100USD and creating subsequent new Sales Order with new Quote.
    Thanks
    Viswanathan

    Hi,
    In va02 you double-click on the material that has been entered, then in the new screen goto the condition tab, here u will find the $1000 that you have entered, and then change it to $1100.
    Swapnil

  • WebUI : Entry Price in Sales Order - not user friendly

    Dear all,
    Have any of you use Sales Order entry on SAP CRM2007 WebUI ?
    I would like to hear comment from you regarding on how you enter the item price in Sales Order module.
    This is what I found, to enter single price for a product you need to go through at least 3 steps after you
    open Sales Order Document.
    1. Select/Enter the Product and Click on Edit for that particular product
    2. System will open next page showing more detail info of that Product
        here you need to click on Price section again
    3. Finally the system will show the page where you can enter the price
    For each of page transition the system may takes 3-7 seconds, so up to around 9-20 seconds user needs
    to spend just to entry a single price in one Item.
    Even worst, if there is more that one product, user have to click on back button couple times to go back
    to main document to click another product to edit. Means another waste of time!
    I like to hear comment from you and if you have better idea on how to simplify this, it will be great!
    Some development effort on WebUI components need to be done I think, appreciate if you can lead
    to more simple way to accommodate this. 
    Thanks,
    Gun.

    Hi Michael,
    Is the configuration of easy condition entry only for IC WebClient?
    Because that is what I found in SPRO for Set Up Easy Condition Enty documentation (at Condition 1
    field).
    Now, my initial question is refer to entry price at Sales Order transaction in Web UI (not IC WebClient).
    I tried to setup Easy Condition Entry,  put my pricing procedure and maintain condition 1.
    and set visible for field Condition 1 Value and Rate in the items table.
    I can see the fields, but I can only see fields can be modified/enter if I have maintained manually the price
    at normal way (click Edit on item line, then click Edit again on Price, then click again to maintain the
    price).
    I applied Notes 1292789, but this even worst, Condition 1, Value 1, Rate 1 cannot be edited.
    Is there any missing prerequisite setting here?
    Have you tried this works on Sales Order entry on Web UI (not IC Webclient) ?
    Appreciate your further information,
    Gun.

  • Creating line item for a sales order in user exit

    Hi
    I have to create a line item through user exit "userexit_save_document_prepare" when saving the sales order.I am doing this by appending a row to the internal table XVBAP in the user exit.
    The row is getting appended to the internal table but the line item is not getting created in the sales order .I dont getting any error also.
    Can anyone tell me what could be the reason for this and is there any other means by which i can create a line item through the user exit.

    You have to set the creation flag UPDKZ to 'I'.
    to correctly use the user exit refer to OSS note 0381348 Using user exit, customer exit, VOFM in SD.
    pls reward if helpful
    Roberto

  • How to update old records of LIPS used user exit MV50AFZ1

    To All Experts,
    I have used User Exit MV50AFZ1 and in this user exit i updated the fields
    USEREXIT_MOVE_FIELD_TO_LIPS.
    LIPS-ETENR = VBEP-ETENR.
    Its working fine for new VL0N1 t-code, but what about old recods of LIPS table ?
    How to update old records ? Pl. guide me.
    Yusuf

    Hi Yusuf,
    See SAP Note 415716 - User exits in delivery processing, it explain how these userexits work and cautions that you must have.
    Regards
    Eduardo

  • How to Change the Existing Sales Order Transaction

    Hi all,
    I am trying to change some of the fields in Existing Sales Order Transaction.
    Fields which i am trying to change are Ext. Reference number and Net Value.
    I am using CRM_ORDER_MAINTAIN to do so but its not working. I dont know if some BADI can solve my purpose.
    If anyone of you have done something like this please share with me and suggest me the solution for that.
    Thanks in Advance.
    Regards,
    Manoj Tiwari

    That you should be able to do in ORDER_SAVE badi.
    You will be able to find lots of discussions on usage of this badi here in this forum.
    You need to call ORDER_READ, then call ORDER_MAINTAIN to change the values according to your requirement.
    Regards,
    Kaushal

  • How to change plant in sales order???

    I have made a sales order which created a purchase requisition. A purchase order has been made with reference to the purchase requisition.
    No goods reciept has been made yet.
    I want to change the plant and the storage location in the Purchase order, so to be able to recieve the goods in a different plant. I tried doing this from ME22n  but I get the message that the sales order has been made with a different plant. If I try to change the plant in the sales order I can not. the field is not possible to be changed.
    What should I do?
    Thank you in advance

    Dear Theodorous,
    1)Please check the Material has been extended to the second plant.
    2) Assign the second Plant to Sales Org and Dist Channel
    If you have any concern revert back the same
    Regards
    Amjath

  • Detecting change on header and item texts for sales order in user exit

    Hi,
    In the user exit of VA02, I need to identify/detect if header or item texts for sales order is changed or not.
    Please advise on this.
    Regards,
    Shreyas

    Normally system stores the old values in XTables and new values in YTables.  Check if you have access to these in your user exit.  If you give the user exit name, someone will be able to guide you.
    hith
    Sunil Achyut

  • How to trigger Availability check in Sales Order 'save' user exit.

    I have requirements which dictate that I change item categories of most of the line items in a user exit. If I do that the line items no longer confirm. I know that the availability check happens in 'move_Field_to_vbap' user exit. Is there any way I can re-trigger it on save. These orders will be coming through a bapi. Thanks in advance.

    Hi!
    Search the way (via menu) in VA01 to trigger the availability check manually. Then have a look, with routines are called.
    Then call this (these) routines in the exit. If you see something like 'perform okcode_...', then this should work. Be careful not to trigger recursive loops by this way. Maybe  the prepare_save-exit is a better place to do this.
    Regards,
    Christian

Maybe you are looking for

  • Limitations of the iMAc

    I am trying to decide between the MacBookPro or an iMac. I specifically want to use it for FCE and Aperture and was wondering if there were any limitations either had that would stop you from considering one. I am editing HD video. Thanks!

  • Any indication how Mountain Lion might work with the Quicken for Lion "patch"?

    After the disaster getting Quicken for Mac 2007 (or earlier) to sort-of work on Lion, has anyone checked if the Lion Compatible Quicken for Mac works on the new Mountain Lion operating system? Even though this isn't an Apple problem, I know I'm not t

  • TS2551 Why do I get exclamation sign when I click to Iphoto pics?

    I am having problem opening my photos from Iphoto, when i dooble click exclamation sign comes up why? any help would be appreciated.

  • Getting unknown error (-50)

    While syncing iPhone to iTunes (Mac) it is giving "The iPhone cannot be synced. An unknown error occurred (-50)"

  • Shuffle 3G Right Ear Bud No Audio

    I'm having problems with my new shuffle. Whenever I use the controls on the right ear bud, the sound dies on the right ear bud. It returns as soon as I release the controls but it also affect the volume controls aside from the clicker. To add, this a