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

generate Temp FM dynamically from existing FM

Ghadeer
Participant
0 Kudos
692

Hi all ,

I have an existing FM in which I need to change some of its code dynamically before calling it .

so is there is any way that I can change its code and store it in some temp FM and then call that temp FM ?

1 ACCEPTED SOLUTION
Read only

Ghadeer
Participant
0 Kudos
574

I solved my problem in these steps :

1- copying FM RS_FUNCTION_COPY

2- read copy FM into itab

3- change the code in the itab

4- INSERT REPORT <FM include name> ["L" + Function Group name + "U" + 01/02...] from itab

5- call my copy FM

6- delete copy FM using RS_FUNCTION_DELETE .

5 REPLIES 5
Read only

matt
Active Contributor
574

Why do you think you have to have self modifying code? What are you actually trying to achieve? It may be doable through other dynamic techniques.

Read only

Ghadeer
Participant
0 Kudos
574

I want to export variable that is will be only there in the FM ... the variable and the FM is run-time data so I need something generic .

Read only

Former Member
0 Kudos
574

Hi,

I still don't fully understand why in this case you need generated code. What is the functional requirement?

Kind regards, Rob Dielemans

Read only

Sandra_Rossi
Active Contributor
0 Kudos
574

Could you please explain more in details why you can't export the variable!?

Read only

Ghadeer
Participant
0 Kudos
575

I solved my problem in these steps :

1- copying FM RS_FUNCTION_COPY

2- read copy FM into itab

3- change the code in the itab

4- INSERT REPORT <FM include name> ["L" + Function Group name + "U" + 01/02...] from itab

5- call my copy FM

6- delete copy FM using RS_FUNCTION_DELETE .