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

Modify Zse38 Program dynamically

Former Member
0 Likes
1,320

hi Everyone,

I am developing a program which should actually accept any give program and read it

completely (I mean to say INCLUDE programs as well)  and do some modifications and generate the output

after modifications.

i can do this if the given program is not having any INCLUDE program .

can anybody suggest me,how can i achieve this?

Regards

SAM

11 REPLIES 11
Read only

Former Member
0 Likes
1,215

Hi Sams,

By using this function module rs_get_all includes  u can read the includes of that particular program.

Sample Code.

REPORT  yhXXXX_includes_download NO STANDARD PAGE HEADING.

PARAMETERS : p_name TYPE char255.

DATA :

   t_prog TYPE TABLE OF char255,

   t_prog1 TYPE TABLE OF char255,

   wa_prog TYPE char255,

   wa_prog1 TYPE char255,

   w_prog_na TYPE sy-repid,

   w_path TYPE string.

READ REPORT p_name INTO t_prog.

LOOP AT t_prog INTO wa_prog.

   WRITE 😕 wa_prog.

ENDLOOP.

w_prog_na = p_name.

CALL FUNCTION 'RS_GET_ALL_INCLUDES'

   EXPORTING

     program                      = w_prog_na

   TABLES

     includetab                   = t_prog1 .

LOOP AT t_prog1 INTO wa_prog1.

   READ REPORT wa_prog1 INTO t_prog.

ENDLOOP.

Regards,

Vineesh.

Read only

Former Member
0 Likes
1,215

Hi Sam,

Can you Check this Standard Program given by SAP "RPR_ABAP_SOURCE_SCAN".

Regard's

Smruti

Read only

Former Member
0 Likes
1,215

Hi SAM,

Just a suggestion..

You can use READ ERPORT to read the main program.

Then loop the internal table and check if the first word is INCLUDE or not..

Then you can again use READ REPORT to read the INCULDE program and do the modifications.

Regards,

Santanu Mohapatra.

Read only

Former Member
0 Likes
1,215

Hi,

Thanks for the response...

now i am getting the code of main program as well as INCLUDE in an internal table..

But when i do some changes in the internal table dynamically ...

which is really not effecting my output at all

please suggest??

Read only

0 Likes
1,215

Hi Sam,

By using the insert report statement you can insert the dynamically changed internal table again back to that program.

Insert report 'PGM_name'  from itab.

Regards,

Vineesh.

Read only

0 Likes
1,215

Thank you for the help.

Can we actually copy a standard SE38 program to a Z program and SAVE it dynamically at run time

any help would be really appreciated...

regards

SAM

Read only

0 Likes
1,215

Hi Sams,

Yes u can copy. Simply give the program name RSABAPPROGRAM and use copy button then select all the checkboxes like includes etc and activate it. Create the t code for it.

Regards,

Vineesh.

Read only

0 Likes
1,215

Can you Record all Steps Manually for Copy one Standard Program to "Z" using SHDB T-code , then pass the value where original Program and "Z" program .

Regard's

Smruti

Read only

0 Likes
1,215

Hi,

You can copy. There is copy button at the top in se38 just next to delete button. Do copy all the screens, includes.

Read only

Former Member
0 Likes
1,215

Thank you all,

I am interested in doing it programatically.

may be i am not good in explaining.

can anybody give me a sample code , for the functionality..

which should actually accept a PROGRAM as input and do a small modification in the INCLUDE program and RUN the program which shows me the output (with modification in the code...)

Help would be really appreciated.

Regards

SAM

Read only

0 Likes
1,215

Hi Sam,

You don't need to write extra code,

As Vineesh told "Insert report 'program name'  from itab" inserts the modifies data into the specified program name but if the program doesn't exist already the program will be created and then saved with the code provided but you need to pass the attributes.

just check the F1 help for insert report in se38 details are given.