‎2007 Oct 21 11:34 AM
Hi all,
i have two intenral table , itab and jtab.
i need to move data from jtab to local variable , but it should based on another internal table(jtab) record.
For example <b>itab has customer number , customer name
jtab customer number and customer value</b>.
i need to move based on customer name , customer value to local varible.
Thanks in advance,
Regards,
Bhaskar
‎2007 Oct 21 11:41 AM
Hi Bhaskar,
LOOP AT itab.
READ TABLE jtab ..based on itab-customer name.
IF sy-subrc = 0
..move value to local variable.
Regards,
Atish
‎2007 Oct 21 11:40 AM
loop at itab.
read table jtab with key number = itab-number.
if sy-subrc = 0.
write:/ itab-name, jtab-value.
endif.
endloop.
‎2007 Oct 21 11:41 AM
Hi Bhaskar,
LOOP AT itab.
READ TABLE jtab ..based on itab-customer name.
IF sy-subrc = 0
..move value to local variable.
Regards,
Atish
‎2007 Oct 21 11:52 AM
Hi atish,
Thank u for reply.
my internal table does not have header line.
itab has fallowing values
customer internal number customer value
00001 y
00002 x
00003 s
00004 m
Jtab has fallowing values
Customer name customer internal number
z_001 00001
z_002 00002
z_003 00003
z_004 00004.
Now i have requiremnt to pass customer value to local variable based customer name . here customer names are constant values
i write fallowing code, can u advice me based on this for passing value.
LOOP AT itab into l_wa_itab.
READ table jtab into l_wa_jtab with key atinn = l_wa_itab-atinn.
CASE l_wa_jtab-atinn.
WHEN z_001.
MOVE itab-atwrt TO <b>l_v_val_class_01</b>.( local variable )
WHEN z_002.
MOVE itab_atwrt TO l_v_val_class_02.
WHEN z_003.
MOVE itab_atwrt TO l_v_val_class_03.
WHEN z_004.
MOVE itab-atwrt TO l_v_val_rs_exp_01.
WHEN z_011_exp_02.
MOVE itab-atwrt TO l_v_val_rs_exp_02.
WHEN z_0111_exp_03.
MOVE itab-atwrt TO l_v_val_rs_exp_03.
ENDCASE.
ENDLOOP.
Thanks in advance,
Regards,
Bhaskar
‎2007 Oct 21 12:05 PM
Hi Bhaskar,
Your code is correct only change one thing
READ table jtab into l_wa_jtab with key atinn = l_wa_itab-atinn.
IF sy-subrc = 0.
CASE l_wa_jtab-atinn.
WHEN z_001.
MOVE itab-atwrt TO l_v_val_class_01.( local variable )
WHEN z_002.
MOVE itab_atwrt TO l_v_val_class_02.
WHEN z_003.
MOVE itab_atwrt TO l_v_val_class_03.
WHEN z_004.
MOVE itab-atwrt TO l_v_val_rs_exp_01.
WHEN z_011_exp_02.
MOVE itab-atwrt TO l_v_val_rs_exp_02.
WHEN z_0111_exp_03.
MOVE itab-atwrt TO l_v_val_rs_exp_03.
ENDCASE.
ENDIF.
Regards,
Atish
‎2007 Oct 21 2:06 PM
u can do it using inner join..but join degrades the performance .
better define a wrok area using both itab and jtab then move the value from work area to local variable.
thanx