04-27-2006 11:58 AM
i have big itab with 1 column.
example:
1224321 213123 3423def efdfe d fddf dfd d d d d3333
how i can cut the fields into another itab?
04-27-2006 12:04 PM
Hi rani,
1. No need to cut.
2. just use ptab[] = itab[].
3. like this (just copy paste)
REPORT ABC.
DATA : BEGIN OF ITAB OCCURS 0,
F(100) TYPE C,
END OF ITAB.
DATA : BEGIN OF PTAB OCCURS 0,
A(1) TYPE C,
B(3) TYPE C,
C(5) TYPE C,
END OF PTAB.
ITAB-F = '1234567890'.
APPEND ITAB.
PTAB[] = ITAB[].
BREAK-POINT.
regards,
amit m.
04-27-2006 11:59 AM
hi
use <b>OFFSET</b> i.e,
<b>
Offset</b>
Data p(6) value 1224321 213123 3423def efdfe d fddf dfd d d d d3333, q(3).
<b>q = p+2(3).</b>
Write 😕 q.
q = p+0(1).
Write:/ q.
Regards,
Santosh
04-27-2006 12:03 PM
You can use the split command.
loop at itab.
split itab at space into itab1-field1
itab1-field2
itab1-field3.
append itab1.
endloop.
now itab1 will have data in the form of separated fields.
regards,
Ravi
04-27-2006 12:04 PM
Hi rani,
1. No need to cut.
2. just use ptab[] = itab[].
3. like this (just copy paste)
REPORT ABC.
DATA : BEGIN OF ITAB OCCURS 0,
F(100) TYPE C,
END OF ITAB.
DATA : BEGIN OF PTAB OCCURS 0,
A(1) TYPE C,
B(3) TYPE C,
C(5) TYPE C,
END OF PTAB.
ITAB-F = '1234567890'.
APPEND ITAB.
PTAB[] = ITAB[].
BREAK-POINT.
regards,
amit m.
04-27-2006 12:04 PM
Hi,
You can use offset or 'split at space' and copy into fields of another itab.
regards
-Rakesh
04-27-2006 12:05 PM
Hi,
If you know the length of the field you can use substring
LV_FIRST_FIELD = ITAB-FIELD+0(4)
LV_SECOND_FIELD = ITAB-FIELD+4(10)
If the field has delimiters like space or comma you can use the SPLIT
SPLIT ITAB_FIELD AT <DELIMITER> INTO LV_FIRST_FIELD LV_SECOND_FIELD
Regards,
Sameena
04-27-2006 12:06 PM
Hey Rani,
make a new table itab with the fields you require.
You need to use offset method in this case.
loop at old_tab.
old_tab-col_name+0(2) = itab-field1.
old_tab-col_name+1(3) = itab-field2.
old_tab-col_name+4(5) = itab-field3.
append itab.
endloop.
You need to to decide the value of field and go ahead with this method..
If ur not sure of the length of the field, the above method wont work..
In that case, Use spilt method..
Regards,
Tanveer.
Please Mark helpful answers.
04-27-2006 12:08 PM
Hi Rani,
Depends on what sort of splitting you want. One possible way -
itab1 is the big itab, itab2 is split itab
loop at itab1 into wa1.
clear wa2.
split wa1 at space into wa2-field2 wa2-field2 ...
append wa2 to itab2.
endloop
Regards,
Aniket
04-27-2006 12:09 PM
hi Rani.
You can use OFFSET statement
Use Statement
Itab-fieldname+leaving_character(starting_character)
e.g.
constant = itab-f1+6(7)
now move this constant into another tale field as
itab1-field = constant
and also rotate this in loop so this can be done for every row in table.
Regards,
Robin.