12-24-2004 9:37 AM
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
12-27-2004 9:03 PM
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
12-27-2004 9:03 PM
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
12-30-2004 6:33 PM
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.
01-07-2005 9:40 PM
Hi Maarten,
Did this work for you? If so, can you please mark this as being answered and assign some points?
Regards,
Srinivas