Advertisement
rplantiko

Programmatically change interface of a function module

Jul 24th, 2012
647
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 1.77 KB | None | 0 0
  1. *&---------------------------------------------------------------------*
  2. *& Report  ZZ_TEST_CHANGE_PARAMETER
  3. *&---------------------------------------------------------------------*
  4. *& Change the interface of a function module programmatically
  5. *& See http://scn.sap.com/thread/3210360
  6. *& Doesn't regenerate the interface template in the implementation part
  7. *&---------------------------------------------------------------------*
  8.  
  9. report  zz_test_change_parameter.
  10.  
  11. parameters: p_fnam type eu_lname default 'Z_TEST_FOR_CHANGE',
  12.             p_para type rs38l_par_ default 'IV_PARAM',
  13.             p_type type rs38l_typ default 'BOOLE_D'.
  14.  
  15. start-of-selection.
  16.   perform start.
  17.  
  18. * ---
  19. form start.
  20.  
  21.   data: lo_fm type ref to cl_function_builder,
  22.         lo_dark type ref to if_wb_dark_functionality,
  23.         ls_import type rsfbpara,
  24.         lv_line type i.
  25.  
  26.   create object lo_fm.
  27.   lo_dark ?= lo_fm.
  28.  
  29.   lo_dark->read( im_name = p_fnam ).
  30.  
  31.   read table lo_fm->interface-import into ls_import
  32.     with key parameter = p_para.
  33.   check sy-subrc eq 0.
  34.   lv_line = sy-tabix.
  35.   ls_import-structure = p_type.
  36.  
  37.   call method lo_fm->update_parameter
  38.     exporting
  39.       parameter      = ls_import
  40.       line           = lv_line
  41.       parameter_type = 'I'
  42.     changing
  43.       param_table    = lo_fm->interface-import
  44.       param_docu     = lo_fm->interface-paramtext
  45.       modparam       = lo_fm->interface-nparam
  46.       moddocu        = lo_fm->interface-npdocu
  47.     exceptions
  48.       error          = 1
  49.       others         = 2.
  50.  
  51.   if sy-subrc <> 0.
  52.     message id sy-msgid type 'I' number sy-msgno
  53.                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  54.   endif.
  55.  
  56.  
  57.   lo_dark->save( ).
  58.  
  59.   lo_dark->activate( 'X' ).
  60.   commit work.
  61.  
  62. endform..                    "start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement