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

Handling exception in a RFC enabled funciton module

Former Member
0 Likes
391

Hi All,

I have a generic query like suppose if an exception occured in RFC call to a function module..is there is any specific way to handle the exception???

Thanks in advance.

Joe

Hi All,

I have a generic query like suppose if an exception occured in RFC call to a function module..is there is any specific way to handle the exception???

Thanks in advance.

Joe

1 REPLY 1
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
361

Hello Joe,

This is how we handle MESSAGE in RFC enabled FMs.

DATA:
    L_V_RFC_MESS TYPE CHAR72.

  CALL FUNCTION <RFC Func. Name>
    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.

  CLEAR: L_V_SIZE, L_V_LEN.

  WRITE: / TEXT-M00, SY-SUBRC.

  CASE SY-SUBRC.
    WHEN 0.
      WRITE: / TEXT-M01.
    WHEN 1.
      WRITE: / TEXT-M02,
             / L_V_RFC_MESS.
    WHEN 2.
      WRITE: / TEXT-M03,
             / L_V_RFC_MESS.
    WHEN 3.
      WRITE: / TEXT-M04.
    WHEN 6.
      WRITE: / TEXT-M05.
  ENDCASE.

Hope i am clear.

BR,

Suhas