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 system error

Former Member
0 Likes
736

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
688

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

5 REPLIES 5
Read only

Former Member
0 Likes
688

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

Read only

0 Likes
688

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.

Read only

Former Member
0 Likes
689

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

Read only

0 Likes
688

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

Read only

Former Member
0 Likes
688

Finally the remote function will be changed. Thank you.