Sunteți pe pagina 1din 7

User exit to display Vendor name in Payment run in FI

By Shashikant Chandratre
Document Description User exit to display Vendor name in Payment run in FI Creation of user exit using substitution method for payment run (F110) to display Vendor name

1. Document Objective

Business Requirement:
When Automatic Payment Program is run (T.Code F110), the Text fields in both the Line Items of the Clearing Document Generated should display the Vendor Name. We need to create a new Substitution Rule to populate the field BSEG-SGTXT automatically with the vendor name (LFA1-NAME1) for journal entries created during the execution of transaction F110. Create entry using TCode OBBH Call Up Point 2 (Line Item) Prerequisite based on: Transaction code F110 (BKPF-TCODE = F110) and Document Type equal to KZ (BKPF-BLART=KZ)

Create a user exit to move the vendor name (LFA1-NAME1) to both line items.
Substitutions can be used for validating data at the time of entry in SAP system. This document can be used for creating custom user exits so that one can set his validations & conditions. User exits are user defined FORM routines that are used to calculate/replace values with in a substitution .I have shown demo for FI ( F110-Payment run ) but same steps with some minor modifications can be used for other areas too.

Here our requirement is when the Automatic Payment Program is run (T.Code F110), the Text fields in both the Line Items of the Clearing Document Generated should display the Vendor Name. The field name is BSEG-SGTXT where the Vendor Name is to be displayed.
2. Document Details This Document contains two parts:

1. Creation user exist and Coding. 2. Customization of Substitution settings.


1. Creation user exist and Coding: Steps for creating user exits for substitutions.

The exits used for substitutions are stored in a Include program.RGGBS000 is a standard include given by SAP for user exits for substitutions. So for creating custom user exits, one has to copy this include to a 'Z' (Custom namespace) program. Step1 : Create a copy of include RGGBS000 ,let say ZRGGBS000.The length of the name you choose should not exceed 8 characters. Step2 : Define your user exit in the FORM routine GET_EXIT_TITLES with the correct exit type (EXITSPARAM). exits-name = 'U903'. exits-param = c_exit_param_none. exits-title = text-100. "Give any suitable text for your exit APPEND exits. Include the EXIT NAME , PARAM and TITLE in the form GET_EXIT_TITLES .This form GET_EXIT_TITLES contains name and titles of all available standard exits. Every new exit need to be added to this from. One has to specify a parameter type to enable the code generation program to determine correctly how to generate the user exit call ,i.e. How many and what kind of paramter(s) are used in the user exit. The following parameter types exist: TYPE Description ------------------------------------------------------------------------------------------------------C_EXIT_PARAM_NONE Use no parameter except B_RESULT . If you do not want to substitute a field, use this parameter in the substitution . C_EXIT_PARAM_FIELD Use one field as param. Exactly one field is substituted. C_EXIT_PARAM_CLASS Use a type as parameter. Here we are using C_EXIT_PARAM_FIELD Step3: Create a FORM for your exit which will define its functionality. In form GET_EXIT_TITLES we have define our EXIT-NAME as 'U903'. So we need to create a FORM with name U903 which will define the functionality of our user exit. Here In our example we are populating the Item Text (BSEG-SGTXT). *---------------------------------------------------* * FORM U903 * *---------------------------------------------------* * Populate Item Text (BSEG-SGTXT) *---------------------------------------------------* FORM U903 changing p_sgtxt type bseg-sgtxt. data: l_name type lfa1-name1. select single name1 into l_name from lfa1 where lifnr = bseg-lifnr. if sy-subrc = 0. move l_name to p_sgtxt. EXPORT p_sgtxt to MEMORY id 'Z00_FI_TXT'. clear: l_name. else. import p_sgtxt from MEMORY id 'Z00_FI_TXT'. endif. endform. "U903 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. Step 4: Run transaction GCX2 to update IMG to use your new program instead of Standard SAP program for substitution exits.

Update the program name RGGBR000 with your new program ZRGGBS000 for application area GBLS. Now you can use this user exit for substitutions. Save it will ask for customization request. 2. Customization Substitution settings: Here we are creating user exit using substitution method. Step I. Go to transaction OBBH

Enter the company code for which substitution rules is applied e.g. here we have entered the Company code as SV10. Select call up point 2 as this requirement is for line item. Below is the Details to select callup point. Application area CO GL Callup point 1 1 2 FI 1 2 3 5 Description Document line item Document header Document line item Document header Document line item Total document Cost of sales accounting

Double click on substitution, you would get the following screen., Expand the line item create the substitution with name FI_903.

Click here to continue.. Expand FI_903 and click on prerequisite as shown in below screen, here you can put the condition at which user exit should trigger. As per requirement here It should trigger for transaction code F110 and Document type KZ.

Tab Table Fields in above screenshot shows list of structures, Select the structure (Double click ) accounting document header as condition are applied here

In the above screenshot you will get fields associated with structure Accounting document header here you will be getting fields Transaction code and Document Type. Please find the below screenshot.

Once condition is applied double click on the substitutions and give the User exit name create shown below in Red box.

Save all above settings and provide the workbench request.

S-ar putea să vă placă și