Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

extract file from application server

Former Member
0 Likes
850

Hi, All

in our application server ther is a file in
tmp\sap\legacy\filename_yyyymmddhhmmss.txt this file gets generated every day night so when i run my program i need to get the data in the file to my internal table.

i have to use data sets to do this

can any one send me the code for this please

thanks,sri

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
677

Type READ on your ABAP editor then put cursor on top of READ and press F1 key. Select the READ DATASET option. The Help has sample code.

Regards

Nic

4 REPLIES 4
Read only

Former Member
0 Likes
677

Hi,

PARAMETERS: p_file(100).

DATA: BEGIN OF itab OCCURS 0,

f1(10),

f2(20),

*******Give the field names accordingly to the length of each column..

END OF itab.

START-OF-SELECTION.

OPEN DATASET p_file.

IF sy-subrc = 0.

DO.

READ DATASET p_file INTO itab.

IF sy-subrc <> 0.

EXIT.

ELSE.

APPEND itab.

CLEAR itab.

ENDIF.

ENDDO.

ENDIF.

CLOSE DATASET p_file.

Thanks,

Naren

Read only

0 Likes
677

Thanks naren

and where do i give the file name which i have in the application server because a new file will be created every night

thanks

Read only

Former Member
0 Likes
678

Type READ on your ABAP editor then put cursor on top of READ and press F1 key. Select the READ DATASET option. The Help has sample code.

Regards

Nic

Read only

Former Member
0 Likes
677

Hi,

If the file is created once in a day..Why do you have time in the filename..

To solve this issue..

you can create a logical file name in the FILE transaction..

You can give parameter in the filename..

Then use the function module FILE_GET_NAME by passing the logical file name and SY-DATUM in the PARAMETER_1 parameter...

It will give the physical filename..

Thanks,

Naren