‎2010 Mar 23 6:32 AM
Hi all i am uploading text file into application server, i want the data that is uploaded in fixed length delimiter.
My code is like
DATA:char_35(35) type c VALUE ' '. "35 spaces
LOOP AT it_output INTO fs_output.
concatenate
char_35
fs_output-werks
fs_output-wort01
fs_output-wregio
fs_output-invoice
Line_feed
into FS_output1 separated by htab.
TRANSFER fs_output1 TO filepath.
endloop.
With this i'm getting the file with tab delimiter as i gave separated by hextab.
I want to display the data in different positions like fs_output-werks should start from 36, fs_output-wort01 should start from 40, fs_output-wregio should start from 65 like i want to display the txt file in my specified length. So any suggestions on this.
Regards
VEnk@
Edited by: Venkat Reddy on Mar 23, 2010 12:03 PM
‎2010 Mar 23 6:41 AM
Then i think you have to define fs_output1 as TYPE string & use offsets
DATA:
fs_output1 TYPE STRING.
fs_output1+35 = fs_output-werks.
fs_output1+40 = fs_output-werks.
fs_output1+35 = fs_output-wregio.At the end do not forget to use the Line Feed .
BR,
Suhas
‎2010 Mar 23 6:41 AM
Then i think you have to define fs_output1 as TYPE string & use offsets
DATA:
fs_output1 TYPE STRING.
fs_output1+35 = fs_output-werks.
fs_output1+40 = fs_output-werks.
fs_output1+35 = fs_output-wregio.At the end do not forget to use the Line Feed .
BR,
Suhas
‎2010 Mar 23 8:10 AM
HI Suhas,
Thks for the prompt reply.
I have chnaged the code as suggested by you but line feed is not supporting, it is saying like. Statement "Line feed" is not defined. Here is my code below data is coming as expecting by in a single line.
Line_feed = cl_abap_char_utilities=>cr_lf.
LOOP AT it_output INTO fs_output.
fs_output1+36(4) = fs_output-werks.
fs_output1+40(25) = fs_output-wort01.
fs_output1+65(3) = fs_output-wregio.
fs_output1+68(10) = fs_output-invoice.
Line_Feed.
endloop.
What needs to be done for the Line feed, so that i can get the data in each line.
Regards
VEnk@
‎2010 Mar 23 8:16 AM
You already got fs_output1 data in required format,but where did you use
concatenate statement for line feed ?
‎2010 Mar 23 8:22 AM
Hi,
Define line feed like below.
"Define linefeed.
Thanks
Venkat.ODATA line_feed(2) TYPE c VALUE cl_abap_char_utilities=>cr_lf.
LOOP AT it_output INTO fs_output.
fs_output1+36(4) = fs_output-werks.
fs_output1+40(25) = fs_output-wort01.
fs_output1+65(3) = fs_output-wregio.
fs_output1+68(10) = fs_output-invoice.
fs_output1+78(2) = line_feed. "Pass this way.
ENDLOOP.
‎2010 Mar 23 8:25 AM
Hi Gautham,
Let me make you clear.
LOOP AT it_output INTO fs_output.
fs_output1+36(4) = fs_output-werks.
fs_output1+40(25) = fs_output-wort01.
fs_output1+65(3) = fs_output-wregio.
fs_output1+68(10) = fs_output-invoice.
TRANSFER fs_output1 TO filepath.
*Line_Feed. "Any other way where i can break the line after first loop and so on since line feed is not working.
endloop.
I have total 5 records in my it_output in that when first loop run fs_output1 willl carry the 4 records and when second time loop starts then i need to display the records in second line. I am getting all the records in single line.
My data is like
<35 spaces> 2145 MS 091454455 2145 MS 09454546....
I want 2145 MS 091454455
2145 MS 094545464 in this way.
REgards
VEnk@
‎2010 Mar 23 8:29 AM
Thks Venkat thks alot for your reply it is solved now. Make me clear why we need to take this line feed as 2 characters.
‎2010 Mar 23 8:42 AM
This is not just a line feed. CL_ABAP_CHAR_UTILITIES=>CR_LF consists of Carriage Return (1 character) & Line Feed (1 character).
Hence 2 characters
If you use CL_ABAP_CHAR_UTILITIES=>NEWLINE which is the constant for LineFeed you have to use 1 character only.
‎2010 Mar 23 6:41 AM
Duplicate post ... Please ignore ...
Edited by: Suhas Saha on Mar 23, 2010 12:12 PM