USER_EXIT-MV45AFZB FORM USEREXIT_CHECK_VBAP

HI ALL...I HAVE ONE OBJECT THAT IS
IWANTO ADD 3 FIELDS FROM ADRC(POST_CODE1,REGION,COUNTRY) TO VBAP(ZZSHIPTOPC,ZZSHIPTOREG,ZZSHIPTOCO).
FOLLOWING THIS LOGIC....
     1.ON USER EXIT CHECK INTERNAL TABLE XVBPA FOR THE PARTNER FUNCTIONS AT THE HEADER OR ITEM LEVEL.
2.THIS UE IS VALID FOR TC VA01 &VA02 ONLY
3.BEFORE DOING THE SEARCH IN ADRC CHECK THAT THE MATERIAL IS CONFIGURABLE(MARA-KZKFG = 'X').
4.MOVE FIELDS TO NEW ZZ ....FIELDS IN VBAP.
PLZ WRITE THIS OBJECT ANY BODY KNOW'S

*&  Include           ZPLM_ENG_VC_REFCHAR
TITLE: POPULATE ZFIELDS IN TABLE VBAP BASED ON DOCUMENT LINE ITEM SHIP-TO PARTNER VALUES.
        ZFIELDS REQIRED ARE POSTAL CODE,REGION,AND COUNTRY.
TRANSACTION: VA01,VA02.
PROGRAMMER: JANARDHAN REDDY.
DATE:07/24/2008.
*DATA DECLARETION.
TYPES:BEGIN OF STR_ADRC,
      POST_CODE1 TYPE ADRC-POST_CODE1,
      REGION TYPE ADRC-REGION,
      COUNTRY TYPE ADRC-COUNTRY,
      END OF STR_ADRC.
DATA:WA_ADRC TYPE  STR_ADRC,
     WA_KZKFG TYPE MARA-KZKFG,
     TAB_ADRC TYPE TABLE OF STR_ADRC.
TYPES:BEGIN OF STR_VBAP,
      ZZSHIPTOPC TYPE VBAP-ZZSHIPTOPC,
      ZZSHIPTOREG TYPE VBAP-ZZSHIPTOREG,
      ZZSHIPTOCO TYPE VBAP-ZZSHIPTOCO,
      END OF STR_VBAP.
DATA:WA_VBAP TYPE  STR_VBAP,
     TAB_VBAP TYPE TABLE OF STR_VBAP.
IF SY-UNAME = 'OFF1'.
IF SY-TCODE EQ 'VAO1' OR SY-TCODE EQ 'VAO2'.
*CHECK INTERNAL TABLE XVPA.
LOOP AT XVBAP.
SELECT SINGLE KZKFG FROM MARA
            INTO WA_KZKFG WHERE MATNR = XVBAP-MATNR.
IF WA_KZKFG = 'X'.
READ TABLE XVBPA WITH KEY VBELN = XVBAP-VBELN    "Step 2
         POSNR = XVBAP-POSNR  PARVW = 'SH'.
   ENDIF.
IF SY-SUBRC <> 0.
  READ TABLE XVBPA WITH KEY VBELN = XVBAP-VBELN   "Step 3
         POSNR = XVBAP-POSNR  PARVW = 'SH'.
ENDIF.
IF SY-SUBRC = 0.
*GATHER FIELDS FROM ADRC
SELECT POST_CODE1 REGION COUNTRY FROM ADRC INTO WA_ADRC  "Step 4
      WHERE ADDRNUMBER = XVBPA-ADRNR.
      ENDSELECT.
      ENDIF.
IF SY-SUBRC = 0.
*MOVE THE FIELDS TO Z..FIELDS
    MOVE :WA_ADRC-POST_CODE1 TO XVBAP-ZZSHIPTOPC,
          WA_ADRC-REGION     TO XVBAP-ZZSHIPTOREG,
          WA_ADRC-COUNTRY    TO XVBAP-ZZSHIPTOCO.
   MODIFY XVBAP TRANSPORTING ZZSHIPTOPC ZZSHIPTOREG ZZSHIPTOCO.
ENDIF.
CLEAR:TAB_ADRC,WA_KZKFG.
ENDLOOP.
ENDIF.
ENDIF.

Similar Messages

  • MV45AFZB - FORM USEREXIT_CHECK_VBAP USING US_DIALOG - incompletion log

    Hello,
    I'm struggling with a problem concerning the incompletion log after deleting a value in the named user exit.
    I check if the profit center has a certain value in the form  USEREXIT_CHECK_VBAP USING US_DIALOG. if this is the case, the system deletes the value. But my problem is that at this moment, the incompletion log is not updated. Do I have to update the table xvbuv manually with the new entry ? Or is there another way to update this ?
    Thanks in advance !

    That's not entirely true - it depends on the user, what changes on the line item, and what the criteria are for blanking out the value.  Removing the value would be the normal trigger if the field is in the item incompletion procedure but not necessarily if done via code.
    The incompletion check occurs in routine VBAP_PRUEFEN_ENDE and requires that something has changed in VBAP in order to be triggered.  If the routine has already been called and then you change a VBKD-based value on the item, such as the incoterms, then the incompletion check is skipped but the userexit_check_vbap call is still made afterwards.  In this scenario, if you click 'Save' after making the incoterms change, the profit center value gets wiped out and no incompletion is triggered unless you append the value back to the table (or make a subsequent check with RV_CHECK_DOCUMENT_INPUT).  I'm assuming this is why the poster asked the question.  Might be a bug, but SAP would probably tell you it's 'working as designed'...

  • MV45AFZB User Exit; FORM userexit_check_vbap

    Hi experts,
    I have implemented a user exit in MV45AFZB, the requirement is that when I change the sales order quantity of a line item for example previous quantity is 2000 kg and I change it to current quantity 1000kg, during debug mode i need to know the previous quantity 2000kg of that particular sales order item I changed. I looked at YVBAP but it is empty. Any inputs is appreciated.
    Thanks.

    Hi Mawi,
    For this function : you have enhancement spots. click on spiral icon, goto edit enhancement- show implesit enhancements
    then cursor will take you some enhancement spots, here you can find for vbap_old and vbap_new structures.
    if it is useful, points please.
    Thank you
    srinu

  • How to make plant in shipping cond tab for line item in sales doc mandatory

    Hi
    How to make plant as mandatory for a sales document say quotation mandatory ? I went to SPRO-> Basic Fucntion - > log of incomplete terms ->  Define incomplete Groups -> B.selected sales -Item -> Created new procedure Z001 with fielda VBAP - WERKS ,selected screen name PDE2 and checked warning check box.
    When i goto Assign incompleteness procedures I donot have option to assign it sales document item level procedure i will only get sales doc header procedure to assign it to document type quotation.
    How to make plant as mandatory for each line item in quotation?
    Thanks,
    Vaishnavi

    Include: MV45AFZB
    Form  USEREXIT_CHECK_VBAP
    In our business scenario, we have used the same ,But  Plant is mandatory only for 1st line item-
    source code:
    IF vbak-vkorg = '1000' OR vbak-vkorg = '2000'.
        IF sy-tcode = 'VA31' OR
           sy-tcode = 'VA11' OR
           sy-tcode = 'VA21' OR
           sy-tcode = 'VA41' OR
           sy-tcode = 'VA01' .
          IF vbap-werks IS INITIAL AND
             vbap-posnr EQ '000010'.
            MESSAGE e398(00) WITH 'Please enter the plant for first line'.
          ENDIF.
        ENDIF.
      ENDIF.
    Help:
    Through this form exit we are making the "plant' field (for the ist  &*
    & line item ) mandatory for the sales document . This interns helps us &
    & to create the sales document numner according to the plant (Region)  &
    *& of the Plant
    Hope it clears. take assistance of your ABAPer.

  • Order quantity equals to delivery unit in material master

    Dear All,
    I have below requirement regarding Delivery unit (MVKE-SCMNG).
    My requirement is that whatever unit has been maintained in material master in Delivery unit, system shall not allow to create sales order of quantity which is more or less than the delivery unit.
    Meaning, system shall only allow to create sales order of quantity equals to the quantity maintained in the material master in delivery unit.
    Kindly let me know if any user exit(s) available for the same.
    Waiting for your valuable reply.
    Thanks,
    Ritesh

    Hi Ritesh,
    This is very much possible using user exit, MV45AFZZ in FORM userexit_save_document.
    Other option would be in MV45AFZB FORM USEREXIT_CHECK_VBAP, you can check that this qty in material master if unequal to ordered qty you can give a pop-up to user that 'The qty is being changed to xx' as soon as the user presses enter as the user would know about it.
    in MV45AFZZ, the user would know only after saving and would be able to see in VA03 after the document is created.
    Regards,
    RS.

  • Item & Discount added in the Sales Order

    Dear All,
    I have a requirement where in once a Sales Order is created with approved Quotation, then no new extra items to be added in the sales order.
    Quantity in the existing line item can be decreased to the lower side but no addition in quantity to be done.
    Also no change in discount condition  types to be done.
    Please suggest the approprite Config. If there is no standard config, then please suggest the code which needs to be written in the approprite Userexit.
    Best solution will be rewarded.
    Thanks and regards,
    Dilip Kumar Rao

    Hi,
    To restrict creation of new items and to restrict addition of quantity to existing items, use following user-exits and coding.
    Program : MV45AFZB
    FORM USEREXIT_CHECK_VBAP USING US_DIALOG.
    *{   INSERT         D50K904678                                        1
      if sy-tcode eq 'VA01' or sy-tcode eq 'VA02'.
        check vbap-vgbel <> space and vbap-vgpos <> space.
        read table vvbap with key vbeln = vbap-vgbel
                                  posnr = vbap-vgpos.
        if sy-subrc eq 0.
          if vbap-kwmeng gt vvbap-kwmeng.
            message e499(sy) with
              'Quantity entered is greater then referenced'.
          endif.
        endif.
      endif.
    *}   INSERT
    ENDFORM.
    Program : MV45AFZZ
    FORM USEREXIT_MOVE_FIELD_TO_VBKD.
      if sy-tcode eq 'VA01' or sy-tcode eq 'VA02'.
        loop at xvbap where vgbel eq space
                      and   updkz eq 'I'.
          exit.
        endloop.
        if sy-subrc eq 0.
          message e499(sy) with 'New Item is not allowed'.
        endif.
      endif.
    ENDFORM. 
    -Alpesh

  • Help in User Exit MV45AFZB

    Hi,
    We have a User Exit for SO, MV45AFZB.
    We want to insert a condition in it that when we change the plant, new pricing should be carried out..
    Please let me know where i should check the condition, in Form  USEREXIT_CHECK_VBAP or Form  USEREXIT_NEW_PRICING_VBKD... because plant shows in VBAP table and pricing table have another...
    what should be code for this...
    Regards...

    Duplicated post?
    [Problem in User Exit MV45AFZB - USEREXIT_NEW_PRICING_VBKD;
    Regards,
    Andrea

  • How to disable DELETE option in user exit MV45AFZB

    Hi All,
    Can u please suggest on this req,I  need to modify the user exit MV45AFZB form USEREXIT_CHECK_XVBAP_FOR_DELET   needs to be modified to not to allow an order item or an order for division (spart = 80) to be deleted.
    Thanks,

    Hi, malleshanthi.
    Please, refer to this link:
    [http://help.sap.com/saphelp_46c/helpdata/en/1c/f62c7dd435d1118b3f0060b03ca329/content.htm]
    User-Exits in program MV45AFZB
    USEREXIT_CHECK_XVBAP_FOR_DELET
    In this user exit, you can enter additional data for deletion of an item. If the criteria are met, the item is not deleted (unlike in the standard system).
    You can also insert enhancement implementation:
    FORM USEREXIT_CHECK_XVBAP_FOR_DELET USING US_ERROR
                                              US_EXIT.
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(2) Form USEREXIT_CHECK_XVBAP_FOR_DELET, Start                                                                                A
    * Example
    * IF US_ERROR NE SPACE.
    *   MESSAGE ......
    * ENDIF.
    * IF .......
    *   US_EXIT = CHARX.
    * ENDIF.
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(3) Form USEREXIT_CHECK_XVBAP_FOR_DELET, End                                                                                A
    ENDFORM.
    Best regards,
    George Shlyahov.

  • Include MV45AFZB

    Hi!
    We have to add some code in include MV45AFZB (form USEREXIT_MOVE_FIELD_TO_TVCOM_H).
    Do we use SE38 to do it and get the access key? Or there is another way to do this?
    Thanks!
    Cristian

    Hi there,
    There are some standard user exists which even the ABAPer cannot change.
    Customized user exists will be in the customized includes. For eg in MV45AFZB, there will be cystomized include ZMV45AFZB for eg which will have the customized user exists. To change / modify that user exists we donot need an access key. Pls note that we cannot change any standard user exists. It is given by SAP which we can just call in our prog.
    We need access keys only to define / change condition tables or to change the requirement routines in VOFM.
    Regards,
    Sivanand

  • How to restrict status profile for sales order.

    Dear Friends,
    Pl suggest me for follwoing scenario
    ►     As per business process for tender/ institutional sales and exports, the order is complete once the complete delivery and invoicing for the same has been performed.
    ►     It was also observed that a sales order may be modified (material, quantity, price etc) even after complete invoicing of the same has been performed in SAP.
         The requirement is  Possibility to enable a control to restrict any amendments to the sales order after complete delivery and invoicing will be explored as per business requirements.
    Is there any solution above scenario without writing any code.
    Regards,
    Atul
    Edited by: atul thakur on Oct 28, 2009 5:09 AM

    Mr Atul,
    My understanding is, you don't want your user to be able to change the pricing and order quantity once the order is complete, i.e Delivered and Shipped.
    The status profile will not help you in the above scenario, Price/Quantity changes will not come up as Business transactions that can be controlled at Status profile.
    Standard SAP restricts the price changes to a completed item of the order, so no need to worry about this.
    But order quantity can be increased any time.
    So to restrict the user to increase the order quantity you need to use the User-Exits that SAP provided.
    Use the MV45AFZB user-exit program and form  FORM userexit_check_vbap to code this.
    Hope this helps you.
    Regards,
    Aj.

  • Display error message in SD user exit

    Hi,
    I want to display an error message in FORM USEREXIT_CHECK_VBAP. (Include MV45AFZB)
    Afterwards, the user should be able to correct the wrong values, but the fields are locked because of the error message. How can I keep the relevant fields open?
    Thanks in advance
    Roland

    Hi,
    Instead of giving an error message...Probably give warning message..
    If you give error message..It will lock the entries..
    Thanks,
    Naren

  • Not able to add extra line item in sales order - va01

    Hi friends,
    At the time of creation of sales order via va01.
    I am appending the my extra line item in xvbap. But on screen I am not able to view that extra line item.
    Could you please help me out with this problem.
    My code is given below.
    I am writting this code in MV45AFZB &
    in that FORM USEREXIT_CHECK_VBAP USING US_DIALOG.
    it_free_goods is the table in which i am having data which needs to be uploaded in xvbap.
      IF it_free_goods[] IS NOT INITIAL.
        LOOP AT it_free_goods INTO wa_free_goods.
          wa_xvbap-matnr = wa_free_goods-matnr.
          RV45A-MABNR  = wa_free_goods-matnr.
          VBAP-POSNR   = vbap-posnr + 10.
          wa_xvbap-kwmeng = wa_free_goods-menge.
          wa_xvbap-meins = wa_free_goods-meins.
          wa_xvbap-pstyv = co_pstyv.
          wa_xvbap-posnr = vbap-posnr + 10.
          wa_XVBAP-UPDKZ = 'I'.
          MOVE-CORRESPONDING wa_xvbap TO xvbap.
          APPEND xvbap.
         ENDLOOP.
       ENDIF.
    Please let me know if somethings needs to be changed.
    It will be very helpful for me,
    Thanks,
    Best Regards,
    Prashant

    Hi Prashanth,
    I believe the use of
    USEREXIT_CHECK_VBAP
    This user exit can be used to carry out additional checks (e.g. for completion) at item level
    Please check the following link which has a similar requirement
    Re: VA01/VA02  screen exit
    Regards
    Byju

  • Changing the status of the sales order item based on reason for rejection

    Hi All,
    When a Sales order item is rejected then the status at the item level is changed as 'TECO'.When the reason for rejection is removed the status 'Teco' is reset.This status change can be achieved using the user exit 'MV45AFZZ'.But the exit does not allow re-atp calculation whenver a blocked item is release.I have use the exit 'MV45AFZB' ,through this the status change as well as re-atp calculation takes place.But the status changed(Based on reason of rejection) does not appear in the same screen.The change gets reflected only when the sakes order is saved and i open it again.
    I want the status change to appear in the same screen.I am doing my code in the form 'userexit_check_vbap' of the exit 'MV45AFZB'. Please let me know if there are any user exits or BADI's available for the same(Changing the status of the sales order item based on reason for rejection ).
    Regards,
    S.Subasree

    Hi subburamaiah
    If you want the report you can create a separate SIS report . In that take the input field  as a Reason for rejection.. and ask for the output the list of sales orders .Now when you check this user defined report you will give the reason for rejection and check what all orders got rejected on that reason for rejection.
    Regards
    Srinath

  • User-exit or BADI for Configurable line item change in VA01/VA02

    Hi,
    During sale order creation or change the configurable item characterstics depend on plant. If a plant is changed the characterstics to be entered again. In my scenario the materila characterstics are same for all the plants hence in place of entering these again want to retrieve from the database through user-exit or BADi . Is there any.
    thanks
    anya

    Hi,
    Check the user exit "MV45AFZB', form-routine "USEREXIT_CHECK_VBAP".
    Regards
    Vinod

  • XVBAP has the new line item but does not update Sales Order

    Hi
    I need to update the sales order with a new line item when the line item has a base unit of measure as the sales unit. I need to then convert the base unit to sales unit with a whole figure and the rest can be in the base unit.
    I am able to see the update in the xvbap but the line item doesn't get updated.
    I am puting this code in a perform within
    MV45AFZB  within   Form  USEREXIT_CHECK_VBAP
    But I guess I am doing something wrong can someone please take a look at it and tell me what is wrong with the coding.
    *&  Include       ZSD_CREATE_NEW_LINE_ITEM              *
    *&      Form  create_new_line_item
          text
    -->  p1        text
    <--  p2        text
    FORM CREATE_NEW_LINE_ITEM .
      CONSTANTS: C_MEINH LIKE MARM-MEINH VALUE 'CSE'.
    Variables Used
      DATA: WS_WMENG LIKE VBEP-WMENG.
      DATA: INPUT  LIKE VBAP-KWMENG,
            WS_EA  LIKE VBAP-KWMENG,
            WS_CSE LIKE VBAP-KWMENG.
      DATA: WS_MVKE_VRKME LIKE MVKE-VRKME.
    Internal Tables and Structures
      DATA: WS_XVBAP LIKE XVBAP.
    DATA:
    it_vbap  LIKE vbap OCCURS 0 WITH HEADER LINE,
    it_vbep  LIKE vbep OCCURS 0 WITH HEADER LINE,
    it_xvbap LIKE vbapvb OCCURS 0 WITH HEADER LINE.
      DATA: BEGIN OF WS_MARM,
              MEINH LIKE MARM-MEINH,
              UMREZ LIKE MARM-UMREZ,
              UMREN LIKE MARM-UMREN,
            END OF WS_MARM.
      CLEAR WS_MVKE_VRKME.
      SELECT SINGLE VRKME INTO WS_MVKE_VRKME
        FROM MVKE
        WHERE MATNR EQ XVBAP-MATNR
        AND   VKORG EQ XVBAK-VKORG
        AND   VTWEG EQ XVBAK-VTWEG.
      IF VBAP-VRKME <> WS_MVKE_VRKME.
       LOOP AT XVBAP.
          SELECT SINGLE MEINH UMREZ UMREN
            FROM MARM
            INTO WS_MARM
            WHERE MATNR = VBAP-MATNR
            AND   MEINH = WS_MVKE_VRKME.
          IF XVBAP-MEINS <> WS_MVKE_VRKME.
            IF NOT XVBAP-KWMENG = 0.
              WS_WMENG = XVBAP-KWMENG / WS_MARM-UMREZ.
              IF WS_WMENG > 1.
    This means that the line item needs to be split into CSE & EA
                  INPUT  = XVBAP-KWMENG.
                  WS_EA  = INPUT / WS_MARM-UMREZ.
                  WS_CSE = WS_EA.
                  WS_EA  = WS_CSE * WS_MARM-UMREZ.
                  WS_EA  = INPUT - WS_EA.
    Now we have the qty. split into EA & CSE. Now to
    assign it to xvbap
                  XVBAP-KWMENG = WS_EA.
                  XVBAP-VRKME  = WS_MVKE_VRKME.
              READ TABLE XVBAP WITH KEY POSNR = XVBAP-POSNR.
                MODIFY XVBAP INDEX SY-TABIX.
                  WS_XVBAP = XVBAP.
                  WS_XVBAP-KWMENG = WS_CSE.
                MOVE-CORRESPONDING WS_XVBAP TO XVBAP.
                INSERT XVBAP INDEX SY-TABIX.
              ENDIF.
            ENDIF.
          ENDIF.
      ENDIF.     " IF xvbap-vrkme 'EA'.
    ENDFORM.    " create_new_line_item

    Hi Clark,
    Pls check the Include MV45AFZZ instead of the one which you are using . Here in this include MV45AFZZ you can have access to the Header and Line items data .
    Here in this include
          FORM USEREXIT_SAVE_DOCUMENT                                   *
          This userexit can be used to save data in additional tables   *
          when 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 from form BELEG_SICHERN, before COMMIT *
    form userexit_save_document.
    Endform.
    Either you can write the code you want to update the XVABP table here or you can use the form .
          FORM USEREXIT_MOVE_FIELD_TO_VBAP                              *
          This userexit can be used to move some fields into the sales  *
          dokument item workaerea VBAP                                  *
          SVBAP-TABIX = 0:  Create item                                 *
          SVBAP-TABIX > 0:  Change item                                 *
          This form is called at the end of form VBAP_FUELLEN.          *
    form userexit_move_field_to_vbap.
    endform.
    This are the 2 performs in this include where you can do you code and it will defnitely solve your problem.
    Good Luck to you . Let me know if your problem get solved.
    Thanks & Regards,
    Naidu.

Maybe you are looking for

  • I updated itunes to version 11.0 and now it will not open and says it is corrupted?

    i updated itunes to version 11.0 and now it will not open and says it is corrupted? how do i get it to work it updated fine then asked to restart comp so i did now it will not open

  • How to get network IP camera of images or media ?

    Please tell me how to use jmf to get network IP camera of images or media? if you can provide source code, send me please my e-mail: [email protected] thanks!!⊙ω⊙

  • Two nonlinear fitting's function in one

    We bought the LabView 6.1 and I have no clue how to make the Lev-Mar work (and many other functions as well). There are some tasks in the 'getting start' manual that tells you step-by-step of doing things. I appreciate any body can tell me how to 'wr

  • Transfer product category from catalog to SRM with 2 BE systems

    Hello experts, We are having an issue when transfering products from the SRM-MDM Catalog though OCI, since we have an SRM extended classic scenario connected to 2 backend systems. When the information is downloaded to SRM, the product category is cha

  • Method implementation using ABAP objects

    hi folks, I am impelementing a method using one of the parameters, which is a internal table taken as an import parameter. I am using the field symbols to <b>modify</b> the table data  but it is not working. method IF_EX_PT_ABS_ATT_COUNTRY~CALCULATE_