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: 

Help in updating different programs

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

12 REPLIES 12

Former Member
0 Kudos

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.

0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

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.

0 Kudos

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

0 Kudos

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

0 Kudos

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.

0 Kudos

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.

0 Kudos

Please be careful, the INSERT REPORT statement is an internal statement, and will not be supported by SAP. So if you screw up your system, don't plan on getting any help.

Regards,

Rich Heilman

0 Kudos

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

0 Kudos

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

0 Kudos

Please check out function module RPY_PROGRAM_INSERT, this will give you an idea of the bases that need to be covered.

Regards,

Rich Heilman