Hello Amith Prasanna,
Question is; in which form you want to set the dimension as mandatory?
You can define financial dimensions mandatory in many ways as per the following.
--- In the account structure; set the desired dimensions as mandatory and then activate the structure. You may need to perform "Recalculate ledger periods" in Ledger form too after that.
--- Else; set fixed default financial dimension value in Main accounts form itself under "Legal entity overrides" section.

--- You can also create "Advanced rule structure" where you can define main account with different dimension combinations to validate during transaction posting. After that, link that advanced rule structure with the account structure and activate.
Therefore; whenever transactions are created in system, it will always validate the financial dimensions to select. This you can achieve without any customization.
Best regards,
Sourav Dam
Kindly mark this thread 'Yes' if this is answered your query which may help other community members in this forum.