Hello Riya,
I think you are basically working in SAP BW and there you are trying to achieve this function. I have worked as an ABAPer for BI/BW and my BW technical head used to apply routines and the data used to go through those routines before being put in the tables or infocubes. So you can use a routine to achieve this, no need for BADI.
Hope that helps.
Regards,
Chandni Sharma.