Advertisement
Jaehoon

EXT202_3.2.3

Feb 11th, 2020
1,214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 1.42 KB | None | 0 0
  1. class ZCL_A4C_RFC_XXX definition
  2.   public
  3.   final
  4.   create public .
  5.  
  6. public section.
  7.   interfaces if_oo_adt_classrun.
  8. protected section.
  9. private section.
  10. ENDCLASS.
  11.  
  12.  
  13.  
  14. CLASS ZCL_A4C_RFC_XXX IMPLEMENTATION.
  15.   METHOD IF_OO_ADT_CLASSRUN~MAIN.
  16.     TRY.
  17.       DATA(lo_destination) = cl_rfc_destination_provider=>CREATE_BY_CLOUD_DESTINATION(
  18.                               i_name                  = 'S70_RFC_000'
  19.                               i_service_instance_name = 'OutboundComm_for_RFCDemo_000'
  20.                              ).
  21.  
  22.       DATA(lv_destination) = lo_destination->get_destination_name( ).
  23.  
  24.       DATA lv_result type c length 200.
  25.       DATA: msg TYPE c length 200.
  26.  
  27.       CALL function 'RFC_SYSTEM_INFO'
  28.       destination lv_destination
  29.         IMPORTING
  30.           RFCSI_EXPORT      = lv_result
  31.  
  32.         EXCEPTIONS
  33.           system_failure        = 1 MESSAGE msg
  34.           communication_failure = 2 MESSAGE msg
  35.           OTHERS                = 3.
  36.         CASE sy-subrc.
  37.            WHEN 0.
  38.              out->write( lv_result ).
  39.            WHEN 1.
  40.              out->write( |EXCEPTION SYSTEM_FAILURE | && msg ).
  41.            WHEN 2.
  42.              out->write( |EXCEPTION COMMUNICATION_FAILURE | && msg ).
  43.            WHEN 3.
  44.              out->write( |EXCEPTION OTHERS| ).
  45.          ENDCASE.
  46.  
  47.     catch cx_root into data(lx_root).
  48.       out->write( lx_root->get_text( ) ).
  49.     endtry.
  50.   ENDMETHOD.
  51.  
  52. ENDCLASS.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement