SAP User Exits Routine

User exits are routine which SAP allows you to add in additional customized programs process without affecting the standard SAP programs.

SAP user exit are usually declare as a form routine :-

form userexit_xxxxx
       ........................
endform

In VL01 - Create Delivery Order, standard program  SAPMV50A, the standard program did not check for storage location equal to space, and delivery quantity less than one when the user click the save button.  Therefore I have to insert the additional checking into the userexit routine.

Steps:-

  • Goto transaction VL01 to pick a Sales Order for delivery (you don't have to save the data)
  • In the initial screen, click System -> Status -> Double click on Program (Screen)
  • In the dialog program SAPMV50A, click Edit -> Search/replace
  • Type userexit in the Find field, then click the In program radio button and hit Enter
  • A number of userexit routine will be display.  You'll have to roughly decide which is the correct userexit routine to used.
form userexit_save_document_prepare.
case xlips-pstyv.
  when 'TAX' or 'REX'.
*    Accept this two Delivery item category

  when 'REN'.
     if xlips-lgort = space.
*    Reject this Delivery item category
        message e001.
     endif.

  when others.
     if xlips-matnr <> space.
*    Check storage location not space
       if xlips-lgort = space.
          message e002.
       endif.
*     Check delivery quantity not zero
       if xlips-pikmg < 1.
          message e003.
       endif.
    endif.
endcase.
endform.

What is the use of user-exit and all?
Is it about modifying SAP program?

Suppose that you need some functionality which is not provided in sap what do you do. Sap has provided you with three options.

1) Customizing.
2) Modifications.
3) User Exits.

So what are these three in the first case when you take Customization is nothing but you are customizing SAP according to your need and requirement for example you want the Purchase Order Numbers to start with <Co_Name><seq_no>(sequential no) this kind of stuff is done in customization.

Modification is nothing but you are modifying SAP std code which is written during developing your SAP std programms or screens.

Thirdly to avoid modifications SAP has provide you with some exit points like for example after the PBO event in module pool programming comes the PAI. so in between these two events you wanted the change something so SAP has provided with an exit point. that exit point is called user exits.  for example user exits for me21 PO Create is MM06005 if I am not wrong. they are nothing but simple function module within which you write your code which functions just like normal program and executes between the PAI and PBO events.

Hitesh Saini

More Function Module
Functions / SAP Script / ALV

Tables
Database Table

ABAP Books List
ABAP/4 Certification, Programming, Smartforms, Sapscripts and Object Oriented Programming Books

Smart Forms
SAP Smartforms

ABAP Menu:
ABAP Example Hints and Tips

Return to Index:-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.