Hi Ravi,
We did that from scratch at my company. It wasn't too difficult. I inherited the program and it was very well written when I had to make modifications. The UI logic selected a group of records from REGUH based on criteria and passed them to a custom FM, which created and saved the file. Obviously I don't have the space or the will to go into detail about what the application logic would look like, but if I had to design it myself, I'd put the application in a custom class with the following API and UI layer:
DATA: gt_reguh TYPE TABLE OF REGUH,
go_ach_util TYPE REF TO zcl_ach_file_builder.
SELECT ...
FROM REGUH
INTO gt_reguh ...
* The object constructor would build the file
* and store the lines in an object attribute
CREATE OBJECT go_ach_util EXPORTING gt_reguh.
* Show the user the file before they save it.
* An ALV will probably be fine.
CALL METHOD go_ach_util->preview
IMPORTING
action = g_action.
* Possibly call a file save dialog to prompt user
* for file path.
IF g_action = 'SAVE'.
CALL METHOD go_ach_util->save
EXPORTING
path = l_path_to_your_folder.
ENDIF.
Hopefully this helps. I wish you the best.