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

RFC CALL canu00B4t execute Functions module ??

Former Member
0 Likes
1,821

Hello everybody,

I have a problem with a Function module. The function module should open an link (it´s a Link of a Webdynpro Application).

I have the following constellation.

Bex Analyzer execute a RFC Call to open/execute the Function module. The Function module should open a URL (Webdynpro Application), but it doesn´t work.

I don´t know why. The Connection of the RFC Call is ok. I have tested the RFC with any Object´s and it works (He "answered").

What ist wrong in the Function Module, why can´t the FM open the URL??!

Simple Code of Function Module

call method cl_gui_frontend_services=>execute

exporting

document = 'URL'

exceptions

others = 1.

Endfunction.

A other test

*CALL FUNCTION 'PRGN_GENER_EXECUTE_URL'

*EXPORTING

*NODE_DATA = 'url'.

The VBA Code for RFC

Sub Login()

Dim functionCtrl As Object

Dim sapConnection As Object

Dim theFunc As Object

Dim sReturn As Boolean

Dim l_export As String

Dim objQueryTab As Variant

Set functionCtrl = CreateObject("SAP.Functions")

Set sapConnection = functionCtrl.Connection

sapConnection.Client = "100"

sapConnection.user = "xy"

sapConnection.Language = ".."

sapConnection.SystemNumber = "xy"

sapConnection.ApplicationServer = "xy"

sapConnection.Language = "x"

sapConnection.codepage = "xy"

sapConnection.Destination = "xy"

sapConnection.System = "x"

sapConnection.SystemID = "......"

sapConnection.Password = "xy"

sapConnection.autologon = 1

If sapConnection.Logon(0, True) <> True Then

MsgBox "Keine Verbindung"

Else

Set theFunc = functionCtrl.Add("SS_RFC_URL_TEST")

objQueryTab = "200"

theFunc.Exports("I_PAR") = objQueryTab

sReturn = theFunc.call

If sReturn = True Then

objQueryTab = theFunc.Imports("E_PAR")

End If

sapConnection.logoff

End If

End Sub

-

-


>E_PAR is the Exportparameter of the Function module

-

-


>I_PAR is the Importparameter of the Function module

Thanks

Edited by: Schwarzenberger Stefan on May 9, 2011 1:59 PM

Thanks. Sorry about the email issue. We share a single OSS id across our entire team and i had tried 5 times to update the profile to my address, but everytime i tried to reply to the thread it was putting in a different profile name and parameters.

So it sounds like there is not a way using the standard SAP delivered RFC's. We'll have to copy the standard to a new one and modify it.

Thanks for your help!

Kory

12 REPLIES 12
Read only

Former Member
0 Likes
1,772

Maybe the function module is not enabled for RFC. In the FM attributes tab there is a Processing type to choose and the option "Remote-enabled module" has to be chosen.

Read only

0 Likes
1,772

No sorry it is "remote-enabled"!!

Read only

0 Likes
1,772

Hi ,

If you are calling RFC Function module you should mention your RFC Destination following with CALL FUNCTION.

For exp:

CALL FUNCTION 'PRGN_GENER_EXECUTE_URL' DESTINATION <RFC Destination Name>.

Thanks,

Sriram.

Read only

matt
Active Contributor
0 Likes
1,772

May be a little off topic - but why not open the URL of the Web Dynpro directly? Why do it through the function module?

The reason it doesn't work could be linked to cl_gui_frontend_services. If you're calling an RFC - there is no frontend.

Read only

marcin_cholewczuk
Active Contributor
0 Likes
1,772

Hi,

1. So if you run this FM from SAP along with value RFC destination your WDA is being opened, but when you run it from Bex nothing happens, right?

2. When you debug it in Visual Basic what kind of error are you getting?

3. Maybe this is authorization issue?

4. Check transaction SM21 - maybe there are some logs regarding your problem

5. You can also check gateway logs - transaction SMGW

Best regards

Marcin Cholewczuk

EDIT:

On second thought, after reading Matt comment I've started to wonder how this could work? You're calling SAP server and telling "him" to open browser on your computer. Is it possible to be done? Is it functionality that you 're trying to develop in Bex or is it something that comes with standard?

Edited by: Marcin Cholewczuk on May 9, 2011 2:26 PM

Read only

0 Likes
1,772

Hello again

@Marcin

1. Yes right

2. I have no error in VB

3. I believe I have no Authorization Problem - I´m the Orginator

4. No error´s im SM21

@SriRam

I have no several systems....it´s the same System

Read only

0 Likes
1,772

So I guess this is what Matt said, it is not possible to use this function in this context. The easiest way would be to just execute browser directly from VB code passing url to your WDA.

Best regards

Marcin Cholewczuk

Read only

0 Likes
1,772

Ok thanks, I try a another solution!

Read only

0 Likes
1,772

Hi, I have a similar situation. Within VBA I am calling the RFC 'RFC_CALCULATE_TAXES_DOC'. This RFC is used to communicate with external tax software like Taxware; it gets applicable tax rates, amounts, etc. based on tax jurisdiction code and other data. The RFC is remote-enabled (has to be to talk to Taxware).

This RFC requires an RFC Destination in order to work. Within VBA, I have not been able to figure out the syntax required to enter the Destination name. I saw Shreeram's post saying to use CALL FUNCTION 'PRGN_GENER_EXECUTE_URL' DESTINATION <RFC Destination Name>. However, this looks like ABAP syntax and not VBA syntax.

Does anybody know if this is possible within VBA? Sounds like it's not but wanted to double-check.

Thanks!!

Kory Squire

<<Removed email address>>

Edited by: Matt on May 18, 2011 6:37 AM

Read only

0 Likes
1,772

Do not post your email address Please read the rules of engagement again.

Rewrite your FM on SAP to have parameter "I_DEST". When you call it from VB you populate I_DEST with the destination of the tax system. The FM on SAP, looks like this:

FUNCTION Z_MY_FM
*"--------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"      VALUE (I_PART) TYPE....
*"      ...
*"      VALUE(I_DEST) TYPE ... OPTIONAL
*"  EXPORTING
*"       E_VALUE TYPE ....
*"     ....
*"--------------------------------------------------------------------

CALL FUNCTION 'Z_MY_FM' DESTINATION i_dest
  EXPORTING
      I_PART = I_PART
    ....
   IMPORTING
     E_VALUE = E_VALUE
  ....
ENDFUNCTION

Read only

0 Likes
1,772

Thanks. Sorry about the email issue. We share a single OSS id across our entire team and i had tried 5 times to update the profile to my address, but everytime i tried to reply to the thread it was putting in a different profile name and parameters.

So it sounds like there is not a way using the standard SAP delivered RFC's. We'll have to copy the standard to a new one and modify it.

Thanks for your help!

Kory

Read only

0 Likes
1,772

You don't need to modify the SAP one (though you can - and, for maintanance reasons it's better to modify than copy ). The best thing to do is create your own RFC enabled FM with the same interface as the SAP one, that just calls the SAP one,

matt