Skip to Content
0
Former Member
May 08, 2007 at 10:35 AM

Fetch data type of field symbol at run time

310 Views

Hi Gurus,

I have created dynamic internal table in my program in which i fetch records from different database tables. I write these records to a file using open dataset as :

OPEN DATASET ld_fullpath FOR OUTPUT IN TEXT MODE .

LOOP AT <l_t_table> INTO <l_line>.

clear: l_record.

do.

assign component sy-index of structure <l_line> to <fs>.

if sy-subrc <> 0.

exit.

endif.

l_string = <fs>.

condense l_string.

concatenate l_record l_string into l_record separated by l_sep.

enddo.

TRANSFER l_record TO ld_fullpath.

ENDLOOP.

the problem is that the date fiels are read from table as YYYYMMDD format and we have to write these in file as MM/DD/YYYY format.

The variables are declared as :

FIELD-SYMBOLS: <l_t_table> TYPE table,

<l_line> TYPE ANY,

<FS> TYPE ANY.

so at run time i need to find the data type of field symbol <fs> and if it is 'D' i need to change the format.

Please suggest how to do this?

Points assured for helpful answers.

Regards,

Abhishek