Example: User Exit with Form Routine 

Basic Situation

You use a customer User Exit with the program name ZUSEREXl and the form routine with the name KONVERT.

You wish to convert the value in the Title (TITEL) field object in the Personal Data infotype (P0002) to the text from the Title (TTOUT) field in the Name Supplements (T535N) table. The title ING (for engineer) should not be used.

Procedure

The customer program for the user exit (including the form routine) could be as follows:

 

     FORM KONVERT TITEL USING VALUE(P0002) STRUCTURE P0002

                        CHANGING VALUE(RESULT).

          IF P0002-TITEL <> `ING.`.

             SELECT SINGLE * FROM T535N

                                  WHERE ART = `T`

                                  AND TITEL = P0002-TITEL.

         IF SY-SUBRC = 0.

                RESULT = T535N-TTOUT.

   ELSE.

                CLEAR RESULT.

   ENDIF.

ENDFORM.