cancel
Showing results for 
Search instead for 
Did you mean: 

program with SAP .Net Connector, how to call the FM dynamically

Former Member
0 Kudos

I'd like to write a .Net applcation, for which the Remote Function Module(RFM) name is not known at design time. The Remote Function Module(RFM) name is only known at run time, such as input by user on the UI screen.

How can I do this with .Net Connector?

As I know, the RFM name should be known when generating proxy class with .Net Connector wizard.

Thanks a lot in advance!

Accepted Solutions (0)

Answers (1)

Answers (1)

Dorian
Participant
0 Kudos

Frank:

I don't know of any way to dynamically build a DLL to call a web service that is known only at run-time.

I got around a similar problem by generating a separate class with methods that make calls to all of the possible web services. In my application, the user will be picking a specific business object from a drop-down list. Based on the selected value, I call the appropriate method that in turn calls a web service via a SWITCH statement.

Sample code fragment is below:


            switch (iv_Method)
            {
                case "WS_Demo1.FlightGetlist":
                    lcl_Dset = WS_Demo1_FlightGetList(
                        iv_Path, 
                        iv_Schema, 
                        iv_From, iv_To, iv_Rows,
                        iv_Host, iv_Port, iv_Client,
                        iv_User, iv_Pwd);
                    break;

                case "WS_Demo3.FlBookingGetlist":
                    lcl_Dset = WS_Demo3_FlBookingGetlist(
                        iv_Path, 
                        iv_Schema, 
                        iv_From, iv_To, iv_Rows,
                        iv_Host, iv_Port, iv_Client,
                        iv_User, iv_Pwd);
                    break;

                case "WS_Demo5.FlcustGetlist":
                    lcl_Dset = WS_Demo5_FlcustGetlist(
                        iv_Path, 
                        iv_Schema, 
                        iv_From, iv_To, iv_Rows,
                        iv_Host, iv_Port, iv_Client,
                        iv_User, iv_Pwd);
                    break;

                default:
                    errtext = "Invalid Web Service call: " + iv_Method;
                    MessageBox.Show(errtext);
                    break;
            }

The methods called in each branch in turn make a call to a Web Service proxy and return a DataSet object to the main program.

Regards,

D.