User-Defined Routines
Use
The system creates the framework of a form routine (an ABAP subroutine) for you with the name prefix ur_. This routine is reusable, which means that you can use it in other objects in the project.
Prerequisites
Any fields whose contents are processed in a rule must be available at the time they are processed in the conversion program. Owing to the processing sequence, this is true for the fields of the source structure that is currently being processed as well as for any higher-level source structures. The fields of subordinate source structures are not available. Therefore, you must not refer to them in the rules.
When you create user-defined routines, you must also make sure of the following:
-
The correct number of source fields has been assigned (the number of input parameters for the routine)
-
The source fields have been assigned in the correct order (the order of the parameters).
Procedure
If you want to create a user-defined routine for the first time:
-
From the list of steps, choose Maintain Field Mapping and Conversion Rules. A dialog box is displayed.
-
Switch to change mode.
-
Position the cursor on the appropriate SAP field.
-
Choose Insert Rule. A dialog box appears.
-
Set the indicator for User-Defined Routine (Reusable). Choose Continue to confirm. A dialog box appears. The domain name of the field is displayed. When you continue by choosing Confirm, this name is adopted for your user-defined routine. However, you can also assign your own name. See also: Reusable Rules The Maintain Field Mapping and Conversion Rules screen appears again.
-
Double-click on User-Defined Routine to branch to the source code and edit the code.
-
Save your data and use F3 or Back to return to the Maintain Field Mapping and Conversion Rules screen. If you have already created user-defined routines: Do as described in the first four steps above and simply select the user-defined routine already created in step 5. Result The user-defined routine has been created and assigned. For an overview of all the fixed values, translations, and user-defined routines created, see the following step Maintain fixed values, translations, and user-defined routines. You should perform a syntax check after all the rules have been created.
If you have already created user-defined routines: Do as described in the first four steps above and simply select the user-defined routine already created in step 5.
Result
The user-defined routine has been created and assigned. For an overview of all the fixed values, translations, and user-defined routines created, see the following step Maintain fixed values, translations, and user-defined routines.