2010 Mar 24 3:46 AM
Hi Guys,
I have two internal table,
First one with fields A, B, C, D, E
Second one with A, E, D, C, B
I have to fill the second internal table from first internal table.
I dont want to use loop and do it(I am aware of doing it)... I tried using move corresponding but it is not supported.
Please let me know Is there any efficiently.
regards,
Prabhu
2010 Mar 24 3:53 AM
Hi,
One approach would be to try filliing the 2nd table at teh same time ur filling the 1st table instead of doing it after 1st table is filled..
BTW is there any specific purpose to rearranging one column, say for display or download?
-- Dedeepya
Hi Guys,
I have two internal table,
First one with fields A, B, C, D, E
Second one with A, E, D, C, B
I have to fill the second internal table from first internal table.
I dont want to use loop and do it(I am aware of doing it)... I tried using move corresponding but it is not supported.
Please let me know Is there any efficiently.
regards,
Prabhu
2010 Mar 24 3:53 AM
Hi,
One approach would be to try filliing the 2nd table at teh same time ur filling the 1st table instead of doing it after 1st table is filled..
BTW is there any specific purpose to rearranging one column, say for display or download?
-- Dedeepya
2010 Mar 24 4:27 AM
Hi,
Move-corresponding will work in loop or else to pass data from structure to structure only.
Once, you use mov-corres data will pass from-table to to-table header line only.
&----
*& Report ZTEST_100
*&
&----
*&
*&
&----
REPORT ztest_100.
TABLES: vbrk, vbrp.
types : BEGIN OF tvarv,
col_1,
col_2,
col_3,
col_4,
END OF tvarv.
types : BEGIN OF tvarv_1,
col_2,
col_1,
col_4,
col_3,
END OF tvarv_1.
DATA : tvarvc type tvarv occurs 0 with header line.
DATA : tvarvc_1 type tvarv_1 occurs 0 with header line.
tvarvc-col_1 = 01.
tvarvc-col_2 = 02.
tvarvc-col_3 = 03.
tvarvc-col_4 = 04.
APPEND tvarvc.
tvarvc-col_1 = 05.
tvarvc-col_2 = 06.
tvarvc-col_3 = 07.
tvarvc-col_4 = 08.
APPEND tvarvc.
append lines of tvarvc to tvarvc_1.
Write : 'kishore'.
2010 Mar 24 5:39 AM
ITAB1:-
FIELD :- A B C D E
VALUE:- 1 2 3 4 5
ITAB2:-A E D C B
FIELD:
IF u use append lines of itab1 to itab2.
then output is like
ITAB2:-A E D C B
FIELD: 1 2 3 4 5
If u use MOVE-CORRESPONDING itab1 to itab2
then output is
ITAB2:-A E D C B
FIELD: 1 5 4 3 2
becasue in itab1 E value is 5 so MOVE-CORRESPONDING is working fine
TABLES: vbrk, vbrp.
types : BEGIN OF itab1,
a,
b,
c,
d,
e,
END OF itab1.
types : BEGIN OF itab2_1,
a,
e,
d,
c,
b,
END OF itab2_1.
DATA : itab11 type itab1 occurs 0 with header line.
DATA : itab22_1 type itab2_1 occurs 0 with header line.
itab11-a = 01.
itab11-b = 02.
itab11-c = 03.
itab11-d = 04.
itab11-e = 05.
APPEND itab11.
break developer.
loop at itab11.
MOVE-CORRESPONDING itab11 to itab22_1.
append itab22_1.
endloop.
2010 Mar 24 5:42 AM
Not possible without using a loop if the field order is different in the two internal tables.
2010 Mar 24 6:40 AM
I agree with Vikranth.Reddy that why i give example with loop and MOVE-CORRESPONDING without loop not possible
2010 Mar 24 7:44 AM
>
> First one with fields A, B, C, D, E
> Second one with A, E, D, C, B
Is there a special reason why the field sequence in you second table is set up like that?
If there isn't, make them the same and then you can use:
itab2[] = itab1[]
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |