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

How to write Dynamic Function Module

vivek_gaurav1
Participant
0 Likes
4,975

Hi All,

I have one requirement to dynamically create Remote enable function module.

I got one FM :  FUNCTION_CREATE.

It create Function module but there is no provision to write coding for FM.

Kindly suggest...

Thanks in Advance.

Regards

Vivek

1 ACCEPTED SOLUTION
Read only

Juwin
Active Contributor
0 Likes
4,556

Please read this post:

Kindly search before posting.

Thanks,

Juwin

22 REPLIES 22
Read only

Former Member
0 Likes
4,556

Have you had a look at the rest of the function modules in the same function group ?

Would 'GENERATE SUBROUTINE-POOL' be able to do the same job ?

Rich

Read only

0 Likes
4,556

Hi Richard,

I need to create function module,only because this is the only object which can be called remotely using RFC connection.

Kindly suggest..

Regards

Vivek

Read only

0 Likes
4,556

Why does it need to be dynamic ?  Could you not write a function module stub that then generates it's own subroutine pool ?

Explain exactly why it has to be dynamic.  There then may be another way around your problem.

Rich

Read only

0 Likes
4,556

Dynamic function module called from another system, do security admins agree with it?

Did you also manage remote call authorization (Object S_RFC) ?

Question: Creating a dynamic RFC FM is a solution, what is the initial requirement ?

Regards,

Raymond

Read only

Former Member
0 Likes
4,556

This message was moderated.

Read only

0 Likes
4,556

Hi Swet,

It's not dynamically calling a funtion module - it's writing one.

Rich

Read only

matt
Active Contributor
0 Likes
4,556

Swet posted a link farm. It's been rejected. But it's a good demonstration why link farms are often useless - they don't relate to the question asked!

Read only

0 Likes
4,556

Rather it's not that the link farm is useless,  it's that the question has not been understood..... I tend to find that a lot in the forums.  People answer questions and it's obviouis that they either have not taken the time to fully understand what the OP has actually asked or they don't have the capability to understand what the OP asked.

Read only

matt
Active Contributor
0 Likes
4,556

Link farms are heavily discourage here nonetheless. If they're useful, then it's a strong indication of the OP not searching!

Read only

Juwin
Active Contributor
0 Likes
4,557

Please read this post:

Kindly search before posting.

Thanks,

Juwin

Read only

0 Likes
4,556

Hi All,

I already gone through the above posting, But actually I am creating tool to create Remote enabled Function module which will use to call existing Class.

All import and export parameter of class will become Parameter of FM.

I hope , everyone understand my requirement.

Regards

Vivek

Read only

Juwin
Active Contributor
0 Likes
4,556

How many such classes would you have? How much would be the manual effort to create RFCs for those? If at all you find a way to create function modules programmatically, does the effort required to implement it, justify the method?

Thanks,

Juwin

Read only

0 Likes
4,556

Hi Juwin,

Thanks for quick reply.

I can understand that creating FM dynamically can hamper FM but As i told you that i need to create a tool for some specific requirement.

It is not about manual effort, its about the functionality.

Regards

Vivek

Read only

Former Member
0 Likes
4,556

Ok though this is not recommended but you can try using INSERT REPORT to generate the code.

Something like INSERT REPORT prog FROM itab  where prog is the FM include ( Normally "L" + Function Group name + "U" + 01/02... so on or do a search on table TFDIR to get the Count also ).

Output:

Check the F1 help for INSERT REPORT.

Please note insert report generates the code exactly the way you populate the internal table . So punctuation is important. Otherwise the FM will show as "Active" in SE37/SE80 but will not run because of syntax error.

R

Read only

Former Member
0 Likes
4,556

Stupid question.....

Where do you put the code that enables you to run a program that uses 'INSERT REPORT' If the whole idea is to have a generic function call in the first place ?

Secondly,  this is not a temporary solution is it ?  Unlike GENERATE SUBPOOL,  this is actually written to the database.

Lastly,  what would your security bods think of this ?  It would probably give them hives......

Read only

Juwin
Active Contributor
0 Likes
4,556

How will Insert report, create a Function module? A Function module requires an entry in TFDIR also, right? Also, every time a Function created, it will require UXX include also to be updated. UXX documentation clearly says not to touch it. So, I guess you can use this method to Update a Function module, but not create one.

For this reason, I don't think this answer is the 'correct solution' for the issue.

Thanks

Juwin

Read only

Former Member
0 Likes
4,556

1. OP has clearly said that he wants to build a tool . So I assume he must have used in in custom program.

2. Yes Its is not a temporary solution. May be it does not have to be temporary.

3. They never mind in my case . Because they know me.

Thanks and have a nice weekend.

Read only

Former Member
0 Likes
4,556

You did not get the question . Did you?

He is able to build the FM ( By using FM FUNCTION_CREATE ) and then he wants to change the code inside the FM body.

Thanks and have a nice weekend.

Read only

Juwin
Active Contributor
0 Likes
4,556

Got it, my bad. Thanks

Read only

matt
Active Contributor
0 Likes
4,556

What is it that you're trying to achieve by using dynamic function modules? Perhaps if you explained that, we could come up with a simpler solution.

Read only

0 Likes
4,556

Hi Matthew,

Actually ,I am creating a tool which will use the existing assistance class and create Remote enable FM which we can use for creating Service.

Thanks rudra, I am able to write code inside FM.

Regards

Vivek

Read only

matt
Active Contributor
0 Likes
4,556

I still have no idea what you are trying to achieve. Perhaps some context? What "assistance class". What service are you wanting to create.