Hello Nikhil,
I have written commit work inside this FM soon after this Modify statement to avoid any possibility of not updating this table.
IMO the best way to ensure the integrity of the SAP transaction is to bundle the DB changes of the table(read: in concern) together with other DB updates. This will maintain the "atomicity" of the SAP transaction, i.e., either all or none of the changes are registered in the DB.
Think of the scenario when the SAP transaction fails but your table gets updated, how would you handle it?
Afaik there is no way you can keep the update local to your FM if it is being executed in the same LUW as others. COMMIT will end the current SAP LUW and trigger the bundled DB updates
If you can provide the business logic you are trying to achieve may be the forum can provide some suitable workaround.
BR,
Suhas