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

Strange problem with TRANSFER statement

Former Member
0 Likes
1,439

Hi!

I am facing a strange problem:

I am transferring data to file on application server.

Sometimes the data is duplicated or a additional corrupted line is transferred.

There is no way in code that such data be sent.

Is there any possibility that, if the TRANSFER statement fails internally system retries to send data without making sy-subrc 0 causing some additional data to be written?

Has anyone faced similar problem?

Thanks & Regards,

Shreyas.

Help will be rewarded.

7 REPLIES 7
Read only

Former Member
0 Likes
1,002

There is no such possibility of resending the data.

MOreover Transfer statement doesn't return a Sy-subrc at all.

Regards,

ravi

Read only

0 Likes
1,002

Check whether there is any junk line added to the internal table in the program before transferring it to the file.

Thanks,

Read only

Former Member
0 Likes
1,002

put a break point before transfer statement & check what text is transferring in each loop.

there is NO such possibility of sending data on its own by SAP. whatever is there in the internal table only will be stored in the file.

regards

srikanth

Read only

Former Member
0 Likes
1,002

Hi,

First check your Open dataset working properly or not. then see the transfer.

OPEN DATASET file for output in text mode encoding default.

if sy-subrc = 0.
loop at itab.
transfer itab to file.
endloop.

close dataset.
if sy-subrc <> 0.
"error.....
endif.

Regards

vijay

Read only

Former Member
0 Likes
1,002

Hi,

In the TRANSFER statement has used,

Note:

<u><b>The runtime system produces a runtime error message if there was a problem during the execution of the TRANSFER statement. A possible error might be that free space on the drive is exhausted.</b></u>

U can use LENGTH addition.

By default, data is transferred in the length of the respective field or structure. If you prefer to transfer a different number of bytes, add the parameter LENGTH to the TRANSFER command followed by the actual length.

<i><b>Sample Code:</b></i>

data: len type i.

loop at it_customers.

len = strlen(it_customers-name).

TRANSFER it_customers-name to filename LENGTH len.

endloop.

Read only

Former Member
0 Likes
1,002

Verify if you already have the file in the directory. See if you are downloading in append mode rather than overwrite mode. This will probably explain the duplicate records. Assuming your internal table is ok, download it to desktop, and see if you see the corrupted records. Also check if your internal table has fields that are not character or character like fields. You should not download fields that are pack, decimal, currency etc types.

Read only

0 Likes
1,002

By the way, what are you using to look at the downloaded data? Sometimes, depending on what you are using to view the data, you may have unexpected display.