Hi Priyam
I hope it is an inbound scenario... It is basically working in the correct way as the idoc number and data is already stored before the control comes to your inbound FM where you can modify the values being passed to the tcode/BAPI. Now in case you want to modify the contents of the idoc which are reflected in WE02 then you will to modify the IDOC data using FM... please search on SCN for the same
NAbehet