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

Ztable records modification with key

Former Member
0 Likes
923

Hi friends,

how to modify the ztable records with key,my problem is am having 3 records for the key field.when ever am try to change these reocrds using

modify ztable from wa_Itab.

without taking any key referenece it is creating a new record,here want to modify the same record which having the record no as 1 .

next time record no2...like that.

loop itab into wa_tab.

modify ztable from wa_tab with reference..................

endloop.

if possible any one can provide the solution.

Thanks in advance,

sai.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
898

Hi ,

Modify will insert a new record into ur Ztable whenever there is no record exist with same key combination in ur table,. so...

try like this....

loop at itab into wa.

modify ZTABLE from wa where k1 = wa-k1 and

k2 = wa-k2 and

k3 = wa-k3.

endloop.

here k1,k2 and k3 are key fiekds of ur ztable...

Hi friends,

how to modify the ztable records with key,my problem is am having 3 records for the key field.when ever am try to change these reocrds using

modify ztable from wa_Itab.

without taking any key referenece it is creating a new record,here want to modify the same record which having the record no as 1 .

next time record no2...like that.

loop itab into wa_tab.

modify ztable from wa_tab with reference..................

endloop.

if possible any one can provide the solution.

Thanks in advance,

sai.

5 REPLIES 5
Read only

Former Member
0 Likes
899

Hi ,

Modify will insert a new record into ur Ztable whenever there is no record exist with same key combination in ur table,. so...

try like this....

loop at itab into wa.

modify ZTABLE from wa where k1 = wa-k1 and

k2 = wa-k2 and

k3 = wa-k3.

endloop.

here k1,k2 and k3 are key fiekds of ur ztable...

Read only

0 Likes
898

Hi MR A,

the problem it is not allowing the where condition in modifying table.

Read only

Former Member
0 Likes
898

HI,

1. modify ztable from wa_tab

Modify Checks for the records from work area in the ztable comparing all fields . As in your case your are passing the workarea which hold updated values in the particular fields so the statment checks with this work area in ztable as it don't finds so it creates the new records.

2 . Use where clause in the Modify statement this will serve your pupose.

modify ztable from wa_tab WHERE <Condition>

Read only

Former Member
0 Likes
898

Hi Sai,

U can modify in following way:

loop at it_ekko into wa_ekko.

wa_ekko-netpr = '100'.

MODIFY it_ekko INDEX sy-tabix FROM wa_ekko

endloop.

Thanks,

Smita

Read only

Former Member
0 Likes
898

Hi Sai,

You can modify in following way:

loop at it_ekko into wa_ekko.

if wa_ekko-k1= '100' and wa_ekko-k2 = '2' and wa_ekko-k3 = '3' .

MODIFY it_ekko INDEX sy-tabix FROM wa_ekko.

endif.

endloop.

Thanks,

smita

Edited by: Smita Gupta on Mar 6, 2009 7:56 AM