Hello reader, I supposed you already known how to use Substitution or Validation in SAP, If you want to read my article about Substitution or Validation before you can go to links below.
Ok, any of you must have a requirement to change any of fields in FI Doc either Line item or Header FI Doc during MIGO. As you know MIGO Posting will create FI Doc as well. So you can change value of any FI Doc field via Substitution user exit.
For example we want to change Profit Center in FI Line item to get Profit Center from WBS Element ( BSEG-PROJK ).
1.Create Substitution via tcode GGB1 – this prerequisited substitution only run when SY-TCODE = ‘MIGO’.
Click on Substitution node and press button + , select what field you want to substitute, for example select BSEG-PRCTR ( Profit Center ).
Enter U900 in field Exit. but before you enter U900 in that field you need to create substitution user exit with name of sub routine is U900 so let that field as empty for now.
2.Go to SE11 and Open table T80D, you can see on row GBLS , copy program RGGBS000 via SE38 tcode into custom namespace for example copied into ZENH_FI_RGGBS000.
3.Open ZENH_FI_RGGBS000 via SE38 tcode.
In sub routine get_exit_titles you need to write code like this.
exits-name = 'U900'.
exits-param = c_exit_param_field.
exits-title = TEXT-900. "Cons. transaction type
APPEND exits. "from xref1/2
Note : write c_exit_param_field because you need to return value of new Profit center in sub routine u900 later.
FORM u900 USING im_prctr.
"Description : Change PRofit Center in order to get profit center from WBS in FI Doc during MIGO
DATA : lv_prctr TYPE prctr.
DATA : gw_prps TYPE prps,
gv_pspnr TYPE prps-pspnr,
gv_mem TYPE sy-uname,
gv_prctr TYPE prps-prctr.
MOVE bseg-projk TO gv_pspnr.
SELECT SINGLE pspnr objnr prctr FROM prps
INTO CORRESPONDING FIELDS OF gw_prps
WHERE pspnr EQ gv_pspnr.
IF sy-subrc EQ 0.
im_prctr = gw_prps-prctr.
Note : add new subroutine with name u900.
4. After you activate ZENH_FI_RGGBS000, you can go to step 1, enter U900 in field Exit then Save. After that you can go to tcode OBBH and create new entry like this. Substitution column you can enter ZPRCTR according the name of substitution you’ve created before. CallPnt select 2 ( Line Item ) and Activtn Level select 1 (Active).
5.The final step you need to run program RGUGBR00 via tcode SE38. this program will regenerate all program related substitution. because if you forget to run this program the error message will show which said U900 doesn’t exist in RGGBS000 where it is still refered to old value in table T80D not refer to ZENH_FIRGGBS000.
6. After you finished all step you can test create Material Document via MIGO and check field BSEG-PRCTR in FI Doc.
Incoming search terms:
- sap how to populate xref1 in IDoc
- user exit cost center migo
- sap fi substitution user exit
- abap migo user exits for wbs element
- sap badi fi substitutions
- how to use the user exit
- user exit examples to substitute functional area using RGGBS000
- fi substitution enable fields
- how to find substitution rule related to ant tcodein fi
- FI document substitutions SAP