0007b - User Exits In SD

Moderators: Snowy, thx4allthefish, Rich, ilya

Post Reply
Rich
Posts: 7116
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool
Contact:

0007b - User Exits In SD

Post by Rich » Thu Mar 26, 2009 11:52 am

User Exits In SD.

User Exits in the SD module are implemented in a very different manner. Essentially what SAP have done is to provide a series of includes that contain procedures that are called regardless of whether they have been implemented or not. No sophistication unlike the other User Exits mentioned above.

The includes that you need to look at are:

Code: Select all

 MV45AFZ4                      
 MV45AFZA                      
 MV45AFZB                      
 MV45AFZB_USEREXIT_CHECK_VBAK  
 MV45AFZB_USEREXIT_FILL_VBAP_FR
 MV45AFZC                      
 MV45AFZD                      
 MV45AFZF                      
 MV45AFZH                      
 MV45AFZU                      
 MV45AFZZ                      
 MV45AFZZ_FCODE_KKON_REDIRECT  
 MV45AFZZ_FCODE_PKON_REDIRECT  
 MV45AFZZ_USEREXIT_FIELD_MODIFI
Each of these includes contains different procedures for different user exits. You will have to check each one to find the one that you require.

You implement your Exit something like the following:

Code: Select all

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

* Example:
* CALL FUNCTION 'ZZ_EXAMPLE'
*      IN UPDATE TASK
*      EXPORTING
*           ZZTAB = ZZTAB.
*{   INSERT         CADK903250                                        1
*
  Constants: c_Sales_Order          type VbTyp value 'C',
             c_Order_Without_Charge type VbTyp value 'I',
             c_Transaction_Type_Add type TrTyp value 'H'.

*
*
  If Vbak-Vbtyp = c_Sales_Order
     or Vbak-Vbtyp = c_Order_Without_Charge.
*
*       Creation or Change ??
*
        If t180-TrTyp = c_Transaction_Type_Add.
*
*          Do NOT change the order of these calls.
*
           Call Function 'Z_XXXXXXXXXXXXXXXXX'
             Exporting
               Vbak          = Vbak
               Bsark         = Vbkd-Bsark.
           Call Function 'Z_XXXXXXXXXXXXXXXXXXXXX'
               Starting New Task Vbak-Vbeln
                 Exporting
                   Vbak           = Vbak
                   Ship_To        = Kuwev-Kunnr
                   Delivery_Date  = Rv45a-KetDat
                   Delivery_Plant = Rv45a-Dwerk
               Tables
                   Vbap           = xVbap.
        EndIf.
  EndIf.
*}   INSERT

ENDFORM.
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com

Post Reply