‎2007 Jun 04 2:49 PM
Hi Guys,
Can you suggest me a function module to generate a file name for a flat file to be save on application server using DATASET.
Required filename format : <table name >.<times tamp>.TXT
Thanks in advance.
‎2007 Jun 04 3:12 PM
I know OPEN DATASET will create the file, but I need the function module to generate the file name in following format.
<table name>.<time stamp>
Like I should be able to pass the table name, and FM gives me the full file name in above format.
‎2007 Jun 04 2:57 PM
You don't need a function module.. with the OPEN DATASET <filename>... FOR OUTPUT the system opens the file in write mode. If the file already exists, its existing content is deleted. If the file does not exist, the <b>system creates it</b>.
~Suresh
‎2007 Jun 04 3:12 PM
I know OPEN DATASET will create the file, but I need the function module to generate the file name in following format.
<table name>.<time stamp>
Like I should be able to pass the table name, and FM gives me the full file name in above format.
‎2007 Jun 04 3:19 PM
Hi mg,
You just need to concatenate the SY-UZEIT value to the table name you're providing. This can be done as follows:
CONCATENATE 'MARA' SY-UZEIT INTO FILE_NAME SEPARATED BY '.'.Regards
Anil Madhavan
‎2007 Jun 04 3:22 PM
data w_filename type FILEEXTERN.
put the table in the variable w_table
concatenate w_table sy-datum sy-uzeit into w_filename
separated by '.' .
open dataset w_filename for output in text mode.
~Suresh
‎2007 Jun 04 3:25 PM
Hi,
Please try this ...
DATA: BEGIN OF FILE1,
CONST1(01) TYPE C VALUE '_',
FIELD1 LIKE SY-DATUM,
CONST2(01) TYPE C VALUE '_',
FIELD2 LIKE SY-UZEIT,
END OF FILE1.
DATA: FILENAME LIKE EDI_PATH-PTHNAM.
MOVE SY-DATUM TO FILE1-FIELD1.
MOVE SY-UZEIT TO FILE1-FIELD2.
CONCATENATE <table name> FILE1 INTO FILENAME.
...
Regards,
Ferry Lianto