Application Development 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: 

FM to read any file from application server

Former Member
0 Kudos

Hi,

I want to read stat.dat file from AL11 transaction.

The file contents are not in readable format, how can i read such file ?

can anyone tell me where these files are saved in appl. server.

Thanks

Jaya

9 REPLIES 9

babu_kilari4
Active Contributor
0 Kudos

Hi Jayak,

You need to use DATASET Concept to read such files.

Press F1 on DATASET or use ABAPDOCU transactions to know more about App Server Programs.

Hope it helps

Thanks,

Babu Kilari

former_member305388
Active Contributor
0 Kudos

Hi, In AL11 files will be saved in folders, so u need to knowthe path for a particular file. Once you get the path, just use OPEN DATASET, READ DATASET and CLOSE DATASET to get the file content into some internal table..

Hope this helps you...

0 Kudos

Hi,

Please have a look to file content. It's showning content like below pasted line.

*##############c#S#E###S#A##0##### #t#5#B#7#2#1#C#D#E#8#4#5#E#F#1*

How can i read such file in readable plain format (by doing some decodeing to it)

Thanks

Jaya

0 Kudos

First of all try to rename the file with .txt format.

Then try reading it. If still the problem persists, use UNICODE concept to read the characters.

Hope this is useful pointer

0 Kudos

Not getting any helpful information about using UNICODE.

can you help me. can you please send some sample program.

0 Kudos

Try Searching in SDN itself. You should get it.

Also, Did u make sure that the file with .dat is not corrupted one.

Because, when you rename the file from .dat to .txt if the data is in readable format .txt should also be in readable.

And about UNICODE, even I have never tried but thot of helping u by giving someguidline because it can handle more number of characters set than the ordinary ones.

Former Member
0 Kudos

Hi:

It can be done by using open dataset. for details

have a look

[Link|http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3ca6358411d1829f0000e829fbfe/content.htm]

Regards

Shashi

Former Member
0 Kudos

Hi

First of all you need to save the file in .TXT (tab delimited) format in AL11.

Then go for the following code:

OPEN DATASET <filename> FOR INPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc NE 0.

MESSAGE 'Error while opening dataset ' TYPE 'E'.

ELSE.

DO.

READ DATASET <filename> INTO wa_upload." MAXIMUM LENGTH 8000 .

IF sy-subrc NE 0.

EXIT.

ENDIF.

APPEND wa_upload TO it_upload.

CLEAR : wa_upload.

ENDDO.

  • Closing the file

CLOSE DATASET <filename>.

ENDIF.

Hope this helps,

Regards,

Arnab.

Former Member
0 Kudos

First you have to check the file type. You can use OPEN DATASET, READ DATASET and CLOSE DATASET.You can save the data into an internal table.

Regards,

Joan