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

Synchronous RFC

Former Member
0 Likes
623

Hi,

I am making a synchronous RFC call passing a structure and expecting a return value like "No of records updated"

I am passing a structure to XI from R/3 using RFC call. Xi has to insert this structure in a legacy database table and return the number of records inserted.

It is working fine when everything is fine but when the legacy database is down it is giving me a short dump

"call to messaging system failed: com.sap.aii.af.ra.ms.api.DeliveryException:" How to handle this exception? Please send me some solution to this ASAP.

My code is given below

CALL FUNCTION 'RFC_SYSTEM_INFO' DESTINATION l_rfcdest

IMPORTING

rfcsi_export = l_rfcsi

  • rfc_login_complete =

  • dialog_user_type =

  • current_resources =

  • maximal_resources =

  • recommended_delay =

EXCEPTIONS

communication_failure = 1 MESSAGE l_msg

system_failure = 2 MESSAGE l_msg

OTHERS = 3.

IF sy-subrc EQ 0.

IF l_msg IS INITIAL.

CALL FUNCTION 'Z_SAP_TO_CADB' DESTINATION l_rfcdest

TABLES

pt_items = pt_items

CHANGING

return = return1.

Here i am checking for the RFC destination first, if RFC destination is fine then only i am making an RFC call to XI.

Pt_items is the structure i am passing to XI

return1 is where i am expecting the number of records inserted.

Thanks in advance

Rajesh.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
547

Try adding the exception handling to the Z_SAP_TO_CADB function call. So the following should be your call:

CALL FUNCTION 'Z_SAP_TO_CADB' DESTINATION l_rfcdest

TABLES

pt_items = pt_items

CHANGING

return = return1

EXCEPTIONS

communication_failure = 1 MESSAGE l_msg

system_failure = 2 MESSAGE l_msg

OTHERS = 3.

If sy-subrc eq 0.

Your Logic.

else.

Exception handling.

endif.

Hope it helps.

Sunil Achyut

Try adding the exception handling to the Z_SAP_TO_CADB function call. So the following should be your call:

CALL FUNCTION 'Z_SAP_TO_CADB' DESTINATION l_rfcdest

TABLES

pt_items = pt_items

CHANGING

return = return1

EXCEPTIONS

communication_failure = 1 MESSAGE l_msg

system_failure = 2 MESSAGE l_msg

OTHERS = 3.

If sy-subrc eq 0.

Your Logic.

else.

Exception handling.

endif.

Hope it helps.

Sunil Achyut

3 REPLIES 3
Read only

Former Member
0 Likes
548

Try adding the exception handling to the Z_SAP_TO_CADB function call. So the following should be your call:

CALL FUNCTION 'Z_SAP_TO_CADB' DESTINATION l_rfcdest

TABLES

pt_items = pt_items

CHANGING

return = return1

EXCEPTIONS

communication_failure = 1 MESSAGE l_msg

system_failure = 2 MESSAGE l_msg

OTHERS = 3.

If sy-subrc eq 0.

Your Logic.

else.

Exception handling.

endif.

Hope it helps.

Sunil Achyut

Read only

0 Likes
547

Sunil,

Thanks for your inputs, Your solution works and solved my problem. Also i rewarded points.

Read only

Former Member
0 Likes
547

Hi ,

Try using the below FM to check the destination and if its successful then cal FM 'Z_SAP_TO_CADB' .

  • Check RFC Destination++

CALL FUNCTION 'RFC_VERIFY_DESTINATION'

EXPORTING

destination = ws_dest

  • AUTOUPDATE = ' '

  • TIMEOUT = 60

  • IMPORTING

  • RFCSI_EXPORT =

  • RFC_LOGIN_COMPLETE =

  • DIALOG_USER_TYPE =

  • CURRENT_RESOURCES =

  • MAXIMAL_RESOURCES =

  • RECOMMENDED_DELAY =

  • CHARSIZE =

  • UPDATED =

EXCEPTIONS

internal_failure = 1

timeout = 2

dest_communication_failure = 3

dest_system_failure = 4

update_failure = 5

no_update_authority = 6

OTHERS = 7.

Regards,

Sreejesh .