‎2006 Dec 28 12:42 PM
Hi friends,
I have a r/3 table roosourcet .
In this table we have fields like version , oltpsource , langu ,TXT etc.
Now i want to modify 3 items for field TXT based on slection OLTPSOURCE = 2LIS_13_VDHDR ,version = 'A' and langu = 'EN'.
How to do it ..
Thanks in advance.
‎2006 Dec 28 12:47 PM
Hi akash,
1. Direct updation of standard sap table is not recommended.
2. however, to do it, we can do like this.
3. select * from roosourcet
into table itab
where (conditions.... ).
data : tabix like sy-tabix.
LOOP AT ITAB.
ITAB-field = 'xyz'.
modify rooourcet from itab.
endloop.
regards,
amit m.
‎2006 Dec 28 12:51 PM
Hi Amit thanks for ur reply,
But itab-field = 'a' , how will it going to modify according to my field oltpsource = '2lis......'
That is I want to modify files for only a particular value of the field oltpsource.
Thanks
‎2006 Dec 28 1:06 PM
Hi again,
1. First select all the records corresponding to where condition.
2. Then while looping,
change the field in itab, which u want to change.
Then just use the MODIFY statement as in my previous reply.
This will change the actual database table.
regards,
amit m.
‎2006 Dec 28 1:01 PM
select * from roosourcet
into table itab.
data : tabix like sy-tabix.
LOOP AT ITAB where <condition>.
ITAB-field = 'xyz'.
modify rooourcet from itab index sy-tabix.
endloop.
‎2006 Dec 28 1:03 PM
Hi,
I hope the following code will helpful for you.
select *
from roosourcet
into table lt_roosourcet
where OLTPSOURCE = '2LIS_13_VDHDR'
and version = 'A'
and langu = 'EN'.
if sy-subrc eq 0.
loop at lt_roosourcet into wa_roosourcet.
* give modification field list like
wa_roosourcet-txt = 'Testing'.
modify lt_roosourcet from wa_roosourcet transporting TXT.
endloop.
* Please lock all entries using ENQUEUE
modify roosourcet from table lt_roosourcet.
if sy-subrc eq 0.
* Please unlock all entries using DEQUEUE
endif.
endif.You can use the following code also as if SELECT and ENDSELECT allowed in your project.
select *
from roosourcet
where OLTPSOURCE = '2LIS_13_VDHDR'
and version = 'A'
and langu = 'EN'.
rooosourcet-TXT = 'Sample test'.
Modify roosourcet.
endselect.
Regards
Bhupal Reddy