2007 Sep 10 2:05 PM
Hi,
I'm selecting 3 fields from a DB table to an internal table .
there after i have to select one more field from another DB tables into same internal table.
But the second select is overwriting 1st record.
I want both to sustain as a single record.
How to do it?
2007 Sep 10 2:07 PM
hi,
use modify.
loop at <internal table> into <work area>.
select ur fields in work area.
modify <internal table> from <work area> transporting <that fields>
endloop.
I think it can solve ur problem.
Message was edited by:
Dhwani shah
Define itab1with 3 fields.
Define itab2 with 2 fields. <One field for connecting itab1 and itab2>
Get the details from table1 into itab1.
Get the details from table2 into itab2.
Loop at itab1.
l_index = sy-tabix.
read table itab2 with key <Condition>.
if sy-subrc eq 0.
Move the value from itab2 to itab1.
modify itab1 with index l_index.
endif.
endloop.
2007 Sep 10 2:07 PM
hi,
use modify.
loop at <internal table> into <work area>.
select ur fields in work area.
modify <internal table> from <work area> transporting <that fields>
endloop.
I think it can solve ur problem.
Message was edited by:
Dhwani shah
2007 Sep 10 2:08 PM
You need to do a select....appending table.
You cannot modify the single record. You would need to select into another table and then modify the first table based on the data of the second.
2007 Sep 10 2:10 PM
Define itab1with 3 fields.
Define itab2 with 2 fields. <One field for connecting itab1 and itab2>
Get the details from table1 into itab1.
Get the details from table2 into itab2.
Loop at itab1.
l_index = sy-tabix.
read table itab2 with key <Condition>.
if sy-subrc eq 0.
Move the value from itab2 to itab1.
modify itab1 with index l_index.
endif.
endloop.
2007 Sep 10 2:13 PM
Hi,
refer to my code as under:
Loop at itab.
read table itab1 with key mblnr = itab-mblnr
mjahr = itab-mjahr binary search.
if sy-subrc = 0.
move-corresponding itab1 to itab.
endif.
read table itab2 with key mblnr = itab-mblnr
mjahr = itab-mjahr binary search.
if sy-subrc = 0.
move-corresponding itab2 to itab.
endif.
modify itab transporting WERKS LGORT BUDAT OIB_BLTIME.
clear: itab, itab1, itab2.
Endloop.
Hope this helps.
Reward if helpful.
Regards,
Sipra
2007 Sep 10 2:28 PM
hi,
while declaring a final table.
data : begin of itab_mara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
end of itab_mara.
data : begin of itab_marc occurs 0,
matnr like marc-matnr,
werks like marc-werks,
end of itab_marc.
data : begin of itab_final occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
matnr1 like marc-matnr, " declaration of matnr in final table
werks like marc-werks,
end of itab_final.
Reward with points if helpful.
2007 Sep 15 1:33 PM
data : begin of itab_final occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
matnr1 like marc-matnr, " declaration of matnr in final table
werks like marc-werks,
end of itab_final.
selection-screen. "using selection -screen is a good way of writing code, even if it is not necessary.
start-of-selection.
select mara~matnr
mara~ernam
marc~werks
marc~matnr
from mara as mara
inner join marc as marc on
maramatnr eq marcmatnr into table itab_final.
loop at itab_final.
write:/ itab_final.
endloop.
reward points, if useful.
2007 Sep 11 2:22 PM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |