‎2009 Jun 23 12:14 PM
I'm calling a RFC function in an XI system:
CALL FUNCTION 'Z_HR_RFC_GEI_ENVIARLIQUIDACION' DESTINATION 'RFC_XIADAPTER_GEI'
EXPORTING
reinr = p_tripnr_sap
pernr = trip_header-pernr
landx = p_trip_landx
datv1 = p_datini
datb1 = p_datfin
uname = p_uname
auto = '1'
IMPORTING
codgei = p_codgei
desgei = p_desgei
RESULT = p_result
TABLES
expenses = t_lineas
ordenes = t_ordenes
EXCEPTIONS
system_failure = 1
OTHERS = 2.
And I get sy-subrc = 1. The curious thing is that when I send wrong data (an empty table of expenses, for example) y correctly get the error (no expenses lines) from the remote system and sy-subrc returns 0.
What can the problem be?
Thank you in advance.
‎2009 Jun 24 8:51 AM
That is because of the error in the connector.
When you execute the FM, It will trigger some service in the connector. When the exception come from the sequence of services or service of the connector, you will get SY-SUBRC = 1.
To avoid the runtime error:
If sy-subrc = 1.
MESSAGE E002 WITH 'Internal error in Connector'.
endif.Thanks and Regards
‎2009 Jun 23 12:21 PM
Hi try this way...
CALL FUNCTION 'Z_HR_RFC_GEI_ENVIARLIQUIDACION'
IN BACKGROUND TASK "Add this while pushing data to XI
DESTINATION 'RFC_XIADAPTER_GEI'
EXPORTING
reinr = p_tripnr_sap
pernr = trip_header-pernr
landx = p_trip_landx
datv1 = p_datini
datb1 = p_datfin
uname = p_uname
auto = '1'
IMPORTING
codgei = p_codgei
desgei = p_desgei
RESULT = p_result
TABLES
expenses = t_lineas
ordenes = t_ordenes
EXCEPTIONS
system_failure = 1
OTHERS = 2.
Prabhudas
‎2009 Jun 24 8:37 AM
This does avoid the connection error, but somehow makes the function fail to retrieve the results.
The function has to perform some tasks and then return the obtained code.
I think the connection error is due to another error, in the remote system. Maybe the remote function gets stuck and since there is no response in time I'm getting the connection error.
If I run the RFC function as a background task, how do I know whether there has been some problem or not?
Thanks.
‎2009 Jun 24 8:51 AM
That is because of the error in the connector.
When you execute the FM, It will trigger some service in the connector. When the exception come from the sequence of services or service of the connector, you will get SY-SUBRC = 1.
To avoid the runtime error:
If sy-subrc = 1.
MESSAGE E002 WITH 'Internal error in Connector'.
endif.Thanks and Regards
‎2009 Jun 24 9:41 AM
It can't be just a connection error. When I call the function with wrong data the remote system does return the adequate error code and message, so the connection is taking place and the remote function is working.
The problem may be that when correct data are sent the remote process takes too long for the connection to remain open or maybe that an error occurs, but the process gets stuck instead of returning the error via the function.
In the first case, I guess calliing the function as a background task should be Ok for the remote process to end correctly, but I won't be able to retrieve the data I need to continue my own process.
Any thoughts?
Thanks
‎2009 Jun 26 10:48 AM