Hello Abhimanyu,
You will need macro to handle your scenario. Sample macro will look like below.
Two important functions which are required in the macro are : ACT_IOBJNM_VALUE and ROW_INPUT.
SAP Help link for Macro Functions:
Operators and Functions in Macros - Planning Area Administration - SAP Library
Hope this will help.
Thank you
Satish Waghmare