Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regarding modify.

Former Member
0 Likes
611

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.

5 REPLIES 5
Read only

Former Member
0 Likes
583

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.

Read only

Former Member
0 Likes
583

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

Read only

0 Likes
583

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.

Read only

Former Member
0 Likes
583

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.

Read only

Former Member
0 Likes
583

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