Close Sidebar close
Sapignite
  • SAP
  • Coding Challenges
  • Download
  • SAP Ignite Products

Subscribe & Follow

All product names on this web site are trademarks of the companies that own them. Sapignite.com is not affiliated with SAP AG in any way. SAP AG is the registered trademark holder of SAP, SAP R/3, mySAP, ABAP, xApps, NetWeaver, and other proprietary terms. The technical information on this site is verified to the greatest extent possible, however, any information found on this site is used at the site visitor's own risk. Sapignite.com reserves the right to correct any errors or omissions in any portion of this site at any time without obligation.

  • SAP
  • Coding Challenges
  • Download
  • SAP Ignite Products
Sapignite
Sapignite
    ABAP Enhancement SAP

    Tutorial on how to work with USER EXIT

    August 11, 2017

    A user exit is a place in a software program where a customer can arrange for their own tailor-made code. SD module has a large number of User exit available.

    The below is the create/ change sales order screen (VA01/VA02).

    The requirement is to put the validation to the line items such that the quantity field for the line item should not be less than 2 units.

    Step 1: How to find the appropriate USER EXIT.

    Go to object navigator(SE80) and select package from the list and enter VMOD in it. All of the userexits in SD are contained in the development class VMOD. Press enter and you will find all includes which contain userexits in SD for different functions like PRICING, ORDER PROCESSING etc. Select the userexit according to the requirement and read the comment inserted in it and start coding .

    There is a lot of confusion in using USER EXIT, like do we need access key to modify the USER EXIT ?.

    The answer is Yes as well as NO.

    If you see the include MV45AFZZ.we have many FORMS and ENDFORMS init which is in custom name space. So we don’t need key to modify it. Check out the below screen shot.

    So open that include and write your logic in ZMV45AFZZ_SAVE_DOCUMENT_PREP.

    While some EXITs like MV50AFZ1. You need an access key to modify it Don’t get puzzled, this is how SAP has given J.

    Step 2:

    So we got our USEREXIT ZMV45AFZZ_SAVE_DOCUMENT_PREP. Open it and put the below code inside it.

    data: lv_flag(1) type c.

    * exit if not SAVE
    if sy-ucomm ne ‘SICH’.
    leave to screen sy-dynnr.
    endif.

    * check line items
    clear lv_flag.
    loop at xvbap where updkz ne ‘D’.
    * This checks for quantity less than 2
    * As xvbap-kwmeng is pack with 3 decimal we are comparing with 2000
    if xvbap-kwmeng < 2000.
    message i000(fb) with
    ‘quantity is less than 2’.
    lv_flag = ‘X’.
    clear sy-ucomm.
    exit.
    endif.
    endloop.

    if lv_flag = ‘X’.

    leave to screen sy-dynnr.
    endif.

    Go To Transaction VA01/VA02 and try to create/change the order item quantity less than 2.


    sap abap enhancementsap abap VA01SAP ABAP VMODuser exit MV45AFZZuser exits MV50AFZ1
    raju borda
    Raju is working with Technical areas like SAP ABAP, PI , Web design, JAVA , PBT, robotics as architect also functional areas like SCM , QM, MM , insurance . When he is not Doing above geeky things you might find him travelling , Cooking , dancing or drinking with friends :-) .
    • Layer aware debugging in SAP ABAP video blog

    • Practice SAP APO Certification questions

    You Might Also Like

    SAP Freeway : My journey towards SAP teched demojam trophy

    July 8, 2017

    SAP ABAP Debugging tips and tricks !

    August 7, 2017

    Fight club : SAP vs Oracle

    July 11, 2017

    No Comments

    Leave a Reply Cancel Reply

Sign up for some exciting content

Recent Posts

  • How to prepare for SAP IBP Certification
  • What is SAP Leonardo ?
  • RoadMap UI Tutorial webdynpro for ABAP
  • Offline Adobe forms in WebDynPro for ABAP
  • MVC Architecture for Webdynpro for ABAP

Categories

  • ABAP
  • Android
  • Coding Challenges
  • Enhancement
  • featured
  • Interviews
  • Learning Hub
  • PI ( Process integration )
  • SAP
  • SAP HANA
  • Uncategorized
  • Webdynpro for ABAP
  • Webdynpro For ABAP