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

Issue generating file with Transfer statement

Former Member
0 Likes
470

hello all,

I'm facing an issue with the transfer statement , i try to dump the content of a table into a file (in the sample code i'm trying only with one field).

The code is not generating any file in output, even if i have authorization to write in the directory to save the file generated.

The sample code is following:

TABLES:

        /BIC/AZD_LOG0100.

DATA:

        BEGIN OF  w_hist,

              Customer LIKE /BIC/AZD_LOG0100-/BIC/C_DO_ADV,

        END OF w_hist,

        i_hist LIKE TABLE OF w_hist.

DATA:

        filename TYPE string.

DATA:

fdir TYPE string value '\temp\'.

SELECT /BIC/C_DO_ADV

FROM   /BIC/AZD_LOG0100

INTO   TABLE i_hist.

CHECK NOT i_hist[] is initial.

SORT i_hist by Customer.

CONCATENATE FDIR 'test.csv' INTO filename .

OPEN DATASET filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT i_hist INTO w_hist.

    WRITE w_hist-Customer TO w_hist-Customer no-zero.

    TRANSFER w_hist-Customer to filename.

ENDLOOP.

CLOSE DATASET filename.

if sy-subrc = 0.

write: 'OK'.

endif.

Thank you for help.

2 REPLIES 2
Read only

Former Member
0 Likes
433

Hi,

Try using

TRANSFER w_hist to filename.

Also Comment WRITE w_hist-Customer TO w_hist-Customer no-zero.

just to test if above Transfer is working properly for time being..

Thanks,

Vikas.

Read only

Former Member
0 Likes
433

Did you got your issue Resolved?

Thansk,

Vikas