Application Development 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: 

Replacing old values with new values at table level

Former Member
0 Kudos

Hi,

I have a issue like i have 40 custom tables,in that tables i have one field say FIELD6.only for this field i n eed to replace current values with new values.and in the custom tables this field name is defined as different names like in one table it is defined as ZFIELD6 and in other field ZZFIELD6 and so..on.i want a program to replace this field vaalues in all the custom tables.i have listed oldvalue and corresponding new value in a notepad,and uploaded these into one internal table as FIELD1 and FIELD2. And selected table entries from custom tables.and loop at custom table values internal table.but the problem is validating against upload file.any one give me the idea on this?

in the selection screen i have taken table name.

6 REPLIES 6

Former Member
0 Kudos

first find all the replace field in custom table.

step1.

1. record the bdc se11 in change mode.

2. replace the field now.

3. ativat

0 Kudos

not the BDC.i need a upload program i wrote the logic like this.

data:begin of itab, "This is to upload old and new values from notepad.

field1(10) type n,

field2(10) type n,

end of itab.

data: begin jtab, this work area for field values from custom tables.

field(10) type n,

end of jtab.

parameters: p_table like dd02l-tabname, "table name

p_field(10). 'CORRESPONDING FIELD NAME.

call function 'gui_upload'

using this i uploaded notepad values to internal table ITAB.

SELECT (p_field) from (p_table) into jtab where mandt = sy-mandt.

append jtab to it_jtab.

endselect.

loop at it_jtab into jtab.

in this i want to read the entries from itab.

endloop.

0 Kudos

Hi,

Try this, after uploading the notepad file to internal table(itab) then

loop at itab into wa_itab.

update custom_table1 set field6 = wa_itab-field2 where field6 = wa_itab-field1.

do the same for all remaining tables.

endloop.

Reward points if useful.

Thanks,

Muthu.

0 Kudos

HI ,

here the logic is simple.

loop at it_jtab into jtab.

read table itab with key field1 = jtab-field.

code for modify the database table.

endloop.

Like this write for all the z-tables.

Former Member
0 Kudos

Hi,

For this you have <b>to write a program to modify all the custom tables. Or you can create a function module</b> and through that you can modify all the tables. Even though both are same function module is the preferable one.

Write <b>seperate modify command for all the tables</b>. ( For this the key fields in all the tables should be given correctly )

0 Kudos

but the key fields are different for every custom table.please check my logic and give me the idea on this.