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: 

How to write Dynamic Function Module

vivek_gaurav
Participant
0 Kudos

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

Juwin
Active Contributor
0 Kudos

Please read this post:

Kindly search before posting.

Thanks,

Juwin

22 REPLIES 22

former_member182550
Active Contributor
0 Kudos

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

0 Kudos

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

0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

This message was moderated.

0 Kudos

Hi Swet,

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

Rich

matt
Active Contributor
0 Kudos

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!

0 Kudos

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.

matt
Active Contributor
0 Kudos

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

Juwin
Active Contributor
0 Kudos

Please read this post:

Kindly search before posting.

Thanks,

Juwin

0 Kudos

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

Juwin
Active Contributor
0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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......

Juwin
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Juwin
Active Contributor
0 Kudos

Got it, my bad. Thanks

matt
Active Contributor
0 Kudos

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.

0 Kudos

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

matt
Active Contributor
0 Kudos

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