SAP ABAP - User Exits | Learn and Master SAP ABAP - Software Development PDF Download

Introduction

  • User exits are used in an extraction if the standard SAP extractors do not provide the expected data or the required functionality, for instance in authorizations or time checks. User exits are commonly used in Sales and Distribution (SD) modules. There are many exits provided by SAP in the areas of sales, transportation, shipping and billing. A user exit is designed to make some changes when standard SAP is not capable of fulfilling all the requirements.
  • To be able to access what exits are available in each area of sales, go to IMG using this path: IMG → Sales and Distribution → System Modifications → User Exits. The documentation for each exit in the areas of SD is explained thoroughly.
  • For instance, if you want to find user exits in Sales Document Processing (contract, quotation or sales order), follow the path mentioned above and continue to expand the node User Exits in Sales → User Exits. Click on icon documentation to see all user exits available in Sales Document Processing.

SAP ABAP - User Exits | Learn and Master SAP ABAP - Software Development

A User Exit serves the same purpose as Customer Exits but they are available only for the SD module. The exit is implemented as a call to a Function Module. User Exits are modifications to SAP standard programs.

Example

REPORT ZUSEREXIT1. 

TABLES:   

   TSTC, TSTCT,

   TADIR, TRDIR, TFDIR, ENLFDIR,

   MODSAPT, MODACT. 

    

DATA:   

   JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE,

   field1(30),

   v_devclass LIKE TADIR-devclass. 

    

PARAMETERS:

   P_TCODE LIKE TSTC-tcode OBLIGATORY. 

    

SELECT SINGLE *

   FROM TSTC

   WHERE tcode EQ P_TCODE. 

    

IF SY-SUBRC EQ 0.

   SELECT SINGLE *

   FROM TADIR

    

   WHERE pgmid = 'R3TR' AND 

         object = 'PROG' AND

         obj_name = TSTC-pgmna.

        

   MOVE TADIR-devclass TO v_devclass.

    

   IF SY-SUBRC NE 0.

   SELECT SINGLE * 

      FROM TRDIR

      WHERE name = TSTC-pgmna.

        

   IF TRDIR-subc EQ 'F'.

      SELECT SINGLE *

         FROM TFDIR

         WHERE pname = TSTC-pgmna.

            

      SELECT SINGLE *

         FROM ENLFDIR 

         WHERE funcname = TFDIR-funcname.

            

      SELECT SINGLE * 

         FROM TADIR

         WHERE pgmid = 'R3TR' AND

               object = 'FUGR' AND 

               obj_name EQ ENLFDIR-area.

         MOVE TADIR-devclass TO v_devclass.

      ENDIF.

   ENDIF.

    

   SELECT *

      FROM TADIR

      INTO TABLE JTAB

        

      WHERE pgmid = 'R3TR' AND

            object = 'SMOD' AND

            devclass = v_devclass.

            

   SELECT SINGLE *

      FROM TSTCT

      WHERE sprsl EQ SY-LANGU AND

            tcode EQ P_TCODE.

            

   FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.

   WRITE:/(19) 'Transaction Code - ', 

      20(20) P_TCODE,

      45(50) TSTCT-ttext.

   SKIP.

    

   IF NOT JTAB[] IS INITIAL.

      WRITE:/(95) SY-ULINE.

      FORMAT COLOR COL_HEADING INTENSIFIED ON.

        

      WRITE:/1 SY-VLINE, 

            2 'Exit Name',

            21 SY-VLINE , 

            22 'Description',

            95 SY-VLINE.

            

      WRITE:/(95) SY-ULINE.

      LOOP AT JTAB.

         SELECT SINGLE * FROM MODSAPT

         WHERE sprsl = SY-LANGU AND

               name = JTAB-obj_name.

                

         FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

         WRITE:/1 SY-VLINE,

               2 JTAB-obj_name HOTSPOT ON,

               21 SY-VLINE ,

               22 MODSAPT-modtext,

               95 SY-VLINE.

      ENDLOOP.

        

      WRITE:/(95) SY-ULINE.

      DESCRIBE TABLE JTAB.

      SKIP.

      FORMAT COLOR COL_TOTAL INTENSIFIED ON.

      WRITE:/ 'No of Exits:' , SY-TFILL.

        

   ELSE.

      FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

      WRITE:/(95) 'User Exit doesn’t exist'.

   ENDIF. 

ELSE.

   FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

   WRITE:/(95) 'Transaction Code Does Not Exist'. 

ENDIF.

 

AT LINE-SELECTION.

   GET CURSOR FIELD field1.

   CHECK field1(4) EQ 'JTAB'.

   SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).

   CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

While processing, enter the transaction code ‘ME01’ and press F8 (Execute) button. The above code produces the following output −

SAP ABAP - User Exits | Learn and Master SAP ABAP - Software Development

The document SAP ABAP - User Exits | Learn and Master SAP ABAP - Software Development is a part of the Software Development Course Learn and Master SAP ABAP.
All you need of Software Development at this link: Software Development
73 videos|68 docs

Top Courses for Software Development

73 videos|68 docs
Download as PDF
Explore Courses for Software Development exam

Top Courses for Software Development

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Sample Paper

,

MCQs

,

mock tests for examination

,

pdf

,

study material

,

Extra Questions

,

ppt

,

Viva Questions

,

Semester Notes

,

video lectures

,

SAP ABAP - User Exits | Learn and Master SAP ABAP - Software Development

,

Previous Year Questions with Solutions

,

Objective type Questions

,

Free

,

SAP ABAP - User Exits | Learn and Master SAP ABAP - Software Development

,

past year papers

,

Summary

,

SAP ABAP - User Exits | Learn and Master SAP ABAP - Software Development

,

Exam

,

practice quizzes

,

shortcuts and tricks

,

Important questions

;