SAP Finance Validation: Prevent GL Account Sets from Posting to Cost Centers
Abdullah Galal ??
★SAP Finance Solution Architect, Consultant, Community Champion and SAP Press Author
Intro:
There's always an issue that SAP users by mistake post some GL accounts to cost centers although according to company policy these accounts should only post to internal orders or production orders.
The same approach provided below can also be manipulated to allow specific cost centers for specific GL Accounts
The best way to prevent this mistake is to use Validation Rules (Trx GGB0) and specify the GL accounts that are not allowed on a cost center so the user gets an error whenever SAP is posting these GLs to a Cost Center.
Since validation rules are part of system config, it's a lot of headache to change the GLs in the rule later in case a new GL is created or an exception is needed.
To be able to edit the rule's GLs without doing any configuration, we can maintain an Account Set in the validation rule instead of specific GL accounts, in this case the Set can be edited freely in Production environment (by authorized users).
This will involve creating a user exit and editing a copy of a standard SAP program
Steps:
1) Trx GS01 > Create the Account set
2) Trx SE38 > Copy program RGGBR000 to ZRGGBR000 and add the below code at the end of the standard code
-----------------------------------------------------
exits-name = 'ZCC'.
exits-param = c_exit_param_none.
exits-title = text-103.
APPEND exits.
FORM ZCC USING b_result.
RANGES: GLS FOR BSEG-HKONT.
Select VALSIGN AS SIGN VALOPTION AS OPTION
VALFROM AS LOW VALTO AS HIGH
FROM SETLEAF INTO CORRESPONDING FIELDS OF TABLE GLS
WHERE SETNAME = 'GL_CC_BLOCK'.
if SY-SUBRC = 0.
IF BSEG-HKONT IN GLS.
b_result = b_true.
else.
b_result = b_false.
ENDIF.
endif.
ENDFORM.
------------------------------------------------
3) Trx GCX2 >> Assign program ZRGGBR000 to Validation Rule Exits
4)Trx GGB0 >> Create Validation
5) Trx OB28 >> Activate Validation on the company code level
Now test the validation using any transaction, try FB50
Thank you for reading.
Best regards,
Abdullah Galal
SAP Finance and Integration Consultant
Solution/Delivery Architect | S/4 HANA FICO
7 年As per my experience we can directly write prerequisite as BSEG-HKONT IN GL_CC_BLOCK1 This statement will identify the GL accounts in prerequisite for valisation. My point is we may not need the exit for this. This also removes dependence on ABAPer.
Application Development Team Lead at Accenture (SAP FICO Consultant)
7 年Nice explaination.
Senior Manager-SAP Consulting at PWC Middle East
8 年Good job abdullah