Академический Документы
Профессиональный Документы
Культура Документы
Step3: Create a FORM for your exit which will define its functionality. In form GET_EXIT_TITLES we have define our EXIT-NAME as 'U111'. So wee need to create a FORM with name U111 which will define the functionality of our user exit. Here I am taking a simple example of populating the Item Text (BSEG-SGTXT). *---------------------------------------------------------------------* * FORM U111 * *---------------------------------------------------------------------* * Populate Item Text (BSEG-SGTXT) *---------------------------------------------------------------------* FORM U111. DATA: wl_awkey TYPE bkpf-awkey. CONSTANTS: c_asterisk TYPE c VALUE '*', c_hypen TYPE c VALUE '-'. CLEAR wl_awkey. *-- Removing leading zeros CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = bkpf-awkey IMPORTING output = wl_awkey. *-- Set the item text CONCATENATE c_asterisk bseg-zuonr c_hypen wl_awkey INTO bseg-sgtxt. ENDFORM. "U111 You need to be cautious when writing code for your user exit. No dialog boxes, warning messages, information or error messages must be issued in an exit. Do not use any ABAP commands that cause you to leave the exit directly, for example LEAVE TO SCREEN. In the includes of the substitution exits, you must not use the commands MODIFY, INSERT or DELETE in the internally used structures such as BSEG or BKPF. These structures are interpreted internally as database tables because they are defined by a TABLES statement. As a result, the system writes, deletes or changes database records if you use the commands mentioned above. This can cause serious inconsistencies and problems in the document processing. If you want to change field contents in the exit type C_EXIT_PARAM_CLASS, you should make the changes in the internal table BOOL_DATA (for example BOLL_DATA-BSEG). Step 4:Run transaction GCX2 to update IMG to use your new program instead of Standard SAP program for substitution exits. Alternatively you can use SPRO for updating IMG. Run SPRO- Financial Accounting (New) - Special Purpose Ledger -Basic Settings - User Exits - Maintain Client Specific User Exits. Update the program name RGGBR000 with your new program ZTEST000 for application area GBLS. Now you can use this user exit for substitutions.
How to use custom user exit for a substitution? Go to transaction GGB1.Here you can create\change a substitution. I am not going in detail for creating a substitution .Specify the user exit(Highlighted area in red) for a field that is to be substituted buy your exit .
Also you can see the list of all the user exit on pressing F4 on the highlighted area in red. If your user exit is in active state, then it will be visible there. Once you have done the changes, Save it. Now your user exit will be invoked automatically for that field.