‎2007 Sep 12 8:57 AM
hi all,
i want to modify a selected record of a database table
please tell me how i can do the same
i have done following
data: idx type sy-tabix.
data: itab type standard table of t508a." with header line.
data: wa_tab type t508a.
data: itab2 type standard table of t508a with header line.
select * from t508a into table itab
where zeity = '1'
and mofid = '11'.
move itab to wa_tab.
idx = sy-tabix.
loop at wa_tab.
wa_tab-ENDDA = '99981231'.
MODIFY ITAB from wa_tab INDEX IDX
TRANSPORTING ENDDA.
endloop.
modify t508a from itab.
where t508a is a data base table like mara vbak and etc.
thanks in advance
pionts ll be surely awarded
anuj
‎2007 Sep 12 9:21 AM
Hi Anuj,
Just copy and paste the below code..
data: idx type sy-tabix.
data: itab type standard table of t508a." with header line.
data: wa_tab type t508a.
data: itab2 type standard table of t508a with header line.
select * from t508a into table itab
where zeity = '1'
and mofid = '11'.
loop at itab into wa_tab.
wa_tab-ENDDA = '99981231'.
MODIFY ITAB from wa_tab TRANSPORTING ENDDA.
endloop.
modify t508a from table itab.
commit work.
Reward points for helpful answers.
Regards,
hari krsihna
‎2007 Sep 12 9:03 AM
hi,
try like this...
loop at it_tab into wa_tab.
wa_tab-ENDDA = '99981231'.
modify t508a from wa_itab.
endloop.
Satya.
‎2007 Sep 12 9:07 AM
Hi anuj,
Do like this: -
loop at itab into wa.
wa_tab-ENDDA = '99981231'.
MODIFY itab from wa transporting ENDDA.
endloop.
Regards,
hari
‎2007 Sep 12 9:10 AM
Hello Anuj,
First of all, your selection and looping seems a bit wrong
try it like this
data: idx type sy-tabix.
data: itab type standard table of t508a." with header line.
data: wa_tab type t508a.
data: itab2 type standard table of t508a with header line.
select * from t508a into<b> corresponding fields of</b> table itab
where zeity = '1'
and mofid = '11'.
<b>loop at itab into wa_tab.
wa_tab-ENDDA = '99981231'.
MODIFY ITAB from wa_tab.
update t508a from itab_wa.
endloop.</b>
‎2007 Sep 12 9:15 AM
Hi anuj,
You may update the table individually.
UPDATE zsdautoave SET ENDDA = '99981231'
WHERE <selected record condition here>.
Or update the internal table first then mass database table update. Internal table and database table must have the same structure.
MODIFY <database table> FROM TABLE <internal table>.
Hope this helps.
‎2007 Sep 12 9:21 AM
Hi Anuj,
Just copy and paste the below code..
data: idx type sy-tabix.
data: itab type standard table of t508a." with header line.
data: wa_tab type t508a.
data: itab2 type standard table of t508a with header line.
select * from t508a into table itab
where zeity = '1'
and mofid = '11'.
loop at itab into wa_tab.
wa_tab-ENDDA = '99981231'.
MODIFY ITAB from wa_tab TRANSPORTING ENDDA.
endloop.
modify t508a from table itab.
commit work.
Reward points for helpful answers.
Regards,
hari krsihna
‎2007 Sep 12 11:56 AM
hi Hari,
its very useful but using it i am getttin two record
say
fld1 fld2 date
aaa sss 12.04.2007
aaa sss 31.12.9998.
but i only need the second record(aaa sss 31.12.9998.) and not the first one
thanks alot
i have alot same piont also
anuj
‎2007 Sep 12 9:24 AM
Hi,
Do Like This :
Tables : T508A.
data: itab type standard table of t508a." with header line.
data: wa_tab type t508a.
select * from T508A
into corresponding fields of table itab
where zeity = '1' and mofid = '11'.
if itab[] is not initial.
loop at itab into wa_tab.
wa_tab-endda = '99981231'.
modify itab from wa_tab transporting endda.
endloop.
endif.
give any suitable message
modify t508a from table itab.
if sy-subrc eq 0.
message ....
else.
message...
endif.
Reward points if useful.
‎2007 Sep 12 9:26 AM
Hi Anuj,
I have changed your code as below. It should work fine now.
data: idx type sy-tabix.
data: itab type standard table of t508a." with header line.
data: wa_tab type t508a.
data: itab2 type standard table of t508a with header line.
select * from t508a into table itab
where zeity = '1'
and mofid = '11'.
loop at itab.
idx = sy-tabix.
Itab-ENDDA = '99981231'.
MODIFY ITAB INDEX IDX.
endloop.
modify t508a from itab.
*Reward points if helpful
Regards,
Amit
‎2007 Sep 12 12:45 PM