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

Problem in downloading data from application server

Former Member
0 Likes
531

Hi,

I tried the following code for downloading data to PC in background:

PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY.

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc = 0.

LOOP AT itab INTO istab.

TRANSFER istab TO p_file.

ENDLOOP.

ENDIF.

Here, the contents are not getting transferred to the p_file. I give the path of the file while executing the program.

First of all, the file is not getting created in PC. And the statement 'OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT'. is working but unable to read after that using READ DATASET statement.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
508

Hi,

This will create a file in the application server with the name you pass in p_file say '.\w_file.txt', check the file in AL11 after creating in.Use CG3y to download data into presentation server

Thanks & Regards,

Mani

4 REPLIES 4
Read only

Former Member
0 Likes
508

This will create a file in the application server with the name you pass in p_file say '.\w_file.txt', check the file in AL11 after creating in.

PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY.


OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.


LOOP AT itab INTO istab.

TRANSFER istab TO p_file.

ENDLOOP.

CLOSE DATASET p_file.

Read only

Former Member
0 Likes
508

HI,

You can use this code .............

OPEN DATASET gv_dataset for input in text mode encoding default.

IF sy-subrc = 0.

DO.

clear gv_rec.

READ DATASET gv_dataset INTO gv_rec.

if sy-subrc <> 0.

append gv_rec to gt_raw.

exit.

endif.

append gv_rec to gt_raw.

ENDDO.

CLOSE DATASET gv_dataset.

ELSE.

gv_retcode = 1.

ENDIF.

Regards,

jayan

Read only

Former Member
0 Likes
508

Hi

If you need to transfer a file in Application server the addition FOR OUTPUT is right, so if you can't transfer any data, u should check if the system can create the file: so the value of SY-SUBRC.

U make sure the structure ISTAB has char field only.

Max

Read only

Former Member
0 Likes
509

Hi,

This will create a file in the application server with the name you pass in p_file say '.\w_file.txt', check the file in AL11 after creating in.Use CG3y to download data into presentation server

Thanks & Regards,

Mani