11-14-2007 4:02 AM
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.
11-14-2007 4:07 AM
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
11-14-2007 4:29 AM
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.
11-14-2007 4:52 AM
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.
11-14-2007 5:06 AM
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.
11-14-2007 4:20 AM
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 )
11-14-2007 4:32 AM
but the key fields are different for every custom table.please check my logic and give me the idea on this.