Possible checks before RFC Function Call
Hello everyone,
I have the problem, that one of my transport requests was denied to transport into production by our QA, because I didn't check, if the RFC FM (it was a BAPI to be exact) exists in the target system and I didn't handle the RFC exceptions.
Can someone tell me what this means, and to be sure, what additional checks can be done before calling a remote enabled function module? Code snippets are more than welcome!
Thanks in advance,
Alej
PS: Points will be rewarded!
Hi,
variables declared in the top include of the function group is available to all the function modules in the group during runtime.
Regards,
Renjith Michael.
Similar Messages
-
RFC Function Call - System not available
Hello,
in my own program i´m using an RFC function call to get data out of our BW - System like this:
CALL FUNCTION 'RRW3_GET_QUERY_VIEW_DATA' DESTINATION i_dest
EXPORTING
i_query = i_query
i_view_id = i_view_id
i_t_parameter = i_t_parameter
IMPORTING
e_axis_data = gt_axis_data
e_cell_data = e_cell_data
EXCEPTIONS
system_failure = 1
communication_failure = 2
OTHERS = 3.
This works fine and fast as long the BW System is up and running. If the BW system is for some reason down my program has very bad performance because this RFC function call is trying for about 10 seconds every time.
Is there a way to avoid this long waiting time? A kind of parameter?
If there is no answer after one or two seconds the programm should continue.
Any ideas for this?
Thanks a lot.
Best regards
Manfredtry the following like look for TTL(time to live) in the doc
http://www.google.co.in/url?sa=t&source=web&cd=5&ved=0CDkQFjAE&url=http%3A%2F%2Fwww.erpgenie.com%2Fsapgenie%2Fdocs%2FSAP%2520Connectors.doc&rct=j&q=ttl%20for%20rfc%20call%20in%20sap%20abap&ei=DShnTv7VGYbWrQeYgPXcCg&usg=AFQjCNGvnINnxj8kYx9IeelUHy0dQPmuMA&cad=rja -
Can we disable implicit DB commit in JCO RFC function call?
I called RFC function provided by ABAP from JCo connection, found that each RFC function is a db LUW itself. All the db access sql in RFC function is implicit commited.
Till now, to wrap the db access sql in seperate "Update function module" or "Perform on commit" seems to be a choice for me (like most BAPI doing so). But is it the only choice?
The point is, can we disable(or bypass) the implicit DB commit while calling a RFC function from JCo connection?Hi Guru,
Yes you approach is correct, make sure commit/rollback is possible only when a change is/was made in database.
Go through these links will be helpful,
BAPI_TRANSACTION_COMMIT with Web AS/SOAP Interface
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/d352a790-0201-0010-5082-b1a608d22b6c
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/d352a790-0201-0010-5082-b1a608d22b6c
Hope that solves your problem.
Thanks & Regards,
Kathirvel -
Getting Return values from RFC function call with visual basic
Hi,
I am creating a sample app to connect to a SAP system which call its RFC functions created with ABAP. It was known that the function will return more than 1 return values.
SAP Function name ==> "ZFMTP_RFC_GET_RESULT"
Export parameters (to SAP):
- Student Name [char 10] ==> "STUNAME"
- Student ID [char 20] ==> "STUID"
Return values (From SAP):
- Results [char 10] ==> "RESULT"
- Remarks [char 200] ==> "REMARKS"
i have managed to get sample codes for connecting and call a RFC function with vb but they only get a return value. How do i retrieve multiple return values like the above function "RESULT" and "REMARKS"?
Here's my vb code to accessing the function
Dim R3 As Object
Dim FBFunc As Object
Dim returnFunc As Boolean
Dim connected As Boolean
R3 = CreateObject("SAP.Functions")
R3.Connection.Client = "000"
R3.Connection.User = "BCUSER"
R3.Connection.Password = "minisap"
R3.Connection.Language = "DE"
R3.Connection.System = "dtsystem"
R3.Connection.Applicationserver = "xxx.xxx.xxx.xxx"
connected = R3.Connection.Logon(0, True)
If connected <> True Then
MsgBox("Unable to connect to SAP")
End If
FBFunc = R3.add("ZFMTP_RFC_GET_RESULT")
FBFunc.exports("STUNAME") = "Jonny"
FBFunc.exports("STUID") = "12345"
returnFunc = FBFunc.Call() <<== How do i get the return value? or RESULT and REMARKS of the RFC Function?
thanks alot.
Edited by: Eugene Tan on Mar 4, 2008 7:17 AMHi Gregor,
Thanks for the link....i am having some doubts with the codes, hope you can clarify them for me if you know the codes..
Below is the code snippet.
Set impReturn = CHPASS_FN.Imports("RETURN") <<=== is RETURN the standard keyword to get a return object?
expPassword.Value = currpass
expNewPass.Value = newpass
expFillRet.Value = "1"
''' Call change password function
If CHPASS_FN.Call = True Then
outFile.Write (", Called Function")
Message = impReturn("MESSAGE") <<==== So if i have 3 return values..i just replace with the return value variable names?
outFile.WriteLine " : " & Message
Else
outFile.Write (", Call to function failed")
End If
thanks alot...all your help is very appreciated. -
RFC function call from VB Script
I have an RFC enabled function that I need to call from VBScript. I was working through this issue as a BAPI call but after research and RFC not initialized error messages over and over I am coming to think that the issue is not how I was doing it but what I was trying to do with different objects.
I think the issue is that I was trying to call a RFC function with BAPI methods, I didnt understand that there was I difference but now I do. I don't know how to initialize the RFC on the host system and unsure if I even have all of the components on the host system to make these function calls.
The goal here is to call a function that passes 3 paramters and modifies a user object in SAP.Hello John,
are you using DCOM Connector? I have a VBScript working correctly, using DCOM Connector, and consuming a Z function module defined as RFC.
What's the error message you're getting?
Regards
Michael -
RFC Function calls modal dynpro
Hello,
I programmed an outlook addin which calls an abap RFC function to store the email with sap content. Within the function a modal dialog is called to enter some information. The outlook addin is waiting for the function to add some information to ms outlook. This handling has three big disadvantanges. 1. the dynpro is opened in the backgound of the outlook window. 2. the modal dynpro has no button in the task band. 3. The dynpro is not bound to the outlook window.
To get the dynpro in the front you need to lower some other windows or you have to use the ALT TAB function to click through all windows. The RFC function gets the windows handle by the outlook addin but I dont know how to handle it? Can I bound the dynpro to the outlook window so that if I click on the outlook button the dynpro will appear? Can I give the focus to the dynpro? Is there any better idea to handle this problem in a better way?
Thanks in advance for any suggestion...Hi,
The second fm is called inside the first fm. , so giving result out you need to declare export paramters in the first fm.
aRs -
How to handle JCO Exceptions at JCO (RFC) function call
Hello Forum,
I am implementing an JCO Server scenario.
I use dynamic repositories like Example7.java from the JCO documentation.
Example7 throws an JCO.AbapException if anything went wrong, e.g. the function is not implemented.
How to react on this AbapException?
The examples in SAP Help documentation only catch
SYSTEM_FAILURE and COMMUNICATION_FAILURE.
All other RFC modules I have seen which declare the function modules to be used by dynamic JCO repositories (like Example7.java) do not define any other Exception parameters.
But these two are only thrown and caught when something with communication went completely wrong, e.g. RFC not found.
But when RFC can be reached and the JCO Server is executing the Java method, an AbapException could be thrown on error. How to react on this?
In my implementation based on the examples I always get a ABAP dump. The dump says:
Exception named without message text. Why that name?
How to handle this type of exception in order to avoid the dump?
Can anyone post an example please?
Thanks,
Carsten
Edited by: Carsten Schön on Apr 15, 2008 4:22 PM
Edited by: Carsten Schön on Apr 15, 2008 4:24 PMHi Micky,
thanks for your quick response.
If so, to throw JCO.AbapException on JCO Server side is not correct?
What I do is throwing the JCO.AbapException (like in the JCO Example 7).
At the RFC call in APAB I handle both exceptions SYSTEM_FAILURE and COMMUNICATION_FAILURE like
CALL FUNCTION 'MY_JCO_FUNCTION_MODULE'
DESTINATION JCO_DEST
<...>
EXCEPTIONS
SYSTEM_FAILURE = 1 MESSAGE RFC_MESS
COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.
This works as far something with RFC is wrong, e.g. Server can not find the function or Server not reachable.
But the AbapException thrown by the JCO Server (Java) is not handled that way. Why?
Sorry if this is the wrong forum but I tried posting in Netweaver integration and got no answer for 1 week and because it's ABAP related I thought the topic suites here.
Carsten
Edited by: Carsten Schön on Apr 15, 2008 5:10 PM -
Hi friends ,
I have created on RFC in R/3 to update saftystock in MARC table . when i execute this in SE37 it is updating the MARC table . The proble is when i execute this RFC from BW system with the
CALL FUNCTION 'ZSCPI033' destination 'TCOCLNT101'
EXPORTING
BAPI_HEAD =
BAPI_MARC1 =
BAPI_MARCX =
IMPORTING
BAPI_RETURN = V_RETURN1
TABLES
INT_MAT = t_process
It is updating the record in MARC table of R/3 system with the value 0. BAPI_return type is showing 'S'.
can anybody help me on this pls.
Regards
prithvi.Hi
Kindly do coding
put a COMMIT WORK after the RFC
if l_failure = 'X' .
rollback work .
message i000 with reservation ' : Data not saved! '.
else.
commit work .
message s000 with reservation
' : successfully saved! '.
endif.
Reward points...for your query answered -
How do I retrieve records from a table using JCO RFC Function Call
Hi
I am totally new to SAP Java Progamming. And I would like to know if I am writing code correctly. I read some tutorials in the Internet but I am still not sure if I am doing it the correct way.
This is what my vendor has given me.
My question is whether this is the correct optimum way to do get the customer detail based on an array of input values for the customer reference number.
Input:
I_CUSTNO - Any number customer IDs. This is a table similar to I_CUSTDETL
Output:
Structure name: I_CUSTDETL
Note: The CUSTID column has been added in the structure to identify the address of the relevant customer id
Field details:
Field Name Data Type Length
CUSTID Character 10
COMPANYNAME Character 40
EMAIL Character 40
This is my code:
JCoFunction function = connect.getFunction("Z_GET_CUSTOMER");
JCoTable cust = function.getTableParameterList().getTable("I_CUSTNO");
cust.appendRow();
cust.setValue("CUSTID", "10000700");
cust.appendRow();
cust.setValue("CUSTID", "10000701");
cust.appendRow();
cust.setValue("CUSTID", "10000702");
connect.execute(function);
JCoTable table = function.getTableParameterList().getTable("I_CUSTDETL");
System.out.println("Table size: " + table.getNumRows());
for (int i = 0; i < table.getNumRows(); i++, table.nextRow()) {
String custid= table.getValue("CUSTID").toString();
String companyname = table.getValue("COMPANYNAME").toString();
String email = table.getValue("EMAIL").toString();
System.out.println("----
System.out.println("Record Number::" + i + "::");
System.out.println("----
System.out.println("Value custidis::" + custid+ "::");
System.out.println("Value companyname is::" + companyname + "::");
System.out.println("Value email is::" + email + "::");Hi,
Answer to your question :whether this is the correct optimum way to do get the customer detail based on an array of input values for the customer reference number? is
YES.
Regards,
Ganga -
Debugging RFC function module from ECC to CRM
Hi All,
My requirement is to debug an RFC function module present in CRM(7.0) system from ECC(6.0) system. A report program in ECC will call CRM custom FM. I found many posts in SDN with the same issue and tried to implement suggestions provided there. But I couldn't succeed. The approach I followed is:
I logged in to ECC report program and kept an external breakpoint just before the function module call.
I logged in to CRM system, opened the function module and kept an external breakpoint there.
In both the systems I provided the dialogue userid( id through which I log in to SAPGUI) in the system->settings->debugging option.
In CRM I activated the external break point in transaction SRDEBUG.
Now when I execute the report program in ECC, control stops at the breakpoint. If I press F5 at the function call, control is not going to the external break point set in the CRM FM. I am getting output of FM directly.
I tried with different settings like turning on the check box for IP matching and session breakpoint active immediate, switching to classic debugger etc. I also tried to provide the RFC user id instead of dialogue user but system throws exception saying only dialogue userids are allowed. I found that by inserting an infinite loop statement, control goes inside the RFC CRM FM but I prefer not to change the code.
Please let me know if I missed anything.
Thanks and Regards,
NarenHi,
Debug RFC calls
When an RFC function module is called it is usually not possible to debug the call, using the below techniques we can achieve the same. For this example we are calling an RFC enabled FM in ECC system from CRM system.
Scenario 1: Calling a custom RFC FM
STEP 1: Add an infinite loop in the remote custom Function Module (adding a u201CDO. ENDDO.u201D statement at the start of the FM would be enough).
STEP 2: Execute your program in the CRM system. The execution stops at the RFC call, because of the infinite loop.
STEP 3: Now login to the ECC system and go to transaction SM51 select the process which is executing the RFC and navigate to the menu: u201CProgram/Session->Program->Debuggingu201D this triggers the debugger session in a separate window.
Scenario 2: Calling a Standard RFC FM
When we are debugging a standard program we cannot add the infinite loop, hence we cannot go to SM51 and debug the work process. The RFC destination for the ECC system has a User specified, the RFC function module gets executed using this users credentials. Usually the basis team set up the RFC user as non Dialog user, this does not allow debugging. Contact your Basis team and get this changed to a dialog user enabling you to debug RFC function calls via the normal debugger.
Note: User name configured in the RFC destination (transaction SM59)
Note: User type for the RFC User (transaction SU01D)
Hope this will be helpful.. -
How to increase RFC lookup calls
Hi gurus,
we are using RFC Lookup functionality in graphical mapping. We tried to send 60.000 messages every hour. But it takes ca. 30 minutes in SAP PI mapping environment. I checked the communication monitoring see that every seconds send RFC receiver communication channel 20 RFC calls to SAP.
In RFC Receiver channel i have been set the maximum connection to '30'. Shold i increase this parameter or is there another functionality?
My question is, it is possible to increase RFC lookup calls?
Kind Regards,
PMhave you seen below link:
http://sapxitutorials.blogspot.com/2011/04/graphical-rfc-lookup-and-how-you-can.html -
Invoke RFC function without input parameters
Is it possible to invoke RFC function that doesn't have input parameters? It returns all data from reference.
Hi Denis,
pls keep in mind that no reference parameter is allowed in RFC, you have to check that "Pass Value" flag.
Thanks
Luis -
Python sapnwrfc FUNCTION CALL ERROR
Hi everyone,
I am trying an external rfc connection with sapnwrfc-0.05 for Python. I have the latest nwrfcsdk from SAP. It took me a while to figure out the new python module methods, but I am now able to connect successfuly.
I have a function module that I need to call and feed external data to it. This function is writing to a Z table of mine. I have done this successfuly with previous versions of python sapnwrfc module.
Here is my test code:
import sapnwrfc
conn = sapnwrfc.base.rfc_connect({'ashost':'HOSTNAME', 'sysnr':'00', 'client':'900', 'user':'RFCUSER', 'passwd':'PASSWORD' })
if conn :
print "I am connected"
# VBELN = CHAR
# LNUMB = NUMC
# WERKS = CHAR
# GJAHR = NUMC
# HEAT = NUMC
# ZIERA = CHAR
# ZLENG = CHAR
# ZWEIG = CHAR
# ZINDX = CHAR
# ZPDA = CHAR
# ZTIME = CHAR
data = [VBELN+LNUMB+WERKS+GJAHR+HEAT+ZIERA+ZLENG+ZWEIG+ZINDX+ZPDA+ZTIME]
iface = conn.discover("MY_Z_FUNCTION_MODULE")
f = iface.create_function_call()
# MY_Z_FUNCTION_MODULE has a TABLE structure DATA
f.DATA(data)
f.invoke()
print "Done"
conn.close()
When I run this code I get the following ERROR:
File "/usr/lib/python2.4/site-packages/sapnwrfc/__init__.py", line 165, in invoke
return self.handle.invoke()
sapnwrfc.RFCCommunicationError: RFC FUNCTION CALL ERROR: set_table_line invalid Input value type
The same function module was working before, when called with DATA as a single string item in a list.
Any help?
Thank you all.
MenelaosAs I discovered, you need to supply the DATA table structure with a dictionary of its field values:
data = [{'VBELN':VBELN,
'LNUMB':LNUMB,
'WERKS':WERKS,
'GJAHR':GJAHR,
'HEAT':HEAT,
'ZIERA':ZIERA,
'ZLENG':ZLENG,
'ZWEIG':ZWEIG,
'ZINDX':ZINDX,
'ZPDA':ZPDA,
'ZTIME':ZTIME}]
Just make sure that each field has the correct size. The data types in the dictionary should all be strings, but the string contents should match the field types of the DATA table structure....
This is really an improvement over the old method (single string) but some documentation would be helpfull Piers!
Can I help?
Menelaos Maglis
Edited by: Menelaos Maglis on Jul 25, 2008 10:49 AM
A correction on the data field types. -
I am trying to call a function (type4) from within a FormCalc exit event:
if ($.rawValue <> "2") then
type4.validate()
endif
But when I run the form, I get an error saying that the "script does not have a method 'validate'."
My function definitely does have a method called 'validate', see below:
function validate() {
Can anyone help me identify what I'm doing wrong? Thanks for your help.
--BruceHi,
I beleive validate() is a reserved method, so you should rename your function into validateObj() or so.
And when calling a function, the syntax looks like:
if ($.rawValue <> "2") then
validateObj()
endif
In contrast to JavaScript FormCalc can only call functions which have been declared before the function call.
Just an example.
This script works, because the function is declared before it's called.
func alert(msg) do
$host.messageBox(msg)
endfunc
if ($ < 2) then
alert("value to small")
else
alert("value ok")
endif
but this script fails, because the function call points to a function which has not be declared yet.
if ($ < 2) then
alert("value to small")
else
alert("value ok")
endif
func alert(msg) do
$host.messageBox(msg)
endfunc -
Profiler tracking function call
Hi there,
is it possible to track a function call in a stored procedure?
thanks,
Ed<TypesInSSMS>
CREATE FUNCTION myfunky() RETURNS int AS
BEGIN
DECLARE @ret int
SELECT @ret = @@spid
RETURN (SELECT @@spid)
END
go
CREATE PROCEDURE sproc AS
SELECT dbo.myfunky() FROM sys.objects
</TypesInSSMS>
Starts Profiler. Select the entire event category Stored Procedures. In the query window selects "sproc". Clicks Execute. Looks in Profiler.
Seems like the answer is yes.
Erland Sommarskog, SQL Server MVP, [email protected]
Maybe you are looking for
-
Hello Everyone, I have been working as SAP Business Development Executive, with 5 years of Sales Background.Engaging with selling different SAP products. I feel, I should shift my profile as SAP R/3 Pre Sales Consultant, as i always passionate about
-
I am getting following error while trying to login to Apex reports menu page. The application uses Database Authentication and there are no other validations. The database account i am using is open and password expiry time is 22-jan-2008. Also i am
-
I have Creative Suite 5 Design Premium (teacher and student edition), how can i upgrade to cs6 and how much is it. I want to use it forAdobe Creative Suite 6 Design & Web Premium Digital Classroom Book ? I already bought the book thinking it was fo
-
Hi all, I am created UDF attachment link in Sale order once attachment done it will raise the A/R invoice template. Option copy from sale order to AR invoice should be block in store procedure " Without attachment A/R invoice should not raise" How
-
How to pass parameters to the Control file while loading the data from flat file to staging table
Thanks in advance