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: 

Transfer records to UNIX with different record length

Former Member
0 Kudos

Hi all,

I have the following problem. I have to transfer records to a UNIX file. The maximum length of a record is 2000. The records are TAB seperated. I also have records which have a length less then 2000. When i look at the file in Excel the last field is always very large. Isn't there a way to only transfer the real length of the record. I have tried to transfer the record in Binary an Text mode. I used the Length statement, but nothing worked for me.

Hope anyone can help me.

Greetings Maarten

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Maarten,

"Transfer" with "length" option should work. I am not sure what you passed as length to the "transfer" command. Did you used a fixed length of 2000 or did you actually found out the record length of each record and passed that value?

Scenario 1.

Here in this scenario, you will always have the last field set to maximum length.

loop at itab.

transfer itab-record to file length 2000.

endloop.

Scenario 2.

In this second scenario, you should have your excel's last field set to the maximum occupied length of that field.

loop at itab.

v_len = strlen( itab-record ).

transfer itab-record to file length v_len.

endloop.

Hope this helps.

Srinivas

3 REPLIES 3

Former Member
0 Kudos

Hi Maarten,

"Transfer" with "length" option should work. I am not sure what you passed as length to the "transfer" command. Did you used a fixed length of 2000 or did you actually found out the record length of each record and passed that value?

Scenario 1.

Here in this scenario, you will always have the last field set to maximum length.

loop at itab.

transfer itab-record to file length 2000.

endloop.

Scenario 2.

In this second scenario, you should have your excel's last field set to the maximum occupied length of that field.

loop at itab.

v_len = strlen( itab-record ).

transfer itab-record to file length v_len.

endloop.

Hope this helps.

Srinivas

0 Kudos

Hi,

When i am back at work, i will directly try it. I will let you know at the beginning of next week if it worked.

Greetings Maarten.

0 Kudos

Hi Maarten,

Did this work for you? If so, can you please mark this as being answered and assign some points?

Regards,

Srinivas