09-26-2006 4:03 PM
Hi All
How can I update lots of program in once without having to enter one by one to modidy and activate them?
For example, If I have to insert one line of code after a Start of selection in different programs ?
I heard there is a way to do that. Does anybody knows?
Many thanks in advanced
09-26-2006 4:20 PM
One way to do the below is to write an ABAP, whereby it reads the report in an internal table....change the internal table depending on your requirement...and insert it back to object repository.
READ REPORT prog INTO itab.
Manipulate itab.
INSERT REPORT prog FROM itab.
There is variation for state to activate and inactive the same.
09-26-2006 4:07 PM
Hi,
From Se38 or se80 Goto menu Environment -> Inactive Objects.
This will display a list of objects. Click on programs and select multiple objects by holding shift.
After selecting activate them at a time.
hope this helps.
09-26-2006 4:13 PM
Hi Imtiaz
Thank you very much for your msg but actually what I need to know is not how to activate multiple programs in once.What I need to know is how can I insert the same line code (for example a select, update or delete) in multiple programs in once !? Without having to enter in each program ?
I hope you understand what I mean.
Many thanks.
Cristina
09-26-2006 4:20 PM
One way to do the below is to write an ABAP, whereby it reads the report in an internal table....change the internal table depending on your requirement...and insert it back to object repository.
READ REPORT prog INTO itab.
Manipulate itab.
INSERT REPORT prog FROM itab.
There is variation for state to activate and inactive the same.
09-26-2006 4:24 PM
Try this:
tables: trdir.
data: begin of t_progs occurs 0,
name like trdir-name,
end of t_progs.
data: begin of t_code occurs 0,
line(72),
end of t_code.
data: l_line(72),
l_idx type i.
select-options: s_rprt for trdir-name.
select name into table t_progs
from trdir where name in s_rprt
and subc = '1'.
loop at t_progs.
read report t_progs-name into t_code.
loop at t_code.
if t_code-line cs 'start-of-selection'.
concatenate '''' 'hello' '''' into l_line.
concatenate 'write: /' l_line '.' into l_line
separated by space.
l_idx = sy-tabix + 1.
insert l_line into t_code index l_idx.
endif.
endloop.
insert report t_progs-name from t_code.
clear t_code.
refresh t_code.
endloop.
09-26-2006 5:16 PM
Hi Michael
Thank you very much for the code. It solved my problem.
Anurag and Imtiaz, thank you both also for the help.
Many thanks.
Cristina
09-26-2006 7:14 PM
Im sorry Michael, I still have one doubt: after updating hundreds of program this way, how can I automactly activate them in once ?
Many thanks.
Cristina
09-26-2006 7:19 PM
You would activate them one at a time in the program. You should be able to use the command GENERATE REPORT to force an activation. Use the MESSAGE addition to capture any activation errors.
When I used it to update a couple of test programs, I noticed they were still activated.
09-26-2006 7:52 PM
Hi Michale
Many thanks again. Do you know if this code also works for module pool programs ? Because I tried already wiht no success.
Cheers.
09-26-2006 7:59 PM
09-26-2006 8:01 PM
I set this code up to select from TRDIR where SUBC = 1 (executable program). I suspect you could do the same for SUBC = M (module pool).
The question would be whether or not the INSERT or GENERATE statements worked for other program types. I haven't tried it for anything other than basic executable reports, but I don't see why it wouldn't work.
Per Rich's comment, I would highly recommend you add checks to prevent running with no select-option populated and to prevent updating of non-custom code. Also, consider adding some audit reporting of objects maintained in case you need to undo an update.
Message was edited by: Michael Malvey
09-26-2006 8:19 PM
Hi Rich
Thank you for the warning, at the moment we are just testing how it works and we are planning to update only programs customized for ourselves.
Many thanks anyway.
Br.
Cristina
09-26-2006 8:24 PM