‎2009 Aug 10 8:35 AM
Dear All,
Hope you have a solution.
In a program, I have a field type String.
In this field I put some values separated by TAB -
I would like to take this field and put it in the header line of an internal table.
The length of the values put on the string file is not fix.
Ex: ITAB
Field1(50)
FIELD2(50),
Field3(50)
FIELD4(50)
Field_string = 'TOTO#TATA#TITI#TUTU#'
I would like to obtain
ITAB-field1 = TOTO
ITAB-field2 = TATA
ITAB-field3 = TITI
ITAB-field4 = TUTU.
And of course I don't want to write something like
IF 1 then ITBA1-FIELD1 = u2026
IF 2 then ITBA1-FIELD2 = u2026
I'll be surprised that we can't do that in one coding line.
DO you have an idea ?
Thanks in advance
‎2009 Aug 10 8:44 AM
Hi
Use the following syntax
SPLIT Field_string AT tab INTO ITAB-field1 ITAB-field2 ITAB-field3 ITAB-field4.
‎2009 Aug 10 8:43 AM
Study ABAP online help for statement SPLIT and try applying it to your case.
Thomas
‎2009 Aug 10 8:44 AM
Hi
Use the following syntax
SPLIT Field_string AT tab INTO ITAB-field1 ITAB-field2 ITAB-field3 ITAB-field4.
‎2009 Aug 10 8:48 AM
hi,
see the below pseudo code
DATA : text TYPE string VALUE 'toto#tata#titi#tutu',
it_tab TYPE TABLE OF string,
wa_tab LIKE LINE OF it_tab.
SPLIT text AT '#' INTO TABLE it_tab.
" it_tab contain four rows
LOOP AT it_tab INTO wa_tab.
"loop it_tab and do your operations
ENDLOOP.
BREAK-POINT.Thanks
‎2009 Aug 10 8:48 AM
Hello
split Field_string at '#' into itab-field1 itab-field2 itab-field3 itab-field4.