2006 Jun 20 10:50 AM
Hello experts,
I have 2 Z tables and I need to update table 2 based from table 1. Tables 1 & 2 have 2 fields which are the same namely
KUNNR and CDSEQ. Now, I want to update the ZADDRESS field of table 2 based from table1-zaddress where table1-kunnr and
table1-cdseq is equal to table2-kunnr and table2-cdseq.
Again, thank you guys and take care!
2006 Jun 20 10:55 AM
hi
the only way out would be:
1. use internal table and move the content based on the entries and selection criteria mentioned and say
modify dbtab from itab.
2. there are specific events associated with each tableu can make use of that
Reward points if it helps
regards
Gunjan
2006 Jun 20 10:55 AM
hi
the only way out would be:
1. use internal table and move the content based on the entries and selection criteria mentioned and say
modify dbtab from itab.
2. there are specific events associated with each tableu can make use of that
Reward points if it helps
regards
Gunjan
2006 Jun 20 10:55 AM
DATA: itab contains three fields kunnr cdseq and zaddress,
wa_itab type line of itab
select kunnr
cdseq
zaddress
from table1
into itab.
loop at itab into wa_itab
update table2 set zaddress = wa_itab-address
where kunnr = wa_itab-kunnr
cdseq = wa_itab-cdseq
endloop.
2006 Jun 20 10:58 AM
Hi Viraylab,
Try this code.
DATA : begin of wa,
zaddress TYPE ztable1-zaddress,
end of wa.
SELECT SINGLE * FROM ztable1
INTO corresponding fields of wa
WHERE KUNNR = Ztable2-kunnr and
CDSEQ = Ztable2-CDSEQ.
UPDATE ztable2 FROM wa.
Regards,
Mukesh Kumar
2006 Jun 20 11:21 AM
Hi Viraylab,
Please see this code.
<b>Report :</b>
data : itab type table of table1 with header line,
jtab type table of table2 with header line,
wa like line of itab.
select * from table1 into table itab.
select * from table2 into table jtab.
loop at itab into wa.
read table jtab with key kunnr = itab-kunnr and
cdseq = itab-cdseq.
if sy-subrc eq 0.
jtab-address = itab-address.
modify jtab.
endif.
endloop.
modify table2 from jtab.
If found helpful, please do reward.