Hello Aditya,
Due to security concerns I cannot post the code.
But will let you know as how I have written the code, it as below:
if r_sess = abap_true.
perform open.
perform transaction.
perform close.
endif.
In perform open, BDC_OPEN_GROUP is written. In perform transaction, there is a loop which is reading the data from the file one by one and BDC_INSERT is inside this loop.
Thank you.