HI Adithya,
You need to create validation as below:
Prerequisite:
SYST-TCODE = 'FB01'
Check:
NOT BSEG-HKONT IN TEST_SET
Message:
Message type: E and provide message no.
* Test_set is your set
Please make sure that other transactions are working properly with the same GL code before releasing to production.
Thanks & Regards,
Prasad