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 Destination Catch Exceptions

Former Member
0 Likes
1,094

Hello,

I've a program with call to RFC destination 'XI' , i want to know if it is possible catch exceptions when in the other system (XI) a fault occurs, for example, the database table in which I want to insert the data is not created. Now, if this happens a dump occurs

thanks very much,

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
488

Hello,

You can try this way with your RFC function module:

CALL FUNCTION 'RFC_WRITE_FILE'
    DESTINATION FP_P_DEST
    EXPORTING
      FILE                  = L_V_NAME
      FORMAT                = L_C_BIN
      SIZE                  = L_V_SIZE
      LANGUAGE              = SY-LANGU
    IMPORTING
      SIZE                  = L_V_SIZE
    TABLES
      FILEDATA              = L_IT_FILE
    EXCEPTIONS
      SYSTEM_FAILURE        = 1  MESSAGE L_V_RFC_MESS
      COMMUNICATION_FAILURE = 2  MESSAGE L_V_RFC_MESS
      ILLEGALNAME           = 3
      OTHERS                = 6.

  CASE SY-SUBRC.
    WHEN 0.

    WHEN 1.

    WHEN 2.

    WHEN 3.

    WHEN 6.

  ENDCASE.

The SY-SUBRC value can be captured this way. Hope this helps.

BR,

Suhas

Edited by: Suhas Saha on Mar 24, 2009 4:14 PM

1 REPLY 1
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
489

Hello,

You can try this way with your RFC function module:

CALL FUNCTION 'RFC_WRITE_FILE'
    DESTINATION FP_P_DEST
    EXPORTING
      FILE                  = L_V_NAME
      FORMAT                = L_C_BIN
      SIZE                  = L_V_SIZE
      LANGUAGE              = SY-LANGU
    IMPORTING
      SIZE                  = L_V_SIZE
    TABLES
      FILEDATA              = L_IT_FILE
    EXCEPTIONS
      SYSTEM_FAILURE        = 1  MESSAGE L_V_RFC_MESS
      COMMUNICATION_FAILURE = 2  MESSAGE L_V_RFC_MESS
      ILLEGALNAME           = 3
      OTHERS                = 6.

  CASE SY-SUBRC.
    WHEN 0.

    WHEN 1.

    WHEN 2.

    WHEN 3.

    WHEN 6.

  ENDCASE.

The SY-SUBRC value can be captured this way. Hope this helps.

BR,

Suhas

Edited by: Suhas Saha on Mar 24, 2009 4:14 PM