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

want a function module to generate program from lines of code

Former Member
0 Likes
741

Hi all,

I created a schema to generate some lines of code at runtime. I stored the generated code in a table and now I want to execute those lines using some standard FM.

I called FUNCTION 'SCHEME_INSTANTIATE'

EXPORTING

CALLING_PROGRAM = sy-repid

SCHEME_PROGRAM = 'Z_TEST_SCHEME'

SCHEME_NAME = 'DD_CLOG_FUNC'

TABLES

RESULT_TAB = LT_RESULT.

At this point I have lines of code in lt_result. But it has not been executed yet.

What should be my approach next?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
648

Hi Shikha,

Did you check the GENERATE command in ABAP. Guess you can use it for your purpose. It will create a new program during runtime.

Cheers

VJ

5 REPLIES 5
Read only

Former Member
0 Likes
649

Hi Shikha,

Did you check the GENERATE command in ABAP. Guess you can use it for your purpose. It will create a new program during runtime.

Cheers

VJ

Read only

0 Likes
648

PL use the following statement..

GENERATE SUBROUTINE POOL itab NAME name.

~Suresh

Read only

0 Likes
648

If you are creating an entire program, use the INSERT REPORT statement followed by GENERATE REPORT. Alternatively you can create a subroutine using GENERATE SUBROUTINE POOL.

Read only

Former Member
0 Likes
648

Hi,

again I am facing a problem here. I have some global variables in the calling program but when I generated program for my scheme, these variables are not recognised. How do we make a call in these case?

Read only

Former Member
0 Likes
648

Hi,

In the generated program, write your lines of code in a subroutine. Call that subroutine of generated program from your program by passing the parameters.

Regards,

Sailaja.