‎2007 Jul 06 8:46 AM
i am moving fields from third internal table to first itab by using move corresponding itab3 to itab1.
i am geting the values but only the last row of itab3 for particular partner1 .
since itab3 is having more than one row for particular partner1.
all 3 itabs have different structure.
itab1 have more than 10 fields including partner2, name .
,itab2 has partner1 and partner2, itab3 has partner2 and name.
and i want to move itab3-partner 2 and itab-3 name to itab1
itab-partner = itab2-partner1
itab2-partner2 = itab-partner3
i am doing this way.
loop at itab1.
loop at itab2 where partner1 = itab1-partner1.
loop at itab3 where partner2 = itab2-partner2.
move corresponding itab3 to itab1.
modify itab.
endloop.
endloop.
endloop.
pls reply , thanks in advance
‎2007 Jul 06 8:52 AM
HI Ekta
DATA: FIELD1(10) VALUE '1234567890',
OFF1 TYPE I VALUE 1,
LEN1 TYPE I VALUE 2,
FIELD2(8) VALUE 'abcdefgh',
OFF2 TYPE I VALUE 3,
LEN2 TYPE I VALUE 4.
MOVE FIELD1+OFF1(LEN1) TO FIELD2+OFF2(LEN2).
TYPES: BEGIN OF ROW1_3,
CO1 TYPE I,
CO2 TYPE I,
CO3 TYPE I,
END OF ROW1_3.
TYPES: BEGIN OF ROW2_4,
CO2 TYPE I,
CO3 TYPE I,
CO4 TYPE I,
END OF ROW2_4.
TYPES: BEGIN OF MATRIX1,
R1 TYPE ROW1_3,
R2 TYPE ROW1_3,
R3 TYPE ROW1_3,
END OF MATRIX1.
TYPES: BEGIN OF MATRIX2,
R2 TYPE ROW2_4,
R3 TYPE ROW2_4,
R4 TYPE ROW2_4,
END OF MATRIX2.
DATA: ROW TYPE ROW1_3,
M1 TYPE MATRIX1,
M2 TYPE MATRIX2.
ROW-CO1 = 1. ROW-CO2 = 2. ROW-CO3 = 3.
MOVE: ROW TO M1-R1, ROW TO M1-R2, ROW TO M1-R3.
MOVE-CORRESPONDING M1 TO M2.
If move statement is not working properly try like this
modify ITAB3 transporting KBETRReward all helpfull answers
Regards
Pavan
‎2007 Jul 06 8:47 AM
‎2007 Jul 06 8:52 AM
HI Ekta
DATA: FIELD1(10) VALUE '1234567890',
OFF1 TYPE I VALUE 1,
LEN1 TYPE I VALUE 2,
FIELD2(8) VALUE 'abcdefgh',
OFF2 TYPE I VALUE 3,
LEN2 TYPE I VALUE 4.
MOVE FIELD1+OFF1(LEN1) TO FIELD2+OFF2(LEN2).
TYPES: BEGIN OF ROW1_3,
CO1 TYPE I,
CO2 TYPE I,
CO3 TYPE I,
END OF ROW1_3.
TYPES: BEGIN OF ROW2_4,
CO2 TYPE I,
CO3 TYPE I,
CO4 TYPE I,
END OF ROW2_4.
TYPES: BEGIN OF MATRIX1,
R1 TYPE ROW1_3,
R2 TYPE ROW1_3,
R3 TYPE ROW1_3,
END OF MATRIX1.
TYPES: BEGIN OF MATRIX2,
R2 TYPE ROW2_4,
R3 TYPE ROW2_4,
R4 TYPE ROW2_4,
END OF MATRIX2.
DATA: ROW TYPE ROW1_3,
M1 TYPE MATRIX1,
M2 TYPE MATRIX2.
ROW-CO1 = 1. ROW-CO2 = 2. ROW-CO3 = 3.
MOVE: ROW TO M1-R1, ROW TO M1-R2, ROW TO M1-R3.
MOVE-CORRESPONDING M1 TO M2.
If move statement is not working properly try like this
modify ITAB3 transporting KBETRReward all helpfull answers
Regards
Pavan
‎2007 Jul 06 8:53 AM
HI
TRY THIS.
LOOP AT ITAB3.
MOVE CORRESPONDING ITAB3 TO ITAB1.
MODIFY ITAB1.
ENDOOP.
PUT ALL OTHER CONDITIONS.
REWARD IF USEFUL/
‎2007 Jul 06 10:13 AM
hi
i am doing the same way but getting only one row from itab3 to itab1 for particular partner1
instead itab3 is having more than that
like for partner1 '304540' partner2 is '405454' 'abhishek'
'700069' 'satish'
but in itab1 only last row '700069' 'satish' is moving.
‎2007 Jul 06 10:14 AM
Hi Ekta,
may be ITAb2 is not having the more than one entry.
Regards,
Atish
‎2007 Jul 06 10:22 AM
hi atish
i debugged the report and found that within 3rd loop itab 3 is getting all
the rows
so there is no quetion of itab2 is empty.
i think some appending problem
thanks
‎2007 Jul 06 10:26 AM
Hi Ekta,
You are modifying ITAB1 based on the fields from ITAB3...Now your logic of MODIFYing the ITAB1 itself is wrong.
As lets say loop starts and the ITAB3 has three entries related to ITAB1 so it will LOOP at ITAB3 ..3 times but always MODIFY the last entry from ITAB3 to ITAB1 as ITAB1 is only in the same loop.
If you want ITAB1 should contain all those entries then you may use COLLECT..but still the logic you written is not good and not correct.
Try to change.
Reward points if useful.
Regards,
Atish
‎2007 Jul 06 10:17 AM
‎2007 Jul 06 10:23 AM
here is the example :
PARAMETERS p_name TYPE scarr-carrname DEFAULT '*'.
DATA: scarr_tab TYPE SORTED TABLE OF scarr
WITH UNIQUE KEY carrname,
spfli_tab TYPE SORTED TABLE OF spfli
WITH NON-UNIQUE KEY carrid.
FIELD-SYMBOLS LIKE LINE OF scarr_tab.
DATA spfli_line LIKE LINE OF spfli_tab.
SELECT *
FROM scarr
INTO TABLE scarr_tab.
SELECT *
FROM spfli
INTO TABLE spfli_tab.
LOOP AT scarr_tab ASSIGNING
WHERE carrname CP p_name.
LOOP AT spfli_tab INTO spfli_line
WHERE carrid = -carrid.
WRITE: / spfli_line-carrid,
spfli_line-connid.
ENDLOOP.
ENDLOOP.
reward points if it is usefull ....
Girish
‎2007 Jul 06 10:26 AM
‎2007 Jul 06 10:35 AM
Hi,
Ur logic of modifying is wrong, if I have understood ur requirements correctly for all the partner values in ITAB1 partner u want all the values of ITAB3 for all the partners . for that this logic won't work.
what u must do is define a table having similar structure as itab1 and inside the third loop append the entries to that table.
Thanks and Regards,
Saurabh Chhatre