Skip to main content

Source Code of Function Modules

Introdcution

On this page, you will find the source code of the function modules.
Please make sure to check the version number of this user manual so that the required coding matches the version of the Performer Suite you have installed.

Note:

Source Code for BW/4HANA:

Z_RFC_READ_REPORT v1_1

Source Code of Z_RFC_READ_REPORT
ABAP
function z_rfc_read_report
  importing
    value(program) like sy-repid
  exporting
    value(system) like sy-sysid
    value(trdir) like trdir
  tables
    qtab like bapitgb
  exceptions
    release_1_1
    not_authorized.





  refresh qtab.
  read report program into qtab.
  select single * from trdir where name = program. "#EC CI_ALL_FIELDS_NEEDED
  system = sy-sysid.
*************New ADÜ_20250430
  IF sy-subrc <> 0.
"handled later in the Performer Suite
  ENDIF.
*************End ADÜ_20250430



endfunction.

Z_RFC_CODESCAN v2_3

Source Code of Z_RFC_CODESCAN
ABAP
function z_rfc_codescan
  importing
    value(i_case) type rs_bool default ''
    value(i_skip_comment) type rs_bool default 'X'
    value(i_regex) type rs_bool default ''
    value(i_updru) type rs_bool default 'X'
    value(i_tranr) type rs_bool default 'X'
    value(i_trans) type rs_bool default 'X'
    value(i_iobjrout) type rs_bool default 'X'
    value(i_ip) type rs_bool optional
    value(i_dtp) type rs_bool optional
    value(i_reps) type rs_bool optional
    value(i_clas) type rs_bool optional
    value(i_func) type rs_bool optional
    value(i_plse) type rs_bool optional
  tables
    t_string_range like rsrange
    t_devcl_range like rsrange
    t_reps_range like rsrange
    t_subc_range like rsrange
    t_clas_range like rsrange
    t_fugr_range like rsrange
    data like tab512
  exceptions
    release_2_3
    input_cannot_be_treated
    not_authorized.



  data:
    ls_data            like line of data,
    ls_result          type s_result,
    ls_line            type c length 255,
    lv_nspacegen       type namespace,
    lv_name_w_o_prefix type rs_char30,
    lt_string          type t_string,
    ls_string          type s_string.

  field-symbols:
    <string>  type s_string,
    <s_range> type rsrange.

*--------------------------------------------------------------------

  clear:
    gt_rsaabap,
    gt_object,
    gt_result.

  loop at t_string_range assigning <s_range>.

    if ( <s_range>-high = 'ODSO' or <s_range>-high = 'CUBE'
      or <s_range>-high = 'CHAR' or <s_range>-high = 'IOBJ')
      or <s_range>-high = 'ADSO'. "ADü_20189424 - DP-96
      call function 'RSD_NSPACE_PAR_GET_FROM_NAME'
        exporting
          i_objnm           = <s_range>-low
        importing
*         E_NAMESPACE       =
          e_nspacegen       = lv_nspacegen
*         E_SYSTP           =
          e_name_w_o_prefix = lv_name_w_o_prefix
*         E_SOBJNM_W_O_PREFIX =
        exceptions
          name_error        = 1
          others            = 2.

      if sy-subrc = 0.
        "regular expressions: the . is a placeholder for a single sign
        if <s_range>-high = 'ODSO'.
          "sign after prefix is A
          concatenate lv_nspacegen 'A' lv_name_w_o_prefix '.0'
           into ls_string.
          "Start Change ADü_20189424 - DP-96
        elseif <s_range>-high = 'ADSO'.
          "sign after prefix is A
          concatenate lv_nspacegen 'A' lv_name_w_o_prefix '.'
           into ls_string.
          "End Change ADü_20189424 - DP-96
        elseif <s_range>-high = 'CUBE'.
          "sign after prefix can be D,E or F
          concatenate lv_nspacegen '.' lv_name_w_o_prefix
           into ls_string.
        elseif ( <s_range>-high = 'CHAR' or <s_range>-high = 'IOBJ' ).
          concatenate lv_nspacegen '.' lv_name_w_o_prefix
           into ls_string.

          "Start Change ADü_20180426 - DP-1945
          data: ls_string2 type s_string,
                ls_string3 type s_string,
                ls_fieldnm type rsdiobjfieldnm.

          select single fieldnm
            from rsdiobj
              into ls_fieldnm
                where iobjnm  = <s_range>-low
                  and objvers = 'A'.
*************New ADÜ_20250430
          IF sy-subrc <> 0.
            "handled later in the Performer Suite
          ENDIF.
*************End ADÜ_20250430

          if ls_fieldnm is not initial.

            concatenate '-' ls_fieldnm '\.' into ls_string2.
            append ls_string2 to lt_string.
            concatenate '-' ls_fieldnm '\s' into ls_string3.
            append ls_string3 to lt_string.

          endif.
          "End Change ADü_20180426 - DP-1945

        endif.
      endif.
    else.
      ls_string = <s_range>-low.
    endif.

    append ls_string to lt_string.

  endloop.


  if i_updru = 'X' or i_tranr = 'X' or i_trans = 'X'
     or i_iobjrout = 'X'.
    perform scan_rsaabap
      tables lt_string
      using i_skip_comment i_case i_regex i_updru
            i_tranr i_trans i_iobjrout.
  endif.

  if i_dtp = 'X'.
*BEGIN New ADü_20250328
    authority-check object 'S_RS_DTP'
     id 'RSTLDTPSRC' field '*'
     id 'RSSTDTPSRC' field '*'
     id 'RSONDTPSRC' field '*'
     id 'RSTLDTPTGT' field '*'
     id 'RSSTDTPTGT' field '*'
     id 'RSONDTPTGT' field '*'
     id 'ACTVT' field '03'.
    if sy-subrc <> 0.
      raise not_authorized.
    else.
*END New ADü_20250328
      perform scan_dtp
      tables lt_string t_devcl_range
      using i_skip_comment i_case i_regex.
*BEGIN New ADü_20250328
    endif.
*END New ADü_20250328
  endif.

  if i_ip = 'X'.
    perform scan_ip
      tables lt_string t_devcl_range
      using i_skip_comment i_case i_regex.
  endif.

  if i_reps = 'X'.
    perform get_reps
      tables t_devcl_range t_reps_range t_subc_range.
  endif.

  if i_clas = 'X'.
    perform get_clas
      tables t_devcl_range t_clas_range.
  endif.

  if i_func = 'X'.
    perform get_func
    tables t_devcl_range t_fugr_range.
  endif.

  if i_plse = 'X'.
    perform get_plse
    tables lt_string t_devcl_range
      using i_skip_comment i_case i_regex.
  endif.


  if not gt_object is initial.
    perform scan_include_code
      tables lt_string
        using i_skip_comment i_case i_regex.
  endif.

  "Fill result table
  loop at gt_result into ls_result.
    if i_skip_comment = 'X'.
      if ls_result-line(1) = '*'.
        continue.
      else.
        ls_line = ls_result-line.
        shift ls_line left deleting leading space.
        "Start change ADü_20180618 - DP-1210
        "AMDP Code
        if   ls_result-routinetype = 'RT20'
          or ls_result-routinetype = 'RT21'
          or ls_result-routinetype = 'RT22'
          or ls_result-routinetype = 'RT23'
          or ls_result-routinetype = 'RT24'
          or ls_result-routinetype = 'RT30'
          or ls_result-routinetype = 'RT31'
          or ls_result-routinetype = 'RT32'
          or ls_result-routinetype = 'RT33'.
          if ls_line(2) = '--'.
            continue.
          endif.
          "ABAP Code
        else.
          "End change ADü_20180618 - DP-1210
          if ls_line(1) = '"'.
            continue.
          endif.
          "Start change ADü_20180618 - DP-1210
        endif.
        "End change ADü_20180618 - DP-1210
      endif.
    endif.
    ls_data = ls_result.
    append ls_data to data.

  endloop.

endfunction.


*&--------------------------------------------------------------------*
*&      Form  scan_rsaabap
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form scan_rsaabap
    tables lt_string
    using i_skip_comment i_case i_regex i_updru i_tranr
           i_trans i_iobjrout.

  types:
    begin of s_lookup,
      targetname    type rstran-targetname,
      targettype    type rstran-targettype,
      targetsubtype type rstran-targetsubtype,
      sourcename    type rstran-sourcename,
      sourcetype    type rstran-sourcetype,
      sourcesubtype type rstran-sourcesubtype,
      codeid        type rsaabap-codeid,
      tranid        type rstran-tranid,
      set_runtime   type char1,
      iobjnm        type rsupdrout-iciobjnm,
      routinetype   type c length 4,
      routine       type n length 4,
    end of s_lookup,
    t_lookup type standard table of s_lookup.

  data:
    l_tabix          like sy-tabix,
    lt_rsaabap       type t_rsaabap,
    ls_rsaabap       type s_rsaabap,
    ls_match_result  type match_result,
    lt_lookup_finder type t_lookup,
    ls_lookup_temp   type s_lookup,
    lt_lookup_temp   type t_lookup,
    ls_lookup        type s_lookup,
    l_updtype        like rsupddat-updtype,
    ls_result        type s_result,
    lv_txtlg         type rstxtlg.

  field-symbols:
    <string>  type s_string,
    <s_range> type rsrange.


  clear gt_rsaabap.
* Restrict on version M, because RSAABAP contains deleted coding
* that exists only in version A but not in version M!
  select a~codeid codetp line_no line
    from              rsaabap  as a
      inner join      rsarout  as r
    on a~codeid = r~codeid and a~objvers = r~objvers
    into corresponding fields of table gt_rsaabap
    where a~objvers = 'A'
    and a~codeid in (
      select codeid from rsarout
        where objvers = 'M').                               "#EC *

  "Start Change ADü_20180618 - DP-1210
  data: lv_rstranscript     type string value 'RSTRANSCRIPT',
        lv_rstranstepscript type string value 'RSTRANSTEPSCRIPT',
        lv_rstransteprout   type string value 'RSTRANSTEPROUT',
        lv_bwrelease        type saprelease,
        lv_bw4hana          type rs_bool value ''.

  types: begin of lty_sscript,
           tranid  type rstranid,
           script  type string,
           ruleid  type rstran_ruleid,
           stepid  type rstran_stepid,
           codeid  type rscodeid,
           line_no type rsaabap-line_no,
         end of lty_sscript,

         begin of lty_script,
           tranid  type rstranid,
           procnm  type char30,
           codeid  type rscodeid,
           script  type string,
           line_no type rsaabap-line_no,
         end of lty_script,

         begin of lty_rstransteprout,
           tranid   type rstranid,
           ruleid   type rstran_ruleid,
           stepid   type rstran_stepid,
           codeid   type rscodeid,
           on_hana  type rs_bool,
           line_no  type rsaabap-line_no,
           kind     type char7,
           code     type string,
           code_inv type string,
         end of lty_rstransteprout.

  data: ls_script           type lty_script,
        ls_g_script         type lty_script,
        ls_sscript          type lty_sscript,
        ls_g_sscript        type lty_sscript,
        lt_script           type table of lty_script,
        lt_g_script         type table of lty_script,
        lt_sscript          type table of lty_sscript,
        lt_g_sscript        type table of lty_sscript,
        ls_rstransteprout   type lty_rstransteprout,
        ls_g_rstransteprout type lty_rstransteprout,
        lt_rstransteprout   type table of lty_rstransteprout,
        lt_g_rstransteprout type table of lty_rstransteprout,
        lt_cvers type table of cvers.

****************New ALU 20250701
SELECT component release
  FROM cvers
  INTO TABLE lt_cvers.
* Versuch SAP_BW zu finden
CLEAR lv_bwrelease.
LOOP AT lt_cvers INTO DATA(ls_cvers).
  IF ls_cvers-component = 'SAP_BW'.
    lv_bwrelease = ls_cvers-release.
    EXIT. "#EC CI_NOORDER
  ENDIF.
ENDLOOP.

* Wenn nichts gefunden → BW/4HANA prüfen
IF lv_bwrelease IS INITIAL.
  lv_bw4hana = rs_c_true.

  LOOP AT lt_cvers INTO ls_cvers.
    IF ls_cvers-component = 'DW4CORE'.
      lv_bwrelease = ls_cvers-release.
      EXIT. "#EC CI_NOORDER
    ENDIF.
  ENDLOOP.
ENDIF.
****************End ALU 20250701 Onapsis Change

  if lv_bw4hana = rs_c_false.
    if lv_bwrelease < 740. "#EC NUMBER_OK
      "nothing
    elseif lv_bwrelease >= 740 and lv_bwrelease < 750. "#EC NUMBER_OK

      select tranid procnm script
        from (lv_rstranscript)
          into corresponding fields of table lt_script
            where objvers = 'A'.

    elseif lv_bwrelease >= 750. "#EC NUMBER_OK

      select tranid procnm script
            from (lv_rstranscript)
              into corresponding fields of table lt_script
                where objvers = 'A'.

      select tranid ruleid stepid codeid script
            from (lv_rstranstepscript)
              into corresponding fields of table lt_sscript
                where objvers = 'A'.
    endif.
  elseif lv_bw4hana = rs_c_true.
    select tranid ruleid stepid codeid code code_inv
      from (lv_rstransteprout)
        into corresponding fields of table lt_rstransteprout
          where objvers = 'A'.
  endif.
  "End Change ADü_20180618 - DP-1210

  "Start Change ADü_20180426 - DP-1945
  data: ls_complstring type string.
  loop at lt_string assigning <string>.
    if sy-tabix = 1.
      ls_complstring = <string>.
    else.
      concatenate ls_complstring '|' <string> into ls_complstring.
    endif.
  endloop.
  "End Change ADü_20180426 - DP-1945

  sort gt_rsaabap by codeid.
  loop at gt_rsaabap into ls_rsaabap.
    l_tabix = sy-tabix.
    "LOOP AT lt_string ASSIGNING <string>. "ADü_20180426 - DP-1945
    clear ls_match_result.
    if i_case = ' ' and i_regex = 'X'.
      find first occurrence of regex ls_complstring "<string> "ADü_20180426 - DP-1945
      in ls_rsaabap-line
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = 'X'.
      find first occurrence of regex ls_complstring "<string> "ADü_20180426 - DP-1945
      in ls_rsaabap-line
        in character mode
        respecting case
        results ls_match_result.
    elseif i_case = ' ' and i_regex = ''.
      find first occurrence of ls_complstring "<string> "ADü_20180426 - DP-1945
      in ls_rsaabap-line
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = ''.
      find first occurrence of ls_complstring "<string> "ADü_20180426 - DP-1945
      in ls_rsaabap-line
        in character mode
        respecting case
        results ls_match_result.
    endif.
    if sy-subrc <> 0.
      delete gt_rsaabap index l_tabix.
    endif.
    "ENDLOOP. "ADü_20180426 - DP-1945
  endloop.

  "Start Change ADü_20180618 - DP-1210
  "get the full scripts with comments:
  class cl_oo_include_naming definition load.
  data lo_clif_incl_naming  type ref to if_oo_clif_incl_naming.
  data lo_class_incl_naming type ref to if_oo_class_incl_naming.
  data l_t_method_w_include type seop_methods_w_include.
  field-symbols: <s_method_w_include> type seop_method_w_include.
  data: l_clskey type seoclskey,
        lt_abap  type abaptxt255_tab,
        ls_abap  type line of abaptxt255_tab,
        length   type i,
        last     type char30.

  "HANA Script
  loop at lt_script into ls_script.

    concatenate '/BIC/' ls_script-procnm+3 into l_clskey.

    call method cl_oo_include_naming=>get_instance_by_cifkey
      exporting
        cifkey         = l_clskey
      receiving
        cifref         = lo_clif_incl_naming
      exceptions
        no_objecttype  = 1
        internal_error = 2
        others         = 3.

    if sy-subrc = 0.
      lo_class_incl_naming ?= lo_clif_incl_naming.
      l_t_method_w_include =
        lo_class_incl_naming->get_all_method_includes( ).
      loop at l_t_method_w_include assigning <s_method_w_include>.
        clear: length, last.
        length = strlen( <s_method_w_include>-cpdkey ) - 9.
        last = <s_method_w_include>-cpdkey+length.
        if last = 'PROCEDURE'.
          clear lt_abap.
          read report <s_method_w_include>-incname into lt_abap.
          loop at lt_abap into ls_abap.
            ls_g_script-tranid   = ls_script-tranid.
            ls_g_script-procnm   = ls_script-procnm.
            ls_g_script-codeid   = ls_script-procnm+3.
            ls_g_script-script   = ls_abap.
            ls_g_script-line_no  = sy-tabix.
            append ls_g_script to lt_g_script.
          endloop.
        endif.
      endloop.
    endif.
  endloop.

  "AMDP
  loop at lt_sscript into ls_sscript.

    concatenate '/BIC/' ls_sscript-codeid into l_clskey.

    call method cl_oo_include_naming=>get_instance_by_cifkey
      exporting
        cifkey         = l_clskey
      receiving
        cifref         = lo_clif_incl_naming
      exceptions
        no_objecttype  = 1
        internal_error = 2
        others         = 3.

    if sy-subrc = 0.
      lo_class_incl_naming ?= lo_clif_incl_naming.
      l_t_method_w_include =
        lo_class_incl_naming->get_all_method_includes( ).
      loop at l_t_method_w_include assigning <s_method_w_include>.
        clear: length, last.
        length = strlen( <s_method_w_include>-cpdkey ) - 9.
        last = <s_method_w_include>-cpdkey+length.
        if last = 'PROCEDURE'.
          clear lt_abap.
          read report <s_method_w_include>-incname into lt_abap.
          loop at lt_abap into ls_abap.
            ls_g_sscript-tranid   = ls_sscript-tranid.
            ls_g_sscript-codeid   = ls_sscript-codeid.
            ls_g_sscript-script   = ls_abap.
            ls_g_sscript-line_no  = sy-tabix.
            append ls_g_sscript to lt_g_sscript.
          endloop.
        endif.
      endloop.
    endif.
  endloop.

  "BW4HANA
  loop at lt_rstransteprout into ls_rstransteprout.
    clear lt_abap.
    split ls_rstransteprout-code at cl_abap_char_utilities=>newline into table lt_abap.
    loop at lt_abap into ls_abap.
      ls_g_rstransteprout-tranid   = ls_rstransteprout-tranid.
      ls_g_rstransteprout-codeid   = ls_rstransteprout-codeid.
      ls_g_rstransteprout-code     = ls_abap.
      ls_g_rstransteprout-line_no  = sy-tabix.
      append ls_g_rstransteprout to lt_g_rstransteprout.
    endloop.
  endloop.

  "Search code in new tables:
  "RSTRANSCRIPT
  loop at lt_g_script into ls_g_script.
    l_tabix = sy-tabix.
    clear ls_match_result.
    if i_case = ' ' and i_regex = 'X'.
      find first occurrence of regex ls_complstring
      in ls_g_script-script
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = 'X'.
      find first occurrence of regex ls_complstring
      in ls_g_script-script
        in character mode
        respecting case
        results ls_match_result.
    elseif i_case = ' ' and i_regex = ''.
      find first occurrence of ls_complstring
      in ls_g_script-script
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = ''.
      find first occurrence of ls_complstring
      in ls_g_script-script
        in character mode
        respecting case
        results ls_match_result.
    endif.
    if sy-subrc <> 0.
      delete lt_g_script index l_tabix.
    endif.
  endloop.

  "RSTRANSTEPSCRIPT
  loop at lt_g_sscript into ls_g_sscript.
    l_tabix = sy-tabix.
    clear ls_match_result.
    if i_case = ' ' and i_regex = 'X'.
      find first occurrence of regex ls_complstring
      in ls_g_sscript-script
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = 'X'.
      find first occurrence of regex ls_complstring
      in ls_g_sscript-script
        in character mode
        respecting case
        results ls_match_result.
    elseif i_case = ' ' and i_regex = ''.
      find first occurrence of ls_complstring
      in ls_g_sscript-script
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = ''.
      find first occurrence of ls_complstring
      in ls_g_sscript-script
        in character mode
        respecting case
        results ls_match_result.
    endif.
    if sy-subrc <> 0.
      delete lt_g_sscript index l_tabix.
    endif.
  endloop.
  "End Change ADü_20180618 - DP-1210

  "RSTRANSTEPROUT
  sort lt_g_rstransteprout by codeid.
  loop at lt_g_rstransteprout into ls_g_rstransteprout.
    l_tabix = sy-tabix.
    clear ls_match_result.
    if i_case = ' ' and i_regex = 'X'.
      find first occurrence of regex ls_complstring
      in ls_g_rstransteprout-code
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = 'X'.
      find first occurrence of regex ls_complstring
      in ls_g_rstransteprout-code
        in character mode
        respecting case
        results ls_match_result.
    elseif i_case = ' ' and i_regex = ''.
      find first occurrence of ls_complstring
      in ls_g_rstransteprout-code
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = ''.
      find first occurrence of ls_complstring
      in ls_g_rstransteprout-code
        in character mode
        respecting case
        results ls_match_result.
    endif.
    if sy-subrc <> 0.
      delete lt_g_rstransteprout  index l_tabix.
    endif.
  endloop.


  if gt_rsaabap is initial.
    "Start Change ADü_20180618 - DP-1210
    if lt_g_script is initial and lt_g_sscript is initial.
      "End Change ADü_20180618 - DP-1210
      if lt_g_rstransteprout is initial.
        return.
      endif.
      "Start Change ADü_20180618 - DP-1210
    endif.
    "End Change ADü_20180618 - DP-1210
  endif.

  "----------------------------------------------------------------
  " Scan routines of Update Rules (3.x)
  "----------------------------------------------------------------
  if i_updru = 'X'.

    types:
      begin of s_rsupd,
        updid    like rsupdinfo-updid,
        infocube like rsupdinfo-infocube,
        isource  like rsupdinfo-isource,
        codeid   like rsupdrout-codeid,
        routine  like rsupdrout-routine,
        iciobjnm like rsupdrout-iciobjnm,
      end of s_rsupd,
      t_rsupd type standard table of s_rsupd.

    data: lt_rsupd type t_rsupd.

    field-symbols <s_rsupd> type s_rsupd.

    clear lt_rsaabap.
    loop at gt_rsaabap into ls_rsaabap where codetp = 'UR'.
      append ls_rsaabap to lt_rsaabap.
    endloop.
    if not lt_rsaabap is initial.

      clear lt_lookup_temp.
      select a~updid infocube isource codeid routine iciobjnm
        into table lt_rsupd
        from rsupdinfo as a
        inner join rsupdrout as b on a~updid = b~updid
        for all entries in lt_rsaabap
          where
            b~codeid  = lt_rsaabap-codeid and
            a~objvers = 'A'               and
            b~objvers = 'A'.

      loop at lt_rsupd assigning <s_rsupd>.
        ls_lookup_temp-targetname = <s_rsupd>-infocube.
        ls_lookup_temp-sourcename = <s_rsupd>-isource.
        ls_lookup_temp-codeid = <s_rsupd>-codeid.
        if <s_rsupd>-routine = '9998'.
          ls_lookup_temp-routinetype = 'RT07'.
        elseif <s_rsupd>-routine = '9999'.
          ls_lookup_temp-routinetype = 'RT09'.
        else.
          ls_lookup_temp-routinetype = 'RT08'.
        endif.
        ls_lookup_temp-routine = <s_rsupd>-routine.
        ls_lookup_temp-tranid = <s_rsupd>-updid.
        ls_lookup_temp-iobjnm = <s_rsupd>-iciobjnm.
        append ls_lookup_temp to lt_lookup_temp.
      endloop.

      sort lt_lookup_temp by codeid.
      loop at lt_rsaabap into ls_rsaabap.

        clear ls_lookup.
        read table lt_lookup_temp into ls_lookup
        with key codeid = ls_rsaabap-codeid binary search.
        if sy-subrc = 0.
          clear l_updtype.
          select single updtype into l_updtype from rsupddat
            where
              updid   = ls_lookup-tranid and
              objvers = 'A'              and
              routine = ls_lookup-routine.              "#EC CI_NOORDER

          "no update
          if l_updtype = 'NOP'.
            delete lt_rsaabap.
          else.
            clear ls_result.
            move-corresponding ls_lookup  to ls_result.
            move-corresponding ls_rsaabap to ls_result.
            "Derive description of the Update Rule
            concatenate ls_lookup-targetname ls_lookup-sourcename
                        into ls_result-txtlg separated by space.
            append ls_result to gt_result.
          endif.
        endif.

      endloop.

    endif.
  endif.

  "----------------------------------------------------------------
  " Scan routines of Transfer Rules (3.x)
  "----------------------------------------------------------------
  if i_tranr = 'X'.

    clear lt_rsaabap.
    loop at gt_rsaabap into ls_rsaabap where codetp = 'TR'.
      append ls_rsaabap to lt_rsaabap.
    endloop.
    if not lt_rsaabap is initial.

      clear lt_lookup_temp.

      sort lt_lookup_temp by codeid.
      loop at lt_rsaabap into ls_rsaabap.
        clear ls_lookup.
        read table lt_lookup_temp into ls_lookup
        with key codeid = ls_rsaabap-codeid binary search.
        if sy-subrc = 0.
          clear ls_result.
          if ls_lookup-iobjnm is not initial.
            ls_lookup-routinetype = 'RT11'.
          endif.
          move-corresponding ls_lookup  to ls_result.
          move-corresponding ls_rsaabap to ls_result.

          append ls_result to gt_result.
        endif.
      endloop.

    endif.
  endif.

  "----------------------------------------------------------------
  " Scan routines of Transformations (7.x)
  "----------------------------------------------------------------
  if i_trans = 'X'.

    clear lt_rsaabap.
    loop at gt_rsaabap into ls_rsaabap where codetp = 'TF'.
      append ls_rsaabap to lt_rsaabap.
    endloop.
    if not lt_rsaabap is initial.

      "------- Transformations (rules)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype codeid a~tranid fieldnm
        into table lt_lookup_temp
        from rstran as a
        inner join rstranroutmap as b on a~tranid = b~tranid
        for all entries in lt_rsaabap
        where
          expert    = ''                and
          b~codeid  = lt_rsaabap-codeid and
          a~objvers = 'A'               and
          b~objvers = 'A'               and
          param_id  = 1                 and
          paramtype = 1.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT04'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations (start routine)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype startroutine tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_rsaabap
        where
          startroutine = lt_rsaabap-codeid and
          objvers      = 'A'.                               "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT01'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations (end routine)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
        sourcesubtype endroutine tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_rsaabap
        where
          endroutine = lt_rsaabap-codeid and
          objvers    = 'A'.                                 "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT02'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations (expert routine)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype expert tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_rsaabap
        where
          expert  = lt_rsaabap-codeid and
          objvers = 'A'.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT03'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations (Global declaration part 1)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype glbcode tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_rsaabap
        where
          glbcode = lt_rsaabap-codeid and
          objvers = 'A'.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT05'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations (Global declaration part 2)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype glbcode2 tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_rsaabap
        where
          glbcode2 = lt_rsaabap-codeid and
          objvers  = 'A'.                                   "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT06'.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "-------
      sort lt_lookup_finder by codeid.
      loop at lt_rsaabap into ls_rsaabap.
        clear ls_lookup.
        read table lt_lookup_finder into ls_lookup
         with key codeid = ls_rsaabap-codeid binary search.
        if sy-subrc = 0.
          clear ls_result.
          if ls_lookup-sourcetype = 'RSDS'.
            condense ls_lookup-sourcename.
          endif.
          move-corresponding ls_lookup  to ls_result.
          move-corresponding ls_rsaabap to ls_result.
          "Get description of Transformation
          clear lv_txtlg.
*************New ALU_20250630
          PERFORM get_txtlg USING ls_lookup-tranid CHANGING lv_txtlg.
*************End ALU_20250630
          if sy-subrc <> 0.
            "If no text found derive description of the Transformation
            concatenate ls_lookup-sourcetype ls_lookup-sourcename '->'
                        ls_lookup-targettype ls_lookup-targetname
                         into lv_txtlg separated by space.
          endif.
          ls_result-txtlg = lv_txtlg.

          append ls_result to gt_result.
        endif.
      endloop.
    endif.

    "Start Change ADü_20180618 - DP-1210
    "handle AMDP Scripts
    "RT20 -> HANA Script (Expert Routine)
    "RT21 -> AMDP Start Routine
    "RT22 -> AMDP End Routine
    "RT23 -> AMDP Expert Routine
    "RT24 -> AMDP InfoObject Routine

    "HANA Script
    if lt_g_script is not initial.
      clear lt_lookup_finder.
      "------- Transformations - HANA Script (Expert Routine)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype tranid
        into corresponding fields of table lt_lookup_temp
        from rstran
        for all entries in lt_g_script
        where tranid  = lt_g_script-tranid
        and   objvers = 'A'.                                "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT20'.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "-------
      sort lt_lookup_finder by codeid.
      loop at lt_g_script into ls_g_script.
        clear ls_lookup.
        read table lt_lookup_finder into ls_lookup
         with key tranid = ls_g_script-tranid binary search.
        if sy-subrc = 0.
          clear ls_result.
          if ls_lookup-sourcetype = 'RSDS'.
            condense ls_lookup-sourcename.
          endif.
          move-corresponding ls_lookup  to ls_result.
          move-corresponding ls_g_script to ls_result.
          ls_result-line = ls_g_script-script.
          "Get description of Transformation
          clear lv_txtlg.
*************New ALU_20250630
          PERFORM get_txtlg USING ls_lookup-tranid CHANGING lv_txtlg.
*************End ALU_20250630
          if sy-subrc <> 0.
            "If no text found derive description of the Transformation
            concatenate ls_lookup-sourcetype ls_lookup-sourcename '->'
                        ls_lookup-targettype ls_lookup-targetname
                         into lv_txtlg separated by space.
          endif.
          ls_result-txtlg = lv_txtlg.
          ls_result-codetp = 'TF'.

          append ls_result to gt_result.
        endif.
      endloop.

    endif.

    "AMDP
    if lt_g_sscript is not initial.
      clear lt_lookup_finder.
      "------- Transformations - AMDP Start Routine
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype startroutine tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_g_sscript
        where
          startroutine = lt_g_sscript-codeid and
          objvers      = 'A'.                               "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT21'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations - AMDP End Routine
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
        sourcesubtype endroutine tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_g_sscript
        where
          endroutine = lt_g_sscript-codeid and
          objvers    = 'A'.                                 "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT22'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations - AMDP Expert Routine
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype expert tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_g_sscript
        where
          expert  = lt_g_sscript-codeid and
          objvers = 'A'.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT23'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations - AMDP InfoObject Routine
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype codeid a~tranid fieldnm
        into table lt_lookup_temp
        from rstran as a
        inner join rstranroutmap as b on a~tranid = b~tranid
        for all entries in lt_g_sscript
        where
          expert    = ''                  and
          b~codeid  = lt_g_sscript-codeid and
          a~objvers = 'A'                 and
          b~objvers = 'A'                 and
          param_id  = 1                   and
          paramtype = 1.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT24'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "-------
      sort lt_lookup_finder by codeid.
      loop at lt_g_sscript into ls_g_sscript.
        clear ls_lookup.
        read table lt_lookup_finder into ls_lookup
         with key codeid = ls_g_sscript-codeid binary search.
        if sy-subrc = 0.
          clear ls_result.
          if ls_lookup-sourcetype = 'RSDS'.
            condense ls_lookup-sourcename.
          endif.
          move-corresponding ls_lookup  to ls_result.
          move-corresponding ls_g_sscript to ls_result.
          ls_result-line = ls_g_sscript-script.
          "Get description of Transformation
          clear lv_txtlg.
*************New ALU_20250630
          PERFORM get_txtlg USING ls_lookup-tranid CHANGING lv_txtlg.
*************End ALU_20250630
          if sy-subrc <> 0.
            "If no text found derive description of the Transformation
            concatenate ls_lookup-sourcetype ls_lookup-sourcename '->'
                        ls_lookup-targettype ls_lookup-targetname
                         into lv_txtlg separated by space.
          endif.
          ls_result-txtlg = lv_txtlg.
          ls_result-codetp = 'TF'.

          append ls_result to gt_result.
        endif.
      endloop.
    endif.
    "End Change ADü_20180618 - DP-1210

    "BW4/HANA
    if lt_g_rstransteprout is not initial.
      clear lt_lookup_finder.
      clear lt_lookup_temp.
      "------- Transformations - Start Routine
      select ('targetname targettype targetsubtype sourcename sourcetype sourcesubtype startroutine tranid set_runtime')
         into table lt_lookup_temp from rstran
        for all entries in lt_g_rstransteprout
        where
          startroutine = lt_g_rstransteprout-codeid and
          objvers      = 'A'.                               "#EC *

      loop at lt_lookup_temp into ls_lookup.
        if ls_lookup-set_runtime = 'O'.
          ls_lookup-routinetype = 'RT34'.
        else.
          ls_lookup-routinetype = 'RT30'.
        endif.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "------- Transformations - End Routine
      clear lt_lookup_temp.
      select ('targetname targettype targetsubtype sourcename sourcetype sourcesubtype endroutine tranid set_runtime')
         into table lt_lookup_temp from rstran
        for all entries in lt_g_rstransteprout
        where
          endroutine = lt_g_rstransteprout-codeid and
          objvers    = 'A'.                                 "#EC *

      loop at lt_lookup_temp into ls_lookup.
        if ls_lookup-set_runtime = 'O'.
          ls_lookup-routinetype = 'RT35'.
        else.
          ls_lookup-routinetype = 'RT31'.
        endif.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "------- Transformations - Expert Routine
      clear lt_lookup_temp.
      select ('targetname targettype targetsubtype sourcename sourcetype sourcesubtype expert tranid set_runtime')
         into table lt_lookup_temp from rstran
        for all entries in lt_g_rstransteprout
        where
          expert  = lt_g_rstransteprout-codeid and
          objvers = 'A'.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        if ls_lookup-set_runtime = 'O'.
          ls_lookup-routinetype = 'RT37'.
        else.
          ls_lookup-routinetype = 'RT33'.
        endif.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "------- Transformations - InfoObject Routine
      clear lt_lookup_temp.
      select ('targetname targettype targetsubtype sourcename sourcetype sourcesubtype codeid a~tranid a~set_runtime fieldnm')
        into table lt_lookup_temp
        from rstran as a
        inner join rstranroutmap as b on a~tranid = b~tranid
        for all entries in lt_g_rstransteprout
        where
          expert    = ''                  and
          b~codeid  = lt_g_rstransteprout-codeid and
          a~objvers = 'A'                 and
          b~objvers = 'A'                 and
          param_id  = 1                   and
          paramtype = 1.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        if ls_lookup-set_runtime = 'O'.
          ls_lookup-routinetype = 'RT36'.
        else.
          ls_lookup-routinetype = 'RT32'.
        endif.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "------- Transformations (Global declaration part 1)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype glbcode tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_g_rstransteprout
        where
          glbcode = lt_g_rstransteprout-codeid and
          objvers = 'A'.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT05'.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "------- Transformations (Global declaration part 2)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype glbcode2 tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_g_rstransteprout
        where
          glbcode2 = lt_g_rstransteprout-codeid and
          objvers  = 'A'.                                   "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT06'.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "-------
      sort lt_lookup_finder by codeid.
      loop at lt_g_rstransteprout into ls_g_rstransteprout.
        clear ls_lookup.
        read table lt_lookup_finder into ls_lookup
         with key codeid = ls_g_rstransteprout-codeid binary search.
        if sy-subrc = 0.
          clear ls_result.
          if ls_lookup-sourcetype = 'RSDS'.
            condense ls_lookup-sourcename.
          endif.
          move-corresponding ls_lookup  to ls_result.
          move-corresponding ls_g_rstransteprout to ls_result.
          ls_result-line = ls_g_rstransteprout-code.
          "Get description of Transformation
          clear lv_txtlg.
*************New ALU_20250630
          PERFORM get_txtlg USING ls_lookup-tranid CHANGING lv_txtlg.
*************End ALU_20250630
          if sy-subrc <> 0.
            "If no text found derive description of the Transformation
            concatenate ls_lookup-sourcetype ls_lookup-sourcename '->'
                        ls_lookup-targettype ls_lookup-targetname
                         into lv_txtlg separated by space.
          endif.
          ls_result-txtlg = lv_txtlg.
          ls_result-codetp = 'TF'.

          append ls_result to gt_result.
        endif.
      endloop.
    endif.

  endif.

  "----------------------------------------------------------------
  " Scan InfoObject (Char.) Transfer-Routines
  "----------------------------------------------------------------
  if i_iobjrout = 'X'.

    types:
      begin of s_chabas,
        chabasnm like rsdchabas-chabasnm,
        iobjrout like rsdchabas-iobjrout,
      end of s_chabas,
      t_chabas type standard table of s_chabas.

    data lt_chabas type t_chabas.
    field-symbols <s_chabas> type s_chabas.

    clear lt_rsaabap.
    loop at gt_rsaabap into ls_rsaabap where codetp = 'IC'.
      append ls_rsaabap to lt_rsaabap.
    endloop.
    if not lt_rsaabap is initial.

      clear: lt_lookup_temp, lt_chabas.
      select  chabasnm iobjrout
        into table lt_chabas
        from rsdchabas
        for all entries in lt_rsaabap
        where
          iobjrout = lt_rsaabap-codeid and
          objvers    = 'A'.                                 "#EC *

      loop at lt_chabas assigning <s_chabas>.
        clear ls_lookup.
        ls_lookup-iobjnm = <s_chabas>-chabasnm.
        ls_lookup-codeid = <s_chabas>-iobjrout.
        append ls_lookup to lt_lookup_temp.
      endloop.

      sort lt_lookup_temp by codeid.
      loop at lt_rsaabap into ls_rsaabap.
        clear ls_lookup.
        read table lt_lookup_temp into ls_lookup
         with key codeid = ls_rsaabap-codeid binary search.
        if sy-subrc = 0.
          clear ls_result.
          ls_lookup-routinetype = 'RT15'.
          move-corresponding ls_lookup  to ls_result.
          move-corresponding ls_rsaabap to ls_result.
          append ls_result to gt_result.
        endif.
      endloop.

    endif.
  endif.

endform.                    "scan_rsaabap



*&--------------------------------------------------------------------*
*&      Form  scan_dtp
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form scan_dtp
  tables lt_string t_devcl_range
    using i_skip_comment i_case i_regex.

  data:
    l_t_dtp_range     type t_devcl_range,
    l_s_dtp_range     type s_devcl_range,
    lt_obj            type standard table of tadir-obj_name,
    ls_match_result   type match_result,
    l_dtpnm           type rsbkdtpnm,
    ls_rsbkdtpt       like rsbkdtpt,
    lt_rsbkdtpt       like table of rsbkdtpt,
    lr_cl_rsbk_dtp    type ref to cl_rsbk_dtp,
    lr_cl_rsbc_filter type ref to cl_rsbc_filter,
    ls_dtprule        type mch_s_sourcecode,
    lt_dtprule        type mch_t_sourcecode,
    ls_result         type s_result.

  field-symbols:
    <string>  type s_string,
    <s_range> type rsrange,
    <s_obj>   like line of lt_obj.
  "------------------------------------------------------------------

  select obj_name into table lt_obj from tadir
    where
      pgmid    = 'R3TR'           and
      object   = 'DTPA'.                                    "#EC *

  select * into table lt_rsbkdtpt from rsbkdtpt
    where
      langu   = sy-langu and
      objvers = 'A'.

  sort lt_rsbkdtpt by dtp.

  loop at lt_obj assigning <s_obj>.

    clear:
      lr_cl_rsbk_dtp,
      lr_cl_rsbc_filter.

    "===== Get Filter-Routines =====
    l_dtpnm = <s_obj>.
    lr_cl_rsbk_dtp    = cl_rsbk_dtp=>factory( l_dtpnm ).
    try.
        lr_cl_rsbc_filter = lr_cl_rsbk_dtp->get_obj_ref_filter( ).
      catch cx_rs_access_error.
        continue.
    endtry.

    loop at lr_cl_rsbc_filter->n_t_dtprule into ls_dtprule.

      loop at lt_string assigning <string>.
        clear ls_match_result.
        if i_case = ' ' and i_regex = ' '.
          find first occurrence of <string> in ls_dtprule-line
            in character mode
            ignoring case
            results ls_match_result.
        elseif i_case = 'X' and i_regex = ' '.
          find first occurrence of <string> in ls_dtprule-line
            in character mode
            respecting case
            results ls_match_result.
        elseif i_case = ' ' and i_regex = 'X'.
          find first occurrence of regex <string> in ls_dtprule-line
            in character mode
            ignoring case
            results ls_match_result.
        elseif i_case = 'X' and i_regex = 'X'.
          find first occurrence of regex <string> in ls_dtprule-line
            in character mode
            respecting case
            results ls_match_result.
        endif.
        if ls_match_result-offset <> 0.
          clear ls_result.
          ls_result-codetp      = 'DTP'.
          ls_result-targetname  = <s_obj>.
          ls_result-routinetype = 'RT13'.
          ls_result-iobjnm      = ls_dtprule-field.
          ls_result-line_no     = ls_dtprule-line_no.
          ls_result-line        = ls_dtprule-line.
          "Get description
          read table lt_rsbkdtpt into ls_rsbkdtpt
           with key dtp = <s_obj> binary search.
          if sy-subrc = 0.
            ls_result-txtlg = ls_rsbkdtpt-txtlg.
          endif.
          append ls_result to gt_result.
        endif.
      endloop.

    endloop.

  endloop.

endform.                    "scan_dtp



*&--------------------------------------------------------------------*
*&      Form  scan_ip
*&--------------------------------------------------------------------*
form scan_ip
    tables lt_string t_devcl_range
    using i_skip_comment i_case i_regex.
  data:
    l_t_devcl_range type t_devcl_range,
    l_s_devcl_range type s_devcl_range,
    lt_obj          type standard table of tadir-obj_name,
    ls_rsldprule    like rsldprule,
    lt_rsldprule    like table of ls_rsldprule,
    ls_match_result type match_result,
    ls_rsldpiot     like rsldpiot,
    lt_rsldpiot     like table of rsldpiot,
    ls_result       type s_result.

  field-symbols:
    <string>  type s_string,
    <s_range> type rsrange,
    <s_obj>   like line of lt_obj.


  loop at t_devcl_range assigning <s_range>.
    l_s_devcl_range-sign   = <s_range>-sign.
    l_s_devcl_range-option = <s_range>-option.
    l_s_devcl_range-low    = <s_range>-low.
    l_s_devcl_range-high   = <s_range>-high.
    append l_s_devcl_range to l_t_devcl_range.
  endloop.

  "------------------------------------------------------------------

  select obj_name into table lt_obj from tadir
    where
      pgmid    = 'R3TR'           and
      object   = 'ISIP'.                                    "#EC *

  select * into table lt_rsldpiot from rsldpiot
    where
      langu = sy-langu and
      objvers = 'A'.

  sort lt_rsldpiot by logdpid.

  loop at lt_obj assigning <s_obj>.

    clear lt_rsldprule.
    select
        r~logdpid
        r~objvers
        r~fieldname
        r~lnr
        r~iobjnm
        line
      into table lt_rsldprule
      from rsldpsel as s inner join rsldprule as r
      on s~logdpid = r~logdpid and
         s~objvers = r~objvers and
         s~fieldname = r~fieldname
      where
        s~logdpid = <s_obj> and
        s~objvers = 'A'.

    loop at lt_rsldprule into ls_rsldprule.

      loop at lt_string assigning <string>.

        clear ls_match_result.
        if i_case = ' ' and i_regex = ' '.
          find first occurrence of <string> in ls_rsldprule-line
            in character mode
            ignoring case
            results ls_match_result.
        elseif i_case = 'X' and i_regex = ' '.
          find first occurrence of <string> in ls_rsldprule-line
            in character mode
            respecting case
            results ls_match_result.
        elseif i_case = ' ' and i_regex = 'X'.
          find first occurrence of regex <string> in ls_rsldprule-line
            in character mode
            ignoring case
            results ls_match_result.
        elseif i_case = 'X' and i_regex = 'X'.
          find first occurrence of regex <string> in ls_rsldprule-line
            in character mode
            respecting case
            results ls_match_result.
        endif.

        if ls_match_result-offset <> 0.
          clear ls_result.
          ls_result-codetp      = 'IP'.
          ls_result-targetname  = <s_obj>.
          ls_result-routinetype = 'RT14'.
          ls_result-txtlg       = ls_rsldprule-fieldname.
          ls_result-iobjnm      = ls_rsldprule-iobjnm.
          ls_result-line_no     = sy-tabix.
          ls_result-line        = ls_rsldprule-line.
          read table lt_rsldpiot into ls_rsldpiot
          with key logdpid = ls_rsldprule-logdpid binary search.
          if sy-subrc = 0.
            ls_result-txtlg = ls_rsldpiot-text.
          endif.
          append ls_result to gt_result.
        endif.

      endloop.

    endloop.

  endloop.
endform.                    "scan_ip


*&--------------------------------------------------------------------*
*&      Form  Get_REPS
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form get_reps
  tables t_devcl_range t_reps_range t_subc_range.

  data:
    l_t_devcl_range type t_devcl_range,
    l_s_devcl_range type s_devcl_range,
    l_t_name_range  type t_name_range,
    l_s_name_range  type s_name_range,
    l_t_subc_range  type t_subc_range,
    l_s_subc_range  type s_subc_range.

  field-symbols:
    <s_range>       type rsrange.

  "------------------------------------------------------------------
  " Range Importparam. in Selektionstab. mit passendem Typ übertragen
  "------------------------------------------------------------------
  loop at t_devcl_range assigning <s_range>.
    l_s_devcl_range-sign   = <s_range>-sign.
    l_s_devcl_range-option = <s_range>-option.
    l_s_devcl_range-low    = <s_range>-low.
    l_s_devcl_range-high   = <s_range>-high.
    append l_s_devcl_range to l_t_devcl_range.
  endloop.

  loop at t_reps_range assigning <s_range>.
    l_s_name_range-sign   = <s_range>-sign.
    l_s_name_range-option = <s_range>-option.
    l_s_name_range-low    = <s_range>-low.
    l_s_name_range-high   = <s_range>-high.
    append l_s_name_range to l_t_name_range.
  endloop.

  loop at t_subc_range assigning <s_range>.
    l_s_subc_range-sign   = <s_range>-sign.
    l_s_subc_range-option = <s_range>-option.
    l_s_subc_range-low    = <s_range>-low.
    l_s_subc_range-high   = <s_range>-high.
    append l_s_subc_range to l_t_subc_range.
  endloop.
  "------------------------------------------------------------------

  select object obj_name into table gt_object from tadir
     as a inner join trdir as r on a~obj_name = r~name
      where
       pgmid    = 'R3TR'   and
       object   = 'PROG'   and
       obj_name in l_t_name_range  and
       devclass in l_t_devcl_range and
       subc     in l_t_subc_range.                          "#EC *


endform.                    "Get_REPS


*&--------------------------------------------------------------------*
*&      Form  get_FUNC
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
*      -->I_T_DEVCL_RANGE  text
*      -->I_T_FUGR_RANGE   text
*---------------------------------------------------------------------*
form get_func
  tables t_devcl_range t_fugr_range.

  data:
    l_t_devcl_range type t_devcl_range,
    l_s_devcl_range type s_devcl_range,
    l_t_fugr_range  type t_fugr_range,
    l_s_fugr_range  type s_fugr_range,
    lt_obj          type standard table of s_object,
    l_fgroup        type rs38l-area,
    l_program       type progname.

  field-symbols:
    <s_range> type rsrange,
    <s_obj>   like line of lt_obj.

  "------------------------------------------------------------------
  " Range Importparam. in Selektionstab. mit passendem Typ übertragen
  "------------------------------------------------------------------
  loop at t_devcl_range assigning <s_range>.
    l_s_devcl_range-sign   = <s_range>-sign.
    l_s_devcl_range-option = <s_range>-option.
    l_s_devcl_range-low    = <s_range>-low.
    l_s_devcl_range-high   = <s_range>-high.
    append l_s_devcl_range to l_t_devcl_range.
  endloop.

  loop at t_fugr_range assigning <s_range>.
    l_s_fugr_range-sign   = <s_range>-sign.
    l_s_fugr_range-option = <s_range>-option.
    l_s_fugr_range-low    = <s_range>-low.
    l_s_fugr_range-high   = <s_range>-high.
    append l_s_fugr_range to l_t_fugr_range.
  endloop.
  "------------------------------------------------------------------

  select object obj_name into table lt_obj from tadir
    where
      pgmid    = 'R3TR'           and
      object   = 'FUGR'           and
      obj_name in l_t_fugr_range  and
      devclass in l_t_devcl_range.                          "#EC *

  loop at lt_obj assigning <s_obj>.
    l_fgroup = <s_obj>-obj_name.
    clear l_program.

    call function 'FUNCTION_INCLUDE_CONCATENATE'
      changing
        program                  = l_program
        complete_area            = l_fgroup
      exceptions
        not_enough_input         = 1
        no_function_pool         = 2
        delimiter_wrong_position = 3
        others                   = 4.

    check sy-subrc is initial and l_program is not initial.
    <s_obj>-object = 'FUGR'.
    <s_obj>-incl_name = l_program.
    append <s_obj> to gt_object.
  endloop.

endform.                    "get_FUNC



*&--------------------------------------------------------------------*
*&      Form  get_plse
*&--------------------------------------------------------------------*
*       Search in Planning Functions
*---------------------------------------------------------------------*
form get_plse
    tables lt_string t_devcl_range
    using i_skip_comment i_case i_regex.

  data:
    lt_obj          type standard table of tadir-obj_name,
    ls_rsplf_srv_p  type rsplf_srv_p,
    lt_rsplf_srv_p  type table of rsplf_srv_p,
    ls_match_result type match_result,
    ls_rsplf_srvt   type rsplf_srvt,
    lt_rsplf_srvt   type table of rsplf_srvt,
    ls_result       type s_result.

  field-symbols:
    <string>  type s_string,
    <s_range> type rsrange,
    <s_obj>   like line of lt_obj.
  "------------------------------------------------------------------

  select obj_name into table lt_obj from tadir
    where
      pgmid    = 'R3TR' and
      object   = 'PLSE'.                                    "#EC *

  select * into table lt_rsplf_srvt from rsplf_srvt
    where
      langu = sy-langu and
      objvers = 'A'.                                        "#EC *

  sort lt_rsplf_srvt by srvnm.

  loop at lt_obj assigning <s_obj>.

    clear lt_rsplf_srv_p.
    select * from rsplf_srv_p
      into table lt_rsplf_srv_p
      where
        srvnm = <s_obj> and
        objvers = 'A'   and
        parnm = 'FLINE'.                                    "#EC *


**new ADü_20170613
    data: lv_string   type          string,
          lt_splitted type table of string,
          ls_splitted type          string,
          lv_index    type          i value 0.

    clear: lv_string, lv_index.

    loop at lt_rsplf_srv_p into ls_rsplf_srv_p.
      concatenate lv_string ls_rsplf_srv_p-value into lv_string.
    endloop.

    split lv_string at cl_abap_char_utilities=>cr_lf into table lt_splitted.

    read table lt_rsplf_srv_p into ls_rsplf_srv_p index 1. "#EC CI_NOORDER

    loop at lt_splitted into ls_splitted.
      lv_index = lv_index + 1.

      "LOOP AT lt_rsplf_srv_p INTO ls_rsplf_srv_p.

**end new ADü_20170613

      loop at lt_string assigning <string>.

        clear ls_match_result.
        if i_case = ' ' and i_regex = ' '.
          find first occurrence of <string> in ls_splitted "ls_rsplf_srv_p-value
            in character mode
            ignoring case
            results ls_match_result.
        elseif i_case = 'X' and i_regex = ' '.
          find first occurrence of <string> in ls_splitted "ls_rsplf_srv_p-value
            in character mode
            respecting case
            results ls_match_result.
        elseif i_case = ' ' and i_regex = 'X'.
          find first occurrence of regex <string>
            in ls_splitted "ls_rsplf_srv_p-value
            in character mode
            ignoring case
            results ls_match_result.
        elseif i_case = 'X' and i_regex = 'X'.
          find first occurrence of regex <string>
            in ls_splitted "ls_rsplf_srv_p-value
            in character mode
            respecting case
            results ls_match_result.
        endif.

        if ls_match_result-offset <> 0.
          clear ls_result.
          ls_result-codetp      = 'PF'.
          ls_result-targetname  = <s_obj>.
          ls_result-routinetype = 'RT19'.
          ls_result-txtlg       = ''.
          ls_result-iobjnm      = ''.
          ls_result-line_no     = lv_index. "ls_rsplf_srv_p-indx.
          ls_result-line        = ls_splitted. "ls_rsplf_srv_p-value.
          read table lt_rsplf_srvt into ls_rsplf_srvt
          with key srvnm = ls_rsplf_srv_p-srvnm binary search.
          if sy-subrc = 0.
            ls_result-txtlg = ls_rsplf_srvt-txtlg.
          endif.
          append ls_result to gt_result.
        endif.

      endloop.

    endloop.

  endloop.

endform.                    "get_plse



*&--------------------------------------------------------------------*
*&      Form  get_clas
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form get_clas
  tables t_devcl_range t_clas_range.

  data:
    l_t_devcl_range type t_devcl_range,
    l_s_devcl_range type s_devcl_range,
    l_t_clas_range  type t_clas_range,
    l_s_clas_range  type s_clas_range,
    lt_obj          type standard table of s_object,
    l_clskey        type seoclskey,
    l_obj           type tadir-obj_name,
    lt_includes     type seop_methods_w_include.

  field-symbols:
    <s_range>   type rsrange,
    <s_obj>     like line of lt_obj,
    <s_include> like line of lt_includes.

  "------------------------------------------------------------------
  " Range Importparam. in Selektionstab. mit passendem Typ übertragen
  "------------------------------------------------------------------
  loop at t_devcl_range assigning <s_range>.
    l_s_devcl_range-sign   = <s_range>-sign.
    l_s_devcl_range-option = <s_range>-option.
    l_s_devcl_range-low    = <s_range>-low.
    l_s_devcl_range-high   = <s_range>-high.
    append l_s_devcl_range to l_t_devcl_range.
  endloop.

  loop at t_clas_range assigning <s_range>.
    l_s_clas_range-sign   = <s_range>-sign.
    l_s_clas_range-option = <s_range>-option.
    l_s_clas_range-low    = <s_range>-low.
    l_s_clas_range-high   = <s_range>-high.
    append l_s_clas_range to l_t_clas_range.
  endloop.
  "------------------------------------------------------------------

  select object obj_name into table lt_obj from tadir
    where
      pgmid    = 'R3TR'          and
      object   = 'CLAS'          and
      obj_name in l_t_clas_range and
      devclass in l_t_devcl_range.                          "#EC *

  loop at lt_obj assigning <s_obj>.
    l_clskey = <s_obj>-obj_name.
* ts 28.10.2014 - Start comment
*    CALL FUNCTION 'SEO_CLASS_GET_METHOD_INCLUDES'
*      EXPORTING
*        clskey                       = l_clskey
*      IMPORTING
*        includes                     = lt_includes
*      EXCEPTIONS
*        _internal_class_not_existing = 1
*        OTHERS                       = 2.
*
*    LOOP AT lt_includes ASSIGNING <s_include>.
*      <s_obj>-object = 'METH'.
*      <s_obj>-incl_name = <s_include>-incname.
*      <s_obj>-obj_name = l_clskey.
*      <s_obj>-meth_name = <s_include>-cpdkey+30.
*      APPEND <s_obj> TO gt_object.
*    ENDLOOP.
* ts 28.10.2014 - End comment

* ts 28.10.2014 - Start insert
    class cl_oo_include_naming definition load.
    data lo_clif_incl_naming  type ref to if_oo_clif_incl_naming.
    data lo_class_incl_naming type ref to if_oo_class_incl_naming.
    data l_t_method_w_include type seop_methods_w_include.
    field-symbols: <s_method_w_include> type seop_method_w_include.

    call method cl_oo_include_naming=>get_instance_by_cifkey
      exporting
        cifkey         = l_clskey
      receiving
        cifref         = lo_clif_incl_naming
      exceptions
        no_objecttype  = 1
        internal_error = 2
        others         = 3.

    if sy-subrc = 0.
      lo_class_incl_naming ?= lo_clif_incl_naming.
      l_t_method_w_include =
        lo_class_incl_naming->get_all_method_includes( ).
      loop at l_t_method_w_include assigning <s_method_w_include>.
        <s_obj>-object = 'METH'.
        <s_obj>-incl_name = <s_method_w_include>-incname.
        <s_obj>-obj_name  = l_clskey.
        <s_obj>-meth_name = <s_method_w_include>-cpdkey+30.
        append <s_obj> to gt_object.
      endloop.
      "ADü - Start insert 20170621
      "Public Section
      <s_obj>-object    = 'METH'.
      <s_obj>-incl_name = lo_class_incl_naming->public_section.
      <s_obj>-obj_name  = l_clskey.
      <s_obj>-meth_name = 'PUBLIC SECTION'.
      append <s_obj> to gt_object.
      "Private Section
      <s_obj>-object    = 'METH'.
      <s_obj>-incl_name = lo_class_incl_naming->private_section.
      <s_obj>-obj_name  = l_clskey.
      <s_obj>-meth_name = 'PRIVATE SECTION'.
      append <s_obj> to gt_object.
      "Protected Section
      <s_obj>-object    = 'METH'.
      <s_obj>-incl_name = lo_class_incl_naming->protected_section.
      <s_obj>-obj_name  = l_clskey.
      <s_obj>-meth_name = 'PROTECTED SECTION'.
      append <s_obj> to gt_object.
      "Local Implementations
      <s_obj>-object    = 'METH'.
      <s_obj>-incl_name = lo_class_incl_naming->locals_imp.
      <s_obj>-obj_name  = l_clskey.
      <s_obj>-meth_name = 'LOCAL IMPLEMENTATIONS'.
      append <s_obj> to gt_object.
      "ADü - End insert 20170621
    endif.
* ts 28.10.2014 - End insert

  endloop.

endform.                    "get_clas



*&--------------------------------------------------------------------*
*&      Form  scan_include_code
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form scan_include_code
  tables lt_string
    using i_skip_comment i_case i_regex.

  data:
    lt_object        type standard table of s_object,
    ls_object        type s_object, "TS, 20140509
    lt_include       type standard table of tadir-obj_name,
    lv_program       type sy-repid,
    lt_abap          type abaptxt255_tab,
    lt_match_results type match_result_tab,
    ls_match_result  like line of lt_match_results,
    ls_result        type s_result,
    lv_func          type rs38l-name,
    lv_func_incl     type rs38l-name.

  field-symbols:
    <string>  type s_string,
    <s_range> type rsrange,
    <obj>     type s_object,
    <include> type tadir-obj_name,
    <abap>    like line of lt_abap.


*--------------------------------------------------------------------
  "Get includes
  clear lt_object.
  "for reports and classes we already have the includes
  loop at gt_object assigning <obj> where object = 'FUGR'.
    clear lt_include.
    lv_program = <obj>-incl_name.

    call function 'RS_GET_ALL_INCLUDES'
      exporting
        program      = lv_program
      tables
        includetab   = lt_include
      exceptions
        not_existent = 1
        no_program   = 2
        others       = 3.

    check sy-subrc is initial.

    loop at lt_include assigning <include>.
      ls_object-object = 'FUNC'.
      ls_object-incl_name = <include>.
      append ls_object to gt_object.
    endloop.

  endloop.

  sort lt_object.
  delete adjacent duplicates from lt_object.
  append lines of lt_object to gt_object.

  "Source scan
  loop at gt_object assigning <obj>.

    if <obj>-object = 'PROG'.
      <obj>-incl_name = <obj>-obj_name.
    endif.
    read report <obj>-incl_name into lt_abap.
    if sy-subrc is not initial.
      continue.
    endif.

    loop at lt_string assigning <string>.

      clear lt_match_results.
      if i_case = '' and i_regex = ''.
        find all occurrences of <string> in table lt_abap
          in character mode
          ignoring case
          results lt_match_results.
      elseif i_case = 'X' and i_regex = ''.
        find all occurrences of <string> in table lt_abap
          in character mode
          respecting case
          results lt_match_results.
      elseif i_case = '' and i_regex = 'X'.
        find all occurrences of regex <string> in table lt_abap
          in character mode
          ignoring case
          results lt_match_results.
      elseif i_case = 'X' and i_regex = 'X'.
        find all occurrences of regex <string> in table lt_abap
          in character mode
          respecting case
          results lt_match_results.
      endif.

      loop at lt_match_results into ls_match_result.
        read table lt_abap
        index ls_match_result-line assigning <abap>.
        if sy-subrc = 0.
          clear ls_result.
          ls_result-codetp = <obj>-object(2).
          "if FUNC: Get name of FM
          if <obj>-object = 'FUNC' or <obj>-object = 'FUGR'.
            clear lv_func.

            call function 'FUNCTION_INCLUDE_INFO'
            "IMPORTING
            "FUNCTAB        =
            "NAMESPACE      =
            "PNAME          =
              changing
                funcname            = lv_func
                "GROUP          =
                include             = <obj>-incl_name
              exceptions
                function_not_exists = 1
                include_not_exists  = 2
                group_not_exists    = 3
                no_selections       = 4
                no_function_include = 5
                others              = 6.
            if sy-subrc = 0.
              <obj>-obj_name = lv_func.
            endif.

          endif.

          if <obj>-object = 'METH'.
            ls_result-txtlg = <obj>-meth_name.
          endif.
          ls_result-targetname = <obj>-obj_name.
          ls_result-sourcename = <obj>-incl_name.
          ls_result-line_no    = ls_match_result-line.
          ls_result-line       = <abap>.


          case ls_result-codetp.
            when 'PR'.
              ls_result-routinetype = 'RT16'.
            when 'ME'.
              ls_result-routinetype = 'RT17'.
            when 'FU'.
              ls_result-routinetype = 'RT18'.
          endcase.
          append ls_result to gt_result.
        endif.
      endloop.

    endloop.

  endloop.

endform.                    "scan_include_code

*&--------------------------------------------------------------------*
*&      Form  get transformation text
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM get_txtlg USING    p_tranid TYPE rstrant-tranid
                CHANGING p_txtlg  TYPE rstrant-txtlg.

  SELECT SINGLE txtlg INTO p_txtlg FROM rstrant
    WHERE langu = sy-langu
      AND tranid = p_tranid
      AND objvers = 'A'.

ENDFORM.

Z_RFC_GET_DTP_DETAILS v1_5

Source Code of Z_RFC_GET_DTP_DETAILS
ABAP
function z_rfc_get_dtp_details
  importing
    value(i_dtp) type rsbkdtpnm
  exporting
    value(e_maxsize) type rsbkmaxsize
    value(data_var) type mch_t_var_select
  tables
    data_sel like rsselect
    data_rule like mch_s_sourcecode
    data_group like rsbk_s_fields_keyfl
  exceptions
    release_1_5
    not_authorized
    not_get_filter_details.



*************End ADÜ_20250430




  data l_r_rsbk_dtp type ref to cl_rsbk_dtp.
  data l_r_rsbc_filter type ref to cl_rsbc_filter.
  data l_r_rsbc_error_handler_tpl
         type ref to cl_rsbc_error_handler_tpl.

  data: l_t_groupfields  type rsbk_tx_fields_keyfl,
        l_th_groupfields type hashed table of rsbk_sx_fields_keyfl
                          with unique key segid.
  data ls_group       type rsbk_s_fields_keyfl.
  data ls_seltab      type rsbk_s_select.
  data ls_ruletab     type mch_s_sourcecode.
  data ls_groupfields type rsbk_sx_fields_keyfl.
  data lv_sel         type rsselect.
  data lv_rule        type mch_s_sourcecode.
  data lv_group       type rsbk_s_fields_keyfl.
  data lv_maxsize     type rsbkmaxsize.

* ==== Get Filter details ====
  try.
*BEGIN New ADü_20250328
      authority-check object 'S_RS_DTP'
       id 'RSTLDTPSRC' field '*'
       id 'RSSTDTPSRC' field '*'
       id 'RSONDTPSRC' field '*'
       id 'RSTLDTPTGT' field '*'
       id 'RSSTDTPTGT' field '*'
       id 'RSONDTPTGT' field '*'
       id 'ACTVT' field '03'.
      if sy-subrc <> 0.
        raise not_authorized.
      else.
*END New ADü_20250328
        l_r_rsbk_dtp = cl_rsbk_dtp=>factory( i_dtp ).
        l_r_rsbc_filter =
         l_r_rsbk_dtp->if_rsbk_dtp_display~get_obj_ref_filter( ).
*BEGIN New ADü_20250328
      endif.
*END New ADü_20250328
    catch cx_rs_access_error.
*************New ADÜ_20250430
        RAISE not_get_filter_details.
*************End ADÜ_20250430
  endtry.

* ==== Get Semantic Groups details ====
  call method l_r_rsbk_dtp->if_rsbk_dtp_display~get_groupfields
    importing
      e_t_groupfields = l_t_groupfields.
  insert lines of l_t_groupfields into table l_th_groupfields.


* Fill result table for selections:
  loop at l_r_rsbc_filter->n_t_seltab into ls_seltab.

    move ls_seltab-field to lv_sel-fieldnm.
    move ls_seltab-sign to lv_sel-sign.
    move ls_seltab-option to lv_sel-option.
    move ls_seltab-low to lv_sel-low.
    move ls_seltab-high to lv_sel-high.
    append lv_sel to data_sel.

  endloop.

* Fill result table for ABAP-Routines in selections
  loop at l_r_rsbc_filter->n_t_dtprule into ls_ruletab.

    move-corresponding ls_ruletab to lv_rule.
    append lv_rule to data_rule.

  endloop.

* Fill result table for Variables in selections
  move-corresponding l_r_rsbc_filter->n_t_varseltab to data_var.

* Fill result table for Semantic Groups
  loop at l_th_groupfields into ls_groupfields.
    loop at ls_groupfields-t_fields into ls_group.

      move ls_group-fieldname to lv_group-fieldname.
      move ls_group-txtlg to lv_group-txtlg.
      append lv_group to data_group.

    endloop.
  endloop.

* Get Max. Package Size
  try.
      call method l_r_rsbk_dtp->get_maxsize
        receiving
          r_maxsize = lv_maxsize.
    catch cx_rs_not_authorized.
      message id sy-msgid type sy-msgty number sy-msgno
      with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endtry.

  e_maxsize = lv_maxsize.

endfunction.

Z_RFC_AUTH_CHECK v1_2

Source Code of Z_RFC_AUTH_CHECK
ABAP
FUNCTION z_rfc_auth_check
  IMPORTING
    VALUE(i_compid) TYPE xuval
    VALUE(i_provider) TYPE xuval
    VALUE(i_infoarea) TYPE xuval OPTIONAL
    VALUE(i_activity) TYPE xuval
    VALUE(i_owner) TYPE xuval
  TABLES
    t_user LIKE bapitgb
  EXCEPTIONS
    release_1_2.




  TYPES: BEGIN OF ty_user,
                bname TYPE xubname,
                name_text TYPE ad_namtext,
         END OF ty_user.

  FIELD-SYMBOLS <fs_user> TYPE ty_user.

  DATA: lt_user TYPE TABLE OF ty_user,
        chk_comp TYPE c LENGTH 1,
        chk_comp1 TYPE c LENGTH 1.

  REFRESH t_user.

  SELECT  bname name_text FROM user_addrp INTO TABLE lt_user."#EC CI_NOWHERE
  SORT lt_user.

  LOOP AT lt_user ASSIGNING <fs_user>.

    CLEAR: chk_comp, chk_comp1.

    CALL FUNCTION 'AUTHORITY_CHECK'
      EXPORTING
        user                = <fs_user>-bname
        object              = 'S_RS_COMP'
        field1              = 'RSZCOMPID'
        value1              = i_compid
        field2              = 'RSZCOMPTP'
        value2              = 'REP'
        field3              = 'RSINFOCUBE'
        value3              = i_provider
        field4              = 'ACTVT'
        value4              = i_activity
        field5              = 'RSINFOAREA'
        value5              = i_infoarea
      EXCEPTIONS
        user_dont_exist     = 1
        user_is_authorized  = 2
        user_not_authorized = 3
        user_is_locked      = 4
        OTHERS              = 5.
    IF sy-subrc = 2.
      chk_comp = 'X'.
    ENDIF.

    CALL FUNCTION 'AUTHORITY_CHECK'
      EXPORTING
        user                = <fs_user>-bname
        object              = 'S_RS_COMP1'
        field1              = 'RSZCOMPID'
        value1              = i_compid
        field2              = 'RSZCOMPTP'
        value2              = 'REP'
        field3              = 'RSZOWNER'
        value3              = i_owner
        field4              = 'ACTVT'
        value4              = i_activity
        field5              = ''
        value5              = ''
      EXCEPTIONS
        user_dont_exist     = 1
        user_is_authorized  = 2
        user_not_authorized = 3
        user_is_locked      = 4
        OTHERS              = 5.

    IF sy-subrc = 2.
      chk_comp1 = 'X'.
    ENDIF.

    IF chk_comp = 'X' AND chk_comp1 = 'X'.
      APPEND <fs_user> TO t_user.
    ENDIF.

  ENDLOOP.


ENDFUNCTION.

Z_RFC_USAGE_ANALYSIS v2_1

Source Code of Z_RFC_USAGE_ANALYSIS
ABAP
FUNCTION z_rfc_usage_analysis
  IMPORTING
    VALUE(i_version) TYPE rsobjvers DEFAULT 'A'
    VALUE(i_iobjnm) TYPE rsiobjnm OPTIONAL
    VALUE(i_attrinm) TYPE rsattrinm OPTIONAL
    VALUE(i_value) TYPE rschavl OPTIONAL
    VALUE(i_compid) TYPE rszcompid OPTIONAL
    VALUE(i_uid) TYPE sysuuid_25 OPTIONAL
    VALUE(i_extended) TYPE sonv-flag OPTIONAL
    VALUE(i_level_max) TYPE int4 DEFAULT 99
  TABLES
    t_chavl LIKE rsa_s_chavl
    t_data LIKE v_compdir_compic
    t_data2 LIKE tab512
    t_data_range LIKE tab512
  EXCEPTIONS
    release_2_1.





* A] Elemente in Query-Selektionen  -> RSZRANGE
* B] Berechnete Kennzahlen -> RSZCALC
*--------------------------------------------------------------------

  TYPES:
    BEGIN OF ty_uid_deftp,
      compuid TYPE sysuuid_25,
      deftp   TYPE rszdeftp,
    END OF ty_uid_deftp.

  DATA:
    l_subrc        TYPE rs_bool,
    l_iobjnm       TYPE rsiobjnm,
    l_uid          TYPE sysuuid_25,
    l_iobjtp       TYPE rsiobjtp,
    l_s_uid_deftp  TYPE ty_uid_deftp,
    l_t_data       TYPE ty_t_data_scan,
    l_t_data_range TYPE ty_t_data_range,
    l_s_data       TYPE v_compdir_compic,"Struktur für Export Parameter
    l_s_data2      TYPE char512,         "Struktur für Export Parameter
    l_s_data_range TYPE char512.         "Struktur für Export Parameter

  FIELD-SYMBOLS:
    <s_data>       TYPE ty_s_data_scan,
    <s_data_range> TYPE ty_s_data_range,
    <fs_chavl>     TYPE rsa_s_chavl.

  LOOP AT t_chavl ASSIGNING <fs_chavl>.
    ls_chavl-sign   = 'I'.
    ls_chavl-option = 'EQ'.
    ls_chavl-low    = <fs_chavl>-chavl.
    APPEND ls_chavl TO gt_chavl.
  ENDLOOP.

  "Globalen Parameter setzen
  p_level_max = i_level_max.

  "Wiederverwendbare Elemente puffern
  SELECT * FROM rszcompdir INTO TABLE g_t_rszcompdir  "#EC CI_NOFIRST
     WHERE objvers = 'A'.

  IF i_iobjnm IS NOT INITIAL.
    "------------------------------------------------------------------
    " Where-used analysis for InfoObjects
    "------------------------------------------------------------------

    "Check if a display attribute is entered:
    IF i_attrinm IS NOT INITIAL.
      PERFORM scan_attr_dis USING i_iobjnm i_attrinm i_version
                            CHANGING l_t_data.
    ELSE.
      SELECT SINGLE iobjtp FROM rsdiobj INTO l_iobjtp "#EC CI_NOORDER
         WHERE iobjnm = i_iobjnm."#EC CI_GENBUFF
*************New ADÜ_20250430
      IF sy-subrc <> 0.
        "handled later in the Performer Suite
      ENDIF.
*************End ADÜ_20250430
      IF l_iobjtp = 'KYF'.
        PERFORM scan_kyfnm USING i_iobjnm i_version CHANGING l_t_data.
      ELSEIF i_value IS NOT INITIAL OR gt_chavl IS NOT INITIAL.
        PERFORM scan_value_sel
            USING i_value i_iobjnm i_version gt_chavl
            CHANGING l_t_data l_t_data_range.
      ELSE.
*       l_seltp = rsd_c_metaiobj-charact.
        PERFORM scan_char USING i_iobjnm i_version CHANGING l_t_data.
      ENDIF.
    ENDIF.

  ELSEIF i_compid IS NOT INITIAL.
    "------------------------------------------------------------------
    " Analysis for Reusable Query Elements
    "------------------------------------------------------------------

    "Get type and uid from view V_COMPDIR_ELTDIR
    SELECT SINGLE compuid deftp FROM v_compdir_eltdir
           INTO l_s_uid_deftp WHERE compid = i_compid."#EC CI_NOORDER
    IF sy-subrc = 0.
      l_uid   = l_s_uid_deftp-compuid.
      CLEAR l_iobjnm.
*     CASE l_deftp.
      CASE l_s_uid_deftp-deftp.
        WHEN 'VAR'.
          "Get iobjnm from view rszglobv
          SELECT SINGLE iobjnm FROM rszglobv "#EC CI_NOORDER "#EC CI_NOFIRST
                 INTO l_iobjnm WHERE vnam = i_compid." "#EC CI_NOFIELD
*************New ADÜ_20250430
          IF sy-subrc <> 0.
            "handled later in the Performer Suite
          ENDIF.
*************End ADÜ_20250430

      ENDCASE.
      PERFORM scan_compid USING i_compid i_version l_iobjnm l_uid
                          CHANGING l_t_data.
    ENDIF.

  ELSEIF i_uid IS NOT INITIAL.
    "------------------------------------------------------------------
    " Analysis for UID
    "------------------------------------------------------------------
    IF i_extended IS INITIAL.
      SELECT SINGLE deftp FROM v_compdir_eltdir  "#EC CI_NOORDER
        INTO CORRESPONDING FIELDS OF l_s_uid_deftp
        WHERE compuid = i_uid.
    ELSE.
      SELECT SINGLE deftp FROM rszeltdir  "#EC CI_NOORDER
      INTO CORRESPONDING FIELDS OF l_s_uid_deftp
      WHERE eltuid = i_uid.
    ENDIF.
    IF sy-subrc = 0.
      l_uid   = i_uid.
      PERFORM scan_compid USING i_compid i_version l_iobjnm l_uid
                          CHANGING l_t_data.
    ENDIF.

  ENDIF.

  "------------------------------------------------------------------
  " Exportparameter füllen
  "------------------------------------------------------------------
  "Tabelle T_DATA + T_DATA2
  LOOP AT l_t_data ASSIGNING <s_data>.
    AT FIRST.
      "Header Zeile für Exportparameter T_DATA2 erzeugen
      l_s_data2 = 'COMPUID;LEVEL;DEFT;COMPID;COMPUID_PARENT'.
      APPEND l_s_data2 TO t_data2[].
    ENDAT.

    "Parameter T_DATA
    MOVE-CORRESPONDING <s_data> TO l_s_data.
    APPEND l_s_data TO t_data[].

    "Parameter T_DATA2
    CLEAR l_s_data2.
    CONCATENATE
        <s_data>-compuid
        <s_data>-level
        <s_data>-deftp
        <s_data>-compid
        <s_data>-compuid_parent
      INTO l_s_data2 SEPARATED BY ';'.
    APPEND l_s_data2 TO t_data2[].
  ENDLOOP.

  "Doppelte Einträge löschen
  SORT t_data[] BY compuid.
  DELETE ADJACENT DUPLICATES FROM t_data[].

  "Tabelle T_DATA_RANGE
  LOOP AT l_t_data_range ASSIGNING <s_data_range>.
    AT FIRST."#EC CI_SORTED
      "Header Zeile für Exportparameter T_DATA_RANGE erzeugen
      l_s_data_range =
        'COMPUID;IOBJNM;SIGN;OPT;LOW;LOWFLAG;HIGH;HIGHFLAG;HIENM'.
      APPEND l_s_data_range TO t_data_range[].
    ENDAT.

    READ TABLE l_t_data ASSIGNING <s_data>
       WITH KEY compuid_parent = <s_data_range>-compuid.
    IF sy-subrc = 0.
      <s_data_range>-compuid = <s_data>-compuid.
    ENDIF.

    CLEAR l_s_data_range.
    CONCATENATE
        <s_data_range>-compuid
        <s_data_range>-iobjnm
        <s_data_range>-sign
        <s_data_range>-opt
        <s_data_range>-low
        <s_data_range>-lowflag
        <s_data_range>-high
        <s_data_range>-highflag
        <s_data_range>-hienm
      INTO l_s_data_range SEPARATED BY ';'.
    APPEND l_s_data_range TO t_data_range[].
  ENDLOOP.

ENDFUNCTION.


*&--------------------------------------------------------------------*
*&      Form  scan_attr_dis
*&--------------------------------------------------------------------*
FORM scan_attr_dis
  USING
    i_iobjnm
    i_attrinm
    i_version
  CHANGING
    c_t_data.

  DATA:
    l_t_eltuid  TYPE ty_t_eltuid,
    l_eltuid    TYPE sysuuid_25,
    l_s_data    TYPE ty_s_data_scan.

  FIELD-SYMBOLS:
    <s_data>    TYPE rsz_x_eltdir,
    <s_eltuid>  TYPE ty_s_eltuid.

  FREE l_t_eltuid.

  SELECT DISTINCT eltuid FROM rszeltattr INTO TABLE l_t_eltuid  "#EC CI_NOFIRST
    WHERE objvers = i_version
      AND iobjnm  = i_iobjnm
      AND attrinm = i_attrinm.

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

ENDFORM.                    "scan_attr_dis


*&--------------------------------------------------------------------*
*&      Form  scan_kyfnm
*&--------------------------------------------------------------------*
FORM scan_kyfnm
  USING
    i_iobjnm
    i_version
  CHANGING
    c_t_data.

  DATA:
    l_t_eltuid  TYPE ty_t_eltuid,
    l_eltuid    TYPE sysuuid_25,
    l_s_data    TYPE ty_s_data_scan.

  FIELD-SYMBOLS:
    <s_data>    TYPE rsz_x_eltdir,
    <s_eltuid>  TYPE ty_s_eltuid.

  "------------------------------------------------------------------
  " A] Kennzahl in Tabelle RSZRANGE suchen...
  "    (Eingeschränkte Kennzahl oder direkt in Query)
  "------------------------------------------------------------------
  FREE l_t_eltuid.

  SELECT DISTINCT eltuid FROM rszrange INTO TABLE l_t_eltuid  "#EC CI_NOFIRST
    WHERE objvers = i_version
      AND iobjnm  = rsd_c_metaiobj-keyfigure
      AND seltp   = rzd1_c_seltp-keyfig
      AND low     = i_iobjnm.

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

  "------------------------------------------------------------------
  " B] Kennzahl in Tabelle RSZCALC suchen...
  "    (Formel und berechnete Kennzahl)
  "------------------------------------------------------------------
  FREE l_t_eltuid.
  SELECT DISTINCT eltuid FROM rszcalc INTO TABLE l_t_eltuid "#EC CI_NOFIRST
    WHERE ( objvers = i_version                    )
      AND ( oper1   = i_iobjnm OR oper2 = i_iobjnm ).

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

ENDFORM.                    "scan_kyfnm


*&-------------------------------------------------------------------*
*&      Form  scan_value_sel
*&-------------------------------------------------------------------*
*       Search for characteristics with special selection
*--------------------------------------------------------------------*
FORM scan_value_sel
  USING
    i_value
    i_iobjnm
    i_version
    lt_chavl LIKE gt_chavl
  CHANGING
    c_t_data
    c_t_data_range TYPE ty_t_data_range.

  DATA:
    l_value        TYPE rschavl,
    l_eltuid       TYPE sysuuid_25,
    l_s_data       TYPE ty_s_data_scan,
    l_t_data_range TYPE ty_t_data_range.

  FIELD-SYMBOLS:
    <s_data_range> TYPE ty_s_data_range.

  FREE l_t_data_range.

  IF i_value CS '*' OR i_value CS '%'.
    l_value = i_value.
    REPLACE ALL OCCURRENCES OF '*' IN l_value WITH '%'.
    SELECT DISTINCT "#EC CI_NOFIRST
        eltuid
        iobjnm
        sign
        opt
        low
        lowflag
        high
        highflag
        hienm
      FROM rszrange INTO CORRESPONDING FIELDS OF TABLE l_t_data_range
      WHERE objvers = i_version
        AND iobjnm  LIKE i_iobjnm "1_8; support Nav-Attributes
         AND ( ( opt = 'EQ' AND low LIKE l_value AND lowflag = 1 )
           OR ( opt = 'BT' AND low <= l_value AND lowflag = 1
             AND high >= l_value AND highflag = 1 ) ).
  ELSEIF i_value IS NOT INITIAL.
    SELECT DISTINCT  "#EC CI_NOFIRST
        eltuid
        iobjnm
        sign
        opt
        low
        lowflag
        high
        highflag
        hienm
      FROM rszrange INTO CORRESPONDING FIELDS OF TABLE l_t_data_range
      WHERE objvers = i_version
        AND iobjnm  LIKE i_iobjnm"1_8; support Nav-Attributes
        AND ( ( opt = 'EQ' AND low = i_value )
         OR ( opt = 'BT' AND low <= i_value AND lowflag = 1
              AND high >= i_value  AND highflag = 1 ) ).
  ELSEIF lt_chavl IS NOT INITIAL. "Several values are passed (in table)
    SELECT DISTINCT  "#EC CI_NOFIRST
        eltuid
        iobjnm
        sign
        opt
        low
        lowflag
        high
        highflag
        hienm
      FROM rszrange INTO CORRESPONDING FIELDS OF TABLE l_t_data_range
      WHERE objvers =  i_version
        AND iobjnm  LIKE  i_iobjnm "1_8; support Nav-Attributes
        AND low     IN lt_chavl.
  ENDIF.

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_data_range ASSIGNING <s_data_range>.
    l_eltuid = <s_data_range>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid        = l_eltuid.
    l_s_data-compuid_parent = l_eltuid.

    <s_data_range>-compuid = l_eltuid.
    APPEND <s_data_range> TO c_t_data_range.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

ENDFORM.                    "scan_value_sel

*&-------------------------------------------------------------------*
*&      Form  scan_char
*&-------------------------------------------------------------------*
*--------------------------------------------------------------------
* A] Merkmale in Queries             -> RSZELTDIR
* B] Merkmale in Queries             -> RSZSELECT
* C] Merkmale in Ausnahmeaggregation -> RSZCALC
* D] Merkmale in Variablen           -> RSZGLOBV
* E] Merkmale als Attribut           -> RSZELTATTR
*--------------------------------------------------------------------
FORM scan_char
  USING
    i_iobjnm
    i_version
  CHANGING
    c_t_data.

  DATA:
    l_t_eltuid     TYPE ty_t_eltuid,
    l_eltuid       TYPE sysuuid_25,
    l_s_rszeltxref TYPE ty_s_rszeltxref,
    l_s_rszelttxt  TYPE rszelttxt,
    l_subrc        TYPE rs_bool,
    l_srch_attr    TYPE string,
    l_s_data       TYPE ty_s_data_scan.

  FIELD-SYMBOLS:
    <s_data>       TYPE ty_s_data_scan,
    <s_eltuid>     TYPE ty_s_eltuid,
    <s_rszcompdir> TYPE rszcompdir.

  CONCATENATE '%__' i_iobjnm INTO l_srch_attr.

  "------------------------------------------------------------------
  " A] RSZELTDIR
  "------------------------------------------------------------------
  FREE l_t_eltuid.
  SELECT DISTINCT eltuid FROM rszeltdir
    INTO CORRESPONDING FIELDS OF TABLE l_t_eltuid
    WHERE ( objvers     = i_version                                )
      AND ( defaulthint = i_iobjnm OR defaulthint LIKE l_srch_attr ).

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

  "------------------------------------------------------------------
  " B] RSZSELECT
  "------------------------------------------------------------------
  FREE l_t_eltuid.
  SELECT DISTINCT eltuid FROM rszselect  "#EC CI_NOFIRST
    INTO CORRESPONDING FIELDS OF TABLE l_t_eltuid
    WHERE objvers = i_version
      AND ( ( iobjnm = i_iobjnm OR coniobjnm = i_iobjnm )
       OR ( iobjnm LIKE l_srch_attr OR coniobjnm LIKE l_srch_attr ) ).

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

  "------------------------------------------------------------------
  " C] RSZCALC
  "------------------------------------------------------------------
  FREE l_t_eltuid.
  SELECT DISTINCT eltuid FROM rszcalc INTO TABLE l_t_eltuid "#EC CI_NOFIRST
    WHERE objvers = i_version
      AND ( aggrcha = i_iobjnm
       OR   aggrcha LIKE l_srch_attr ).

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

  "------------------------------------------------------------------
  " D] RSZGLOBV
  "------------------------------------------------------------------
  FREE l_t_eltuid.
  SELECT DISTINCT varuniid FROM rszglobv INTO TABLE l_t_eltuid
    WHERE objvers = i_version
      AND ( iobjnm = i_iobjnm
       OR   iobjnm LIKE l_srch_attr ).

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

  "--------------------------------------------------------------------
  " E] RSZELTATTR
  "--------------------------------------------------------------------
  "In case of 7.x Queries: Attributes are yet detected by selection
  "on table RSZELTDIR, but in case of 3.x Queries they have to be
  "detected by reading table RSZELTATTR
  FREE l_t_eltuid.
  SELECT DISTINCT eltuid FROM rszeltattr INTO TABLE l_t_eltuid  "#EC CI_NOFIRST
    WHERE objvers = i_version
      AND attrinm = i_iobjnm.

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

ENDFORM.                    "scan_char


*&--------------------------------------------------------------------*
*&      Form  scan_compid
*&--------------------------------------------------------------------*
FORM scan_compid
  USING
    i_compid
    i_version
    i_iobjnm
    i_uid
  CHANGING
    c_t_data.

  DATA:
    l_eltuid       TYPE sysuuid_25,
    l_s_rszeltxref TYPE ty_s_rszeltxref,
    l_t_rszeltxref TYPE TABLE OF ty_s_rszeltxref,
    l_s_data       TYPE ty_s_data_scan.

  SELECT DISTINCT seltuid teltuid laytp FROM rszeltxref
    INTO TABLE l_t_rszeltxref
    WHERE objvers = i_version
      AND teltuid = i_uid.

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_rszeltxref INTO l_s_rszeltxref.
    l_eltuid = l_s_rszeltxref-seltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.

  ENDLOOP.

ENDFORM.                    "scan_compid


*&--------------------------------------------------------------------*
*&      Form  SCAN_QUERY_ELEM_PARENT
*&--------------------------------------------------------------------*
FORM scan_query_elem_parent
  USING
    i_iobjnm
    i_teltuid
    i_version
  CHANGING
    c_t_data         TYPE ty_t_data_scan
    c_s_data_parent  TYPE ty_s_data_scan.

  DATA:
    l_s_rszeltxref   TYPE ty_s_rszeltxref,
    l_t_rszeltxref   TYPE ty_t_rszeltxref,
    l_level          TYPE c LENGTH 4,
    l_compuid        TYPE sysuuid_25.

  "Handelt es sich um ein wiederverw. Query Element? => hinzufügen
  PERFORM add_record
    USING
      i_iobjnm
      i_teltuid
      i_version
    CHANGING
      c_t_data
      c_s_data_parent.

  l_level   = c_s_data_parent-level.
  l_compuid = c_s_data_parent-compuid.

  "Übergeordnete Elemete ermitteln (SELTUID)
  SELECT seltuid teltuid laytp FROM rszeltxref
    INTO TABLE l_t_rszeltxref
    WHERE objvers = 'A'
      AND teltuid = i_teltuid.

  LOOP AT l_t_rszeltxref INTO l_s_rszeltxref.

    c_s_data_parent-level   = l_level.
    c_s_data_parent-compuid = l_compuid.

    "Rekursion beenden?
    CHECK l_level < p_level_max.

    "Eine Stufe hoch (die oberste Ebene entspricht der Query)
    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_s_rszeltxref-seltuid
        i_version
      CHANGING
        c_t_data
        c_s_data_parent.

  ENDLOOP.

ENDFORM.                    "SCAN_QUERY_ELEM_PARENT


*&--------------------------------------------------------------------*
*&      Form  add_record
*&--------------------------------------------------------------------*
FORM add_record
  USING
    i_iobjnm        TYPE rsiobjnm
    i_eltuid        TYPE sysuuid_25
    i_version       TYPE rsobjvers
  CHANGING
    c_t_data        TYPE ty_t_data_scan
    c_s_data_parent TYPE ty_s_data_scan.

  DATA:
    l_s_data        TYPE ty_s_data_scan,
    l_s_rszglobv    TYPE rszglobv,
    l_level         TYPE c LENGTH 4.

  FIELD-SYMBOLS:
    <s_rszcompdir> TYPE rszcompdir.

  "------------------------------------------------------------------
  " Wiederverwendbares Element?
  "------------------------------------------------------------------
  READ TABLE g_t_rszcompdir ASSIGNING <s_rszcompdir>
   WITH TABLE KEY compuid = i_eltuid.
  IF sy-subrc = 0.

    CLEAR l_s_data.
    MOVE <s_rszcompdir>-compuid  TO l_s_data-compuid.
    MOVE <s_rszcompdir>-compid   TO l_s_data-compid.
    MOVE <s_rszcompdir>-version  TO l_s_data-version.
    MOVE <s_rszcompdir>-tstpnm   TO l_s_data-tstpnm.
    MOVE <s_rszcompdir>-timestmp TO l_s_data-timestmp.

    l_level = c_s_data_parent-level + '0001'.
    MOVE l_level                 TO l_s_data-level.
    MOVE c_s_data_parent-compuid TO l_s_data-compuid_parent.

    "Datensatz schon vorhanden?
    READ TABLE c_t_data TRANSPORTING NO FIELDS
      WITH KEY
        compuid        = <s_rszcompdir>-compuid
        compuid_parent = l_s_data-compuid_parent.

    IF sy-subrc NE 0.

*    IF l_s_data-compuid NE l_s_data-compuid_parent.

      IF l_s_data-compuid EQ l_s_data-compuid_parent.
        CLEAR l_s_data-compuid_parent.
      ENDIF.

      "Zusätzl. Infos aus RSZCOMPIC
      SELECT SINGLE infocube FROM rszcompic INTO l_s_data-infocube
        WHERE compuid = i_eltuid
          AND objvers = i_version. "#EC CI_NOORDER

      "Zusätzl. Infos lesen aus RSZELTDIR
      SELECT SINGLE deftp FROM rszeltdir INTO (l_s_data-deftp)
        WHERE eltuid  = i_eltuid
          AND objvers = i_version.

      "Zusätzl. Infos aus V_CMP_JOIN
      SELECT SINGLE deftp FROM v_cmp_join INTO (l_s_data-deftp)
        WHERE compuid = i_eltuid
          AND objvers = i_version."#EC CI_NOORDER

      "Text lesen aus RSZELTTXT
      SELECT SINGLE txtlg FROM rszelttxt INTO l_s_data-txtlg
        WHERE eltuid  = l_s_data-compuid
          AND objvers = i_version
          AND langu   = sy-langu.

      INSERT l_s_data INTO TABLE c_t_data.

*     ENDIF.

      "Letzten Satz für Level und Vorgänger merken
      c_s_data_parent = l_s_data.

    ENDIF.

    RETURN.

  ENDIF.

*  "------------------------------------------------------------------
*  " Variable?
*  "------------------------------------------------------------------
  SELECT SINGLE * FROM rszglobv INTO l_s_rszglobv
    WHERE varuniid = i_eltuid
      AND objvers  = 'A'."#EC CI_ALL_FIELDS_NEEDED

  IF sy-subrc = 0.
    l_s_data-compuid = l_s_rszglobv-varuniid.
    l_s_data-compid  = l_s_rszglobv-vnam.
    INSERT l_s_data INTO TABLE c_t_data.
  ENDIF.

ENDFORM.                    " ADD_RECORD

Z_RFC_TRANSLATION v1_3

Source Code of Z_RFC_TRANSLATION
ABAP
function z_rfc_translation
  importing
    value(i_delimiter) like sonv-flag default '¦'
  tables
    t_values like tab512
  exceptions
    release_1_3
    not_authorized.




  field-symbols: <fs_values>    type tab512,
                 <fieldname>    type string,
                 <target_struc> type any,
                 <fieldvalue>   type any.

  data:
    ls_tab          type tab512,
    lt_fieldnames   type standard table of string,
    lt_values       type standard table of string,
    lr_target_struc type ref to data,
    lv_tabname      type tabname,
    lv_value        type string,
    lv_fieldname    type string.

  "get fields from first dataset
  read table t_values[] into ls_tab index 1.
  if sy-subrc <> 0.
    "empty table passed - not valid
    return.
  endif.


  loop at t_values[] assigning <fs_values>.

    clear: lv_value, lv_tabname.
    free: lt_fieldnames, lt_values.
    split <fs_values>  at i_delimiter into table lt_fieldnames.

    "Get table
    loop at lt_fieldnames[] assigning <fieldname>.

      if <fieldname>(5) eq 'TABLE'.

        split <fieldname> at '===' into table lt_values.
        read table lt_values into lv_value index 2.
        if sy-subrc = 0.
          lv_tabname = lv_value.
          exit.
        endif.

      endif.
    endloop.

    "create table structure dynamically
    free lr_target_struc.
    create data lr_target_struc type (lv_tabname).
    assign lr_target_struc->* to <target_struc>.

    "Write fields
    loop at lt_fieldnames[] assigning <fieldname>.

      clear: lv_value.
      free: lt_values.

      if <fieldname>(5) eq 'TABLE'.
        continue.
      endif.

      split <fieldname> at '===' into table lt_values.
      read table lt_values into lv_fieldname index 1.
      if sy-subrc <> 0.
        continue.
      endif.
      read table lt_values into lv_value index 2.
      if sy-subrc <> 0.
        continue.
      endif.

      assign component lv_fieldname of structure <target_struc>
       to <fieldvalue>.
      if sy-subrc <> 0.
        write:/ 'FIELD ', <fieldname>, 'NOT FOUND'.
        continue.
      endif.

      <fieldvalue> = lv_value.

    endloop.
*BEGIN New ADü_20250328
    authority-check object 'S_TABU_NAM'
    id 'ACTVT' field '02'
    id 'TABLE' field lv_tabname.
    if sy-subrc <> 0.
      raise not_authorized.
    else.
*END New ADü_20250328
      modify (lv_tabname) from <target_struc>.
*BEGIN New ADü_20250328
    endif.
*END New ADü_20250328

  endloop.

  call function 'DB_COMMIT'.


endfunction.

Z_RFC_ADSO_GETDTL_XML v1_2

Source Code of Z_RFC_ADSO_GETDTL_XML
ABAP
function z_rfc_adso_getdtl_xml
  importing
    value(i_adsonm) type rsoadsonm
  exporting
    value(e_text) type rsoadsodescr
    value(e_infoarea) type rsinfoarea
    value(ev_adsoflags_xml) type string
    value(ev_object_xml) type string
    value(ev_dimension_xml) type string
    value(ev_key_xml) type string
    value(ev_hash_xml) type string
    value(ev_index_xml) type string
    value(ev_partition_xml) type string
    value(ev_cha_const_xml) type string
    value(ev_validity_xml) type string
  exceptions
    release_1_2
    not_authorized.



  data: lt_parameters type abap_parmbind_tab.
  data: ls_parameter  type abap_parmbind.
  data: lo_ref        type ref to data.
*****20210422 ADü_Begin Bug DP-5283
  data: objvers_a     type rsobjvers value 'A'.
*****20210422 ADü_End

  field-symbols: <any> type any.

  " get method parameter types
  select
  sconame,
  type
  from seosubcodf
  into table @data(lt_method_param_types)
  where clsname = 'CL_RSO_ADSO_API'
    and cmpname = 'READ'
    and type <> ''
  order by editorder.

  loop at lt_method_param_types assigning field-symbol(<ls_method_param_type>).
    try.
        create data lo_ref type (<ls_method_param_type>-type).
      catch cx_sy_create_data_error.
        " probably type of class
        data(lv_type) = |CL_RSO_ADSO_API=>{ <ls_method_param_type>-type }|.
        try.
            create data lo_ref type (lv_type).
          catch cx_sy_create_data_error..
            " no plan c
            exit.
        endtry.
    endtry.

    case <ls_method_param_type>-sconame+0(1).
      when 'E'.
        data(lv_kind) = cl_abap_objectdescr=>importing.
      when 'I'.
        lv_kind =  cl_abap_objectdescr=>exporting.
      when others.
        exit.
    endcase.

    ls_parameter = value abap_parmbind(
        name  = <ls_method_param_type>-sconame
        kind  = lv_kind
        value = lo_ref  ).
*****20210422 ADü_Begin Bug DP-5283
    if ls_parameter-name = 'I_OBJVERS'.
      assign lo_ref->* to <any>.
      <any> = objvers_a.
    endif.
*****20210422 ADü_End
    insert ls_parameter into table lt_parameters.
    free: ls_parameter.
*****20210422 ADü_Begin Bug DP-5283
    unassign <any>.
*****20210422 ADü_End

  endloop.

  read table lt_parameters assigning field-symbol(<ls_parameter>) with key name = 'I_ADSONM'.
  if sy-subrc = 0.
    assign <ls_parameter>-value->* to <any>.
    <any> = i_adsonm.
  endif.

  try.
*BEGIN New ADü_20250328
      authority-check object 'S_RS_ADSO'
       id 'RSINFOAREA' field '*'
       id 'RSOADSONM' field '*'
       id 'RSOADSOPAR' field '*'
       id 'ACTVT' field '03'.
      if sy-subrc <> 0.
        raise not_authorized.
      else.
*END New ADü_20250328
        call method ('CL_RSO_ADSO_API')=>read parameter-table lt_parameters.
*BEGIN New ADü_20250328
      endif.
*END New ADü_20250328
    catch cx_root. " catch all errors and exit -> no exceptions defined
      return.
  endtry.

  " Transform to XML for Export
  loop at lt_parameters assigning <ls_parameter>.

    assign <ls_parameter>-value->*  to <any>.
    " For easier consumption in the create Module switch the naming in XML to I_
    " for the importing Parameters of the create method
    if <ls_parameter>-name+0(1) = 'E'.
      data(lv_name) = |I{ <ls_parameter>-name+1(29) }|.
    else.
      lv_name = <ls_parameter>-name.
    endif.

    data(lt_srcbind) = value abap_trans_srcbind_tab( (
    name  = lv_name
    value = <ls_parameter>-value ) ).

    case <ls_parameter>-name.
      when 'E_TEXT'.
        e_text = <any>.
      when 'E_INFOAREA'.
        e_infoarea = <any>..
      when 'E_S_ADSOFLAGS'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_adsoflags_xml.
      when 'E_T_OBJECT'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_object_xml.
      when 'E_T_DIMENSION'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_dimension_xml.
      when 'E_T_KEY'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_key_xml.
      when 'E_T_HASH'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_hash_xml.
      when 'E_T_INDEX'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_index_xml.
      when 'E_T_PARTITION'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_partition_xml.
      when 'E_T_CHA_CONST'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_cha_const_xml.
      when 'E_T_VALIDITY'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_validity_xml.
    endcase.
  endloop.

endfunction.

Z_RFC_ADSO_CREATE_XML v1_3

Source Code of Z_RFC_ADSO_CREATE_XML
ABAP
FUNCTION z_rfc_adso_create_xml
  IMPORTING
    VALUE(i_adsonm) TYPE rsoadsonm
    VALUE(i_text) TYPE rsoadsodescr OPTIONAL
    VALUE(i_infoarea) TYPE rsinfoarea OPTIONAL
    VALUE(iv_adsoflags) TYPE string
    VALUE(iv_object) TYPE string
    VALUE(iv_dimension) TYPE string
    VALUE(iv_key) TYPE string
    VALUE(iv_hash) TYPE string
    VALUE(iv_index) TYPE string
    VALUE(iv_partition) TYPE string
    VALUE(iv_cha_const) TYPE string
    VALUE(iv_validity) TYPE string
  EXCEPTIONS
    not_active
    not_created
    release_1_3
    not_authorized.



   DATA: lt_resbind    TYPE abap_trans_resbind_tab.
   DATA: ls_resbind    TYPE abap_trans_resbind.
   DATA: lt_parameters TYPE abap_parmbind_tab.
   DATA: ls_parameter  TYPE abap_parmbind.
   DATA: lo_ref        TYPE REF TO data.

   FIELD-SYMBOLS: <any> TYPE any.

   " get method parameter types
   SELECT
   sconame,
   type
   FROM seosubcodf
   INTO TABLE @DATA(lt_method_param_types)
   WHERE clsname = 'CL_RSO_ADSO_API'
     AND cmpname = 'CREATE'
     AND type <> ''
   ORDER BY editorder.

   LOOP AT lt_method_param_types ASSIGNING FIELD-SYMBOL(<ls_method_param_type>).
     FREE: ls_parameter, ls_resbind, lt_resbind.

     TRY. " create data reference for parameter
         CREATE DATA lo_ref TYPE (<ls_method_param_type>-type).
       CATCH cx_sy_create_data_error.
         " probably type of class
         DATA(lv_type) = |CL_RSO_ADSO_API=>{ <ls_method_param_type>-type }|.
         TRY.
             CREATE DATA lo_ref TYPE (lv_type).
           CATCH cx_sy_create_data_error..
             " no plan c
             EXIT.
         ENDTRY.
     ENDTRY.

     ls_resbind = VALUE abap_trans_resbind(
         name  = <ls_method_param_type>-sconame
         value = lo_ref  ).
     INSERT ls_resbind INTO TABLE lt_resbind.

     " determine kind of parameter for dynamic method call
     CASE <ls_method_param_type>-sconame+0(1).
       WHEN 'E'.
         DATA(lv_kind) = cl_abap_objectdescr=>importing.
       WHEN 'I'.
         lv_kind =  cl_abap_objectdescr=>exporting.
       WHEN OTHERS.
         EXIT.
     ENDCASE.

     CASE <ls_method_param_type>-sconame.
       WHEN 'I_ADSONM'.
         GET REFERENCE OF i_adsonm INTO DATA(lo_adsonmref).
         ls_parameter = VALUE abap_parmbind(
             name  = <ls_method_param_type>-sconame
             kind  = lv_kind
             value = lo_adsonmref ).
         INSERT ls_parameter INTO TABLE lt_parameters.
       WHEN 'I_TEXT'.
         GET REFERENCE OF i_text INTO DATA(lo_text).
         ls_parameter = VALUE abap_parmbind(
             name  = <ls_method_param_type>-sconame
             kind  = lv_kind
             value = lo_text ).
         INSERT ls_parameter INTO TABLE lt_parameters.
         CONTINUE.
       WHEN 'I_INFOAREA'.
         GET REFERENCE OF i_infoarea INTO DATA(lo_infoarea).
         ls_parameter = VALUE abap_parmbind(
             name  = <ls_method_param_type>-sconame
             kind  = lv_kind
             value = lo_infoarea ).
         INSERT ls_parameter INTO TABLE lt_parameters.
         CONTINUE.
       WHEN 'I_S_ADSOFLAGS'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_adsoflags RESULT (lt_resbind).
       WHEN 'I_T_OBJECT'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_object RESULT (lt_resbind).
       WHEN 'I_T_DIMENSION'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_dimension RESULT (lt_resbind).
       WHEN 'I_T_KEY'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_key RESULT (lt_resbind).
       WHEN 'I_T_HASH'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_hash RESULT (lt_resbind).
       WHEN 'I_T_INDEX'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_index RESULT (lt_resbind).
       WHEN 'I_T_PARTITION'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_partition RESULT (lt_resbind).
       WHEN 'I_T_CHA_CONST'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_cha_const RESULT (lt_resbind).
       WHEN 'I_T_VALIDITY'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_validity RESULT (lt_resbind).
     ENDCASE.

     " build parameter table for method call
     ls_parameter = VALUE abap_parmbind(
         name  = <ls_method_param_type>-sconame
         kind  = lv_kind
         value = lt_resbind[ 1 ]-value ).
     INSERT ls_parameter INTO TABLE lt_parameters.

   ENDLOOP.

   TRY.
*BEGIN New ADü_20250328
      authority-check object 'S_RS_ADSO'
       id 'RSINFOAREA' field '*'
       id 'RSOADSONM' field '*'
       id 'RSOADSOPAR' field '*'
       id 'ACTVT' field '03'.
      if sy-subrc <> 0.
        raise not_authorized.
      else.
*END New ADü_20250328
       CALL METHOD ('CL_RSO_ADSO_API')=>create PARAMETER-TABLE lt_parameters.
*BEGIN New ADü_20250328
       endif.
*END New ADü_20250328
     CATCH cx_root. " catch all errors and exit
   ENDTRY.

   "check if object is created, active and dequeue it
   DATA: lv_exists TYPE i.
   SELECT COUNT( * )
    FROM rsoadso "#EC CI_BYPASS
      INTO lv_exists
        WHERE adsonm  = i_adsonm
        AND ( objvers   = 'A'
        OR objvers    = 'M' ).

   IF NOT lv_exists >= 1.
     RAISE not_created.
   ENDIF.

   DATA: lo_adso TYPE REF TO cl_rso_adso.

   CALL METHOD cl_rso_adso=>factory
     EXPORTING
       i_adsonm = i_adsonm
     RECEIVING
       r_r_adso = lo_adso.

   "dequeue
   CALL METHOD lo_adso->if_rso_tlogo_maintain~dequeue.

   "is active
   DATA: is_active TYPE rs_bool.

   CALL METHOD lo_adso->if_rso_tlogo_maintain~is_active
     RECEIVING
       r_is_active = is_active.

   IF is_active = rs_c_false.
     RAISE not_active.
   ENDIF.
 ENDFUNCTION.

Z_RFC_FUNCTION_DELETE v1_1

Source Code of Z_RFC_FUNCTION_DELETE
ABAP
function z_rfc_function_delete
  importing
    value(funcname) type funcname
  exceptions
    error_message
    release_1_1
    not_authorized
    not_allowed_to_delete.



*BEGIN New ADü_20250328
  authority-check object 'S_DEVELOP' "#EC AUTFLD_MIS
   id 'DEVCLASS' field '*'
   id 'OBJTYPE' field 'FUNC'
   id 'OBJNAME' field funcname
   id 'ACTVT' field '06'.
  if sy-subrc <> 0.
    raise not_authorized.
  endif.
  " Check if FM which should be deleted is in the same FUGR as this FM
  data: lv_pnameOfFuncname type pname.
  " get pname of FM which should be delete
  select single pname from tfdir into lv_pnameOfFuncname where funcname = funcname.
 " compare pnames
  if lv_pnameOfFuncname <> sy-repid.
    raise not_allowed_to_delete.
  endif.
*END New ADü_20250328


  call function 'FUNCTION_DELETE'
    exporting
      funcname      = funcname
    exceptions
      error_message = 1
      others        = 2.
  if sy-subrc = 1.
    raise error_message.
  endif.
endfunction.

Z_RFC_CHECK_ACT_TR v1_2

Source Code of Z_RFC_CHECK_ACT_TR
ABAP
function z_rfc_check_act_tr
  importing
    value(iv_mode) type char1 default '1'
    value(iv_xml_objects) type string
    value(iv_transport) type trkorr optional
  exporting
    value(ev_xml_status) type string
  exceptions
    release_1_2
    not_authorized.



  types:
    begin of ty_message,
      message_type type sy-msgty,
      message      type string,
    end of ty_message.
  types: tt_messages type standard table of ty_message with default key.

  types:
    begin of ty_status,
      tlogo                 type rstlogo,
      objnm                 type sobj_name,
      actflg                type rsawbn_obj_activflg,
      objstat               type rsobjstat,
      saved                 type rs_bool,
      activflg              type rsawbn_obj_activflg,
      locked                type rs_bool,
      tr_lock               type rs_bool,
      no_handler            type rs_bool,
      written_to_tr         type rs_bool,
      activation_successful type rs_bool,
      messages              type tt_messages,
    end of ty_status.

  data: lt_objects        type rso_t_tlogo.
  data: lt_status         type table of ty_status.
  data: lv_objvers        type rs_objvers.
  data: lo_tlogo          type ref to if_rso_tlogo.
  data: lv_objstat        type rsobjstat.
  data: lo_msg            type ref to cl_rso_msg.
  data: lt_object_details type rso_t_cto_tlogo_prop.
  data: lv_request        type trkorr.
  data: lv_error          type rs_bool.
  data: lt_tr_msg         type bapirettab.
  data: lo_awbn_factory   type ref to cl_rsawbn_obj_factory.
  data: lo_awbn_object    type ref to cl_rsawbn_obj.
  data: lt_enq            type table of seqg3.
  data: lv_garg           type eqegraarg.
  data: lv_logsys         type rsrlogsys.
  data: ls_tlogoprop      type rstlogoprop.
  data: lt_msg            type rs_t_msg.
  data: lv_repaired       type rs_bool.
  data: lv_subrc          type sysubrc.

  field-symbols: <ls_enq>    type seqg3.
  field-symbols: <message>   type ty_message.
  field-symbols: <ls_status> type ty_status.
  field-symbols: <ls_object> type rso_s_tlogo.
  field-symbols: <ls_msg>    type rs_s_msg.
  field-symbols: <ls_tr_obj> type trexreqob.



  call transformation (`ID`) source xml iv_xml_objects result xml_objects = lt_objects.

  " only accept 1 - check / 2 - activate / 3 - transport mode
  assert iv_mode = 1 or iv_mode = 2 or iv_mode = 3.

  if lt_objects is initial.
      return. " no objects -> nothing to do
  endif.

  " create AWBN Factory for later usage
  create object lo_awbn_factory.


  loop at lt_objects assigning <ls_object>.

    " Prepare Status Output
    append initial line to lt_status assigning <ls_status>.

    " Fill general fields
    <ls_status>-tlogo = <ls_object>-tlogo.
    <ls_status>-objnm = <ls_object>-objnm.

*BEGIN New ADü_20250328
    authority-check object 'S_RS_ADMWB'
     id 'RSADMWBOBJ' field '*'
     id 'ACTVT' field '03'.
    if sy-subrc <> 0.
      raise not_authorized.
    else.
*END New ADü_20250328
      " get logsys
      lv_logsys = cl_rso_repository=>get_logical_system_self( ).
*BEGIN New ADü_20250328
    endif.
*END New ADü_20250328
    " get tlogoprops
    cl_rso_repository=>get_tlogoprop( exporting i_tlogo = <ls_object>-tlogo importing  e_s_tlogoprop = ls_tlogoprop ).

    try .
        " Check A Version
        lv_objvers = 'A'.
        call method cl_rso_object_collection_cache=>get_object_properties
          exporting
            i_tlogo            = <ls_object>-tlogo
            i_objnm            = <ls_object>-objnm
            i_objvers          = lv_objvers
            i_objlogsys        = lv_logsys
            i_bypassing_buffer = abap_true
            i_no_message       = abap_true
          importing
            e_objstat          = lv_objstat
          exceptions
            object_not_found   = 1.
      catch cx_root.
        " Check M Version
        lv_objvers = 'M'.
        call method cl_rso_object_collection_cache=>get_object_properties
          exporting
            i_tlogo            = <ls_object>-tlogo
            i_objnm            = <ls_object>-objnm
            i_objvers          = lv_objvers
            i_objlogsys        = lv_logsys
            i_bypassing_buffer = abap_true
            i_no_message       = abap_true
          importing
            e_objstat          = lv_objstat
          exceptions
            object_not_found   = 1.
    endtry.

    " fill Object Status
    <ls_status>-objstat = lv_objstat.

    " Check if tlogo class is available
    if ls_tlogoprop-class is not initial.
      call method (ls_tlogoprop-class)=>if_rso_tlogo~get_instance
        exporting
          i_objnm   = <ls_object>-objnm
        receiving
          r_r_tlogo = lo_tlogo.
    else.
      <ls_status>-no_handler = abap_true.
    endif.

    " saved?
    if lo_tlogo is bound.
      <ls_status>-saved = lo_tlogo->if_rso_tlogo_maintain~is_saved( ).
    endif.

    if iv_mode = '1'. " Check Mode

      " Check for M / A Version
      lo_awbn_factory->get_instance(
        exporting
          i_tlogo              = <ls_object>-tlogo
          i_objnm              = <ls_object>-objnm
        receiving
          re_r_awbobj          = lo_awbn_object ).

      <ls_status>-activflg = lo_awbn_object->get_activflg( ). " U -> M <> A Version / X -> M = A Version / '' no information
      "Special case Analysis Auth.
      if <ls_object>-tlogo = 'ASOB'.
        data: lt_objstat type table of rsobjstat.
        select objstat
          from rsecbiau
          into table lt_objstat
            where auth = <ls_object>-objnm.

        find 'INA' in table lt_objstat.                 "#EC CI_NOORDER

        if sy-subrc = 0.
          <ls_status>-activflg = 'U'.
        endif.
        "special case 7.x InfoSources
      elseif <ls_object>-tlogo = 'TRCS'.
        data: lv_timstmp_a type rstimestmp,
              lv_timstmp_m type rstimestmp.
        select single timestmp
          from rsksnew
            into lv_timstmp_a
              where isource = <ls_object>-objnm
                and objvers = 'A'.

        select single timestmp
          from rsksnew
            into lv_timstmp_m
              where isource = <ls_object>-objnm
                and objvers = 'M'.

        if lv_timstmp_m > lv_timstmp_a.
          <ls_status>-activflg = 'U'.
        endif.
      endif.

      " check for lock
      call function 'ENQUEUE_READ'
        exporting
          gclient = sy-mandt
          guname  = ''
        tables
          enq     = lt_enq.

      concatenate <ls_object>-objnm '*' into lv_garg.

      loop at lt_enq assigning <ls_enq> where garg cp lv_garg. " AND gobj = ls_tlogoprop-enqobject.
      endloop.
      if sy-subrc = 0.
        <ls_status>-locked = abap_true.
      endif.

      " transport locks
      data: ls_e071     type e071.
      data: lv_result   type trpari-s_checked.
      data: ls_tadir    type tadir.
      data: ls_lock_key type tlock_int.
      data: lt_tlock    type table of tlock.
      data: lv_lockflag type trpari-s_lockflag.

      ls_e071-pgmid    = 'R3TR'.
      ls_e071-object   = <ls_object>-tlogo.
      ls_e071-obj_name = <ls_object>-objnm.

      call function 'TR_CHECK_TYPE'
        exporting
          wi_e071     = ls_e071
        importing
          pe_result   = lv_result
          we_lock_key = ls_lock_key
          we_tadir    = ls_tadir.

      " determine lock key for complete object (TADIR)
      if  ls_e071-pgmid    = ls_tadir-pgmid
      and ls_e071-object   = ls_tadir-object
      and ls_e071-obj_name = ls_tadir-obj_name.
        "   object is already complete (TADIR object): lock key is already known
      else.
        move-corresponding ls_tadir to ls_e071.
        call function 'TR_CHECK_TYPE'
          exporting
            wi_e071     = ls_e071
          importing
            pe_result   = lv_result
            we_lock_key = ls_lock_key
            we_tadir    = ls_tadir.
      endif.
      " proceed only for lockable objects
      if lv_result = 'L'.
        " determine locks refering to complete (TADIR) object
        call function 'TRINT_CHECK_LOCKS'
          exporting
            wi_lock_key = ls_lock_key
          importing
            we_lockflag = lv_lockflag
          tables
            wt_tlock    = lt_tlock
          exceptions
            empty_key   = 1
            others      = 2 ##FM_SUBRC_OK.
        if lv_lockflag = abap_true.
          <ls_status>-tr_lock = abap_true.
        else.
          <ls_status>-tr_lock = abap_false.
        endif.

      else.
        <ls_status>-tr_lock = abap_false.
      endif.


      if lo_tlogo is bound.
        lo_tlogo->if_rso_tlogo_maintain~check(
          exporting
            i_objvers            = lv_objvers
          importing
            e_r_msg              = lo_msg
            e_is_repaired        = lv_repaired
            e_subrc              = lv_subrc ).

        if lo_msg is bound.
          lt_msg = lo_msg->get_all_msg( ).

          loop at lt_msg assigning <ls_msg>.
            append initial line to <ls_status>-messages assigning <message>.
            <message>-message_type = <ls_msg>-msgty.
            message id <ls_msg>-msgid type <ls_msg>-msgty number <ls_msg>-msgno
                 with <ls_msg>-msgv1 <ls_msg>-msgv2 <ls_msg>-msgv3 <ls_msg>-msgv4
                 into <message>-message.
          endloop.
        endif.
      endif.

    endif.

    if iv_mode = '2'. " Activation Mode

      if lo_tlogo is not bound.
        exit.
      endif.

      " Run Check before activation.
      if lo_tlogo is bound.
        lo_tlogo->if_rso_tlogo_maintain~check(
      exporting
        i_objvers            = lv_objvers
      importing
        e_r_msg              = lo_msg
        e_is_repaired        = lv_repaired
        e_subrc              = lv_subrc ).
        if lo_msg is bound.
          lt_msg = lo_msg->get_all_msg( ).

          delete lt_msg where not ( msgty eq 'E' or msgty eq 'W' ). " only look for errors and warnings
          if lt_msg is not initial. " Error messages found? return messages - skip activation
            loop at lt_msg assigning <ls_msg>.
              append initial line to <ls_status>-messages assigning <message>.
              <message>-message_type = <ls_msg>-msgty.
              message id <ls_msg>-msgid type <ls_msg>-msgty number <ls_msg>-msgno
                   with <ls_msg>-msgv1 <ls_msg>-msgv2 <ls_msg>-msgv3 <ls_msg>-msgv4
                   into <message>-message.
            endloop.
          endif.
        endif.
      endif.
      try.
          lo_tlogo->if_rso_tlogo_maintain~prepare(
            exporting
              i_with_enqueue       = rs_c_false    " = 'X': with Enqueue Lock
              i_with_cto_check     = rs_c_false    " = 'X': with CTO Check
              i_with_authority     = rs_c_false    " = 'X': with Authorization
              i_with_rebuild       = rs_c_false    " = 'X': Database Must Reread the Object
              i_actvt              = rssb_c_auth_actvt-maintain    " Activity
              i_objvers            = rs_c_objvers-active    " Object version
              i_detlevel           = '3'    " Application Log: Level of Detail
          ).
        catch cx_rs_cancelled.
        catch cx_rs_not_authorized.
        catch cx_rs_display_only.
      endtry.

      lo_tlogo->if_rso_tlogo_maintain~activate(
        exporting
          i_objvers             = lv_objvers   " Object Version (A / M)
          i_force_activation    = rs_c_true    " = 'X': activate in case the object is already active
          i_show_check_protocol = rs_c_false   " = 'X': Display Consistency Log as Popup if Warnings Arise
          i_with_cto            = rs_c_false
        importing
          e_subrc               =  lv_subrc  ).

      if lv_subrc = 0.
        <ls_status>-activation_successful = abap_true.
        append initial line to <ls_status>-messages assigning <message>.
        <message>-message_type = 'S'.
        <message>-message = 'Activation successful' ##NO_TEXT.

      else.
        <ls_status>-activation_successful = abap_false.
        append initial line to <ls_status>-messages assigning <message>.
        <message>-message_type = 'E'.
        <message>-message = 'Activation failed' ##NO_TEXT.
      endif.

    endif.

    if iv_mode = '3'. " Transport Mode
      check iv_transport is not initial.

      data: ls_wi_e071 like e071.
      ls_wi_e071-pgmid = 'R3TR'.
      ls_wi_e071-object   = <ls_object>-tlogo.
      ls_wi_e071-obj_name = <ls_object>-objnm.

      call function 'TR_APPEND_TO_COMM'
        exporting
          pi_korrnum                     = iv_transport
          wi_e071                        = ls_wi_e071
        exceptions
          no_authorization               = 1
          no_systemname                  = 2
          no_systemtype                  = 3
          tr_check_keysyntax_error       = 4
          tr_check_obj_error             = 5
          tr_enqueue_failed              = 6
          tr_ill_korrnum                 = 7
          tr_key_without_header          = 8
          tr_lockmod_failed              = 9
          tr_lock_enqueue_failed         = 10
          tr_modif_only_in_modif_order   = 11
          tr_not_owner                   = 12
          tr_no_append_of_corr_entry     = 13
          tr_no_append_of_c_member       = 14
          tr_no_shared_repairs           = 15
          tr_order_not_exist             = 16
          tr_order_released              = 17
          tr_order_update_error          = 18
          tr_repair_only_in_repair_order = 19
          tr_wrong_order_type            = 20
          wrong_client                   = 21
          others                         = 22.
      if sy-subrc <> 0.
        <ls_status>-written_to_tr = abap_false.
      else.
        <ls_status>-written_to_tr = abap_true.
      endif.
      free: ls_wi_e071.

    endif.

  endloop.

  call transformation (`ID`) source status   = lt_status   result xml ev_xml_status.

endfunction.

Z_RFC_HCPR_CREATE v1_1

Source Code of Z_RFC_HCPR_CREATE
ABAP
function z_rfc_hcpr_create
  importing
    value(i_hcprnm) type rsohcprnm default ''
    value(i_description) type sstring default ''
    value(i_infoarea) type rsinfoarea default ''
  exporting
    value(e_success) type rs_bool
  tables
    t_partprovider like rsd_s_prov
  exceptions
    release_1_1
    not_authorized.




  data: lt_partprovider type table of rsinfoprov,
        ls_partprovider type rsinfoprov,
        ls_temp         type rsd_s_prov.

  loop at t_partprovider into ls_temp.
    ls_partprovider = ls_temp-infoprov.
    append ls_partprovider to lt_partprovider.
  endloop.

*BEGIN New ADü_20250328
  authority-check object 'S_RS_HCPR'
   id 'RSINFOAREA' field i_infoarea
   id 'RSHCPR' field i_hcprnm
   id 'ACTVT' field '03'
   id 'RSHCPROBJ' field '*'.
  if sy-subrc <> 0.
    raise not_authorized.
  else.
*END New ADü_20250328
    call method cl_rso_hcpr_metadata_api=>create_union
      exporting
        i_hcprnm          = i_hcprnm
        i_description     = i_description
        i_infoarea        = i_infoarea
        i_t_part_provider = lt_partprovider
      importing
        "e_r_msg           = E_R_MSG
        e_success         = e_success.
*BEGIN New ADü_20250328
  endif.
*END New ADü_20250328
endfunction.

Documentation Function Modules (BW/4HANA):
20250818_BW4_Function_Modules_with_Sourcecode_v251.pdf


Source Code for BW (Classic):

Z_RFC_ENTITY_SYNC v2_0

Source Code of Z_RFC_ENTITY_SYNC
ABAP
FUNCTION Z_RFC_ENTITY_SYNC
  IMPORTING
    VALUE(TIMESTMP) TYPE RSTIMESTMP OPTIONAL
    VALUE(SYNC_WORKBENCH) TYPE SONV-FLAG DEFAULT 'X'
    VALUE(SYNC_REPORTING) TYPE SONV-FLAG DEFAULT 'X'
    VALUE(SYNC_CHAINS) TYPE SONV-FLAG DEFAULT 'X'
    VALUE(SYNC_PROG) TYPE SONV-FLAG DEFAULT 'X'
    VALUE(SYNC_FUNC) TYPE SONV-FLAG DEFAULT 'X'
    VALUE(SYNC_CLAS) TYPE SONV-FLAG DEFAULT 'X'
    VALUE(SYNC_IOBJ) TYPE SONV-FLAG DEFAULT 'X'
    VALUE(SYNC_IOBJCAT) TYPE SONV-FLAG OPTIONAL
    VALUE(SYNC_AUTH) TYPE SONV-FLAG DEFAULT 'X'
    VALUE(SYNC_APD) TYPE SONV-FLAG DEFAULT 'X'
    VALUE(SYNC_BPC) TYPE SONV-FLAG OPTIONAL
    VALUE(SYNC_WDYN) TYPE SONV-FLAG DEFAULT 'X'
  TABLES
    T_DEVCLASS LIKE TCHLP
    T_LANGUAGE LIKE TCP0H
    T_RSDIOBJ LIKE RSDIOBJ
    T_RSDIOBJT LIKE RSDIOBJT
    T_RSDIOBCIOBJ LIKE RSDIOBCIOBJ
    T_RSDIOBCT LIKE RSDIOBCT
    T_RSBASIDOC LIKE RSBASIDOC
    T_RSDS LIKE RSDS
    T_RSDST LIKE RSDST
    T_RSOLTPSOURCE LIKE RSOLTPSOURCE
    T_RSOLTPSOURCET LIKE RSOLTPSOURCET
    T_RSTRANT LIKE RSTRANT
    T_RSIS LIKE RSIS
    T_RSIST LIKE RSIST
    T_RSKSNEW LIKE RSKSNEW
    T_RSKSNEWT LIKE RSKSNEWT
    T_RSTS LIKE RSTS
    T_RSDCUBET LIKE RSDCUBET
    T_RSDODSOT LIKE RSDODSOT
    T_RSQISET LIKE RSQISET
    T_RSQISETT LIKE RSQISETT
    T_RSBSPOKE LIKE RSBSPOKE
    T_RSBSPOKET LIKE RSBSPOKET
    T_RSBOHDEST LIKE RSBOHDEST
    T_RSBOHDESTT LIKE RSBOHDESTT
    T_RSPLS_ALVL LIKE RSPLS_ALVL
    T_RSPLS_ALVLT LIKE RSPLS_ALVLT
    T_RSPLF_SRV LIKE RSPLF_SRV
    T_RSPLF_SRVT LIKE RSPLF_SRVT
    T_RSPLS_SEQUENCE LIKE RSPLS_SEQUENCE
    T_RSPLS_SEQUENCET LIKE RSPLS_SEQUENCET
    T_RSPCCHAINATTR LIKE RSPCCHAINATTR
    T_RSPCCHAINT LIKE RSPCCHAINT
    T_V_REP_JOIN LIKE V_REP_JOIN
    T_V_REP_REUSE LIKE V_COMPDIR_COMPIC
    T_RSZGLOBV LIKE RSZGLOBV
    T_V_ELTDIR_TXT LIKE RSZELTTXT
    T_RSRWBINDEX LIKE RSRWBINDEX
    T_RSRWBINDEXT LIKE RSRWBINDEXT
    T_RSRWORKBOOK LIKE RSRWORKBOOK
    T_RSZWBTMPHEAD LIKE RSZWBTMPHEAD
    T_RSZWBTMPHEADTXT LIKE RSZWBTMPHEADTXT
    T_RSZWBTMPXREF LIKE RSZWBTMPXREF
    T_RSZWTEMPLATE LIKE RSZWTEMPLATE
    T_RSZWOBJTXT LIKE RSZWOBJTXT
    T_RSZWOBJXREF LIKE RSZWOBJXREF
    T_FUGR LIKE INFO_FUGRT
    T_FUNC LIKE INFO_FUNCT
    T_TADIR_PROG LIKE TRESN
    T_TRDIRT LIKE TRDIRT
    T_RSANT_PROCESST LIKE RSANT_PROCESST
    T_RSANT_PROCESS LIKE RSO_S_OBJECT_LIST
    T_RSDIOBC LIKE RSDIOBC
    T_RSISOSMAP LIKE RSISOSMAP
    T_RSUPDINFO LIKE RSUPDINFO
    T_RSDVUNI LIKE RSDVUNI
    T_AGR_DEFINE LIKE AGR_DEFINE
    T_AGR_TEXTS LIKE AGR_TEXTS
    T_RSDCUBEMULTI LIKE RSDCUBEMULTI
    T_RSQTOBJ LIKE RSQTOBJ
    T_RSDKYF LIKE RSDKYF
    T_VSEOCLASS LIKE VSEOCLASS
    T_WDYN LIKE TRESN
    T_WDY_COMPONENTT LIKE WDY_COMPONENTT
  EXCEPTIONS
    RELEASE_2_0.





  TYPES: BEGIN OF ty_langu,
           langu TYPE langu,
         END OF ty_langu.
  DATA: lv_laiso TYPE laiso,
        ls_langu TYPE ty_langu,
        lt_langu TYPE TABLE OF ty_langu WITH KEY langu.

  TYPES: BEGIN OF ty_clas,
            sign TYPE rssign,
            option TYPE rsoption,
            low TYPE rslow,
            high TYPE rshigh,
         END OF ty_clas.
  DATA: ls_clas TYPE ty_clas,
        lt_clas TYPE TABLE OF ty_clas.

* Structure for ABAP Reports
  TYPES: BEGIN OF ty_reports,
             progname TYPE progname,
             devclass TYPE devclass,
             udat TYPE rdir_udate,
             unam TYPE unam,
          END OF ty_reports.
  DATA: ls_tresn TYPE tresn,
        lt_reports TYPE TABLE OF ty_reports.

* Structure for Web Dynpros
  TYPES: BEGIN OF ty_wdyn,
             component TYPE wdy_component_name,
             devclass TYPE devclass,
             changedon TYPE rdir_udate,
             changedby TYPE unam,
          END OF ty_wdyn.
  DATA:   lt_wdyn TYPE TABLE OF ty_wdyn.

* Data for APDs:
  DATA: ls_rsant_process TYPE rsant_process,
        lt_rsant_process TYPE STANDARD TABLE OF rsant_process,
        ls_object_list TYPE rso_s_object_list.


  DATA: timestmp_date TYPE d, timestmp_time TYPE t, tz TYPE ttzz-tzone.

  FIELD-SYMBOLS: <fs_devclass> TYPE tchlp,
                 <fs_language> TYPE tcp0h,
                 <fs_reports> TYPE ty_reports,
                 <fs_wdyn> TYPE ty_wdyn,
                 <fs_rsant_process> TYPE rsant_process.

* Fill internal table for selected languages
LOOP AT t_language ASSIGNING <fs_language>.
      lv_laiso = <fs_language>-laiso.
      TRANSLATE lv_laiso TO UPPER CASE.
      MODIFY t_language FROM lv_laiso.
ENDLOOP.

SELECT spras FROM t002 INTO TABLE lt_langu
  FOR ALL ENTRIES IN t_language
  WHERE laiso = t_language-laiso.


* Fill internal table for selected packages
  LOOP AT t_devclass ASSIGNING <fs_devclass>.
    ls_clas-sign = 'I'.
    ls_clas-option = 'CP'.
    ls_clas-low = <fs_devclass>-devclass.
    APPEND ls_clas TO lt_clas.
  ENDLOOP.


  IF timestmp IS INITIAL.
    timestmp = 0.
  ENDIF.

  tz = 'UTC'. "sy-zonlo.
  CONVERT TIME STAMP timestmp TIME ZONE tz
        INTO DATE timestmp_date TIME timestmp_time.


  IF sync_workbench = 'X' OR sync_reporting = 'X'.
* CUBE, only texts (RSDCUBE is synchr. from application)
    SELECT rsdcube~infocube t~langu t~txtsh t~txtlg FROM rsdcube "#EC CI_NO_TRANSFORM  "#EC CI_FAE_LINES_ENSURED
    INNER JOIN rsdcubet AS t "#EC CI_BUFFJOIN
    ON rsdcube~infocube = t~infocube
    AND rsdcube~objvers = t~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rsdcubet
      FOR ALL ENTRIES IN lt_langu
      WHERE
        rsdcube~objvers = 'A' AND
        rsdcube~cubetype <> 'A' AND
        rsdcube~infocube NOT LIKE '/CPMB/%' AND
        rsdcube~timestmp >= timestmp AND
        t~langu = lt_langu-langu.

* ODSO, only texts (RSDODSO is synchr. from application)
    SELECT rsdodso~odsobject t~langu t~txtsh t~txtlg FROM rsdodso  "#EC CI_NO_TRANSFORM
      INNER JOIN rsdodsot AS t "#EC CI_BUFFJOIN
     ON rsdodso~odsobject = t~odsobject
     AND rsdodso~objvers = t~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rsdodsot
      FOR ALL ENTRIES IN lt_langu
      WHERE
        rsdodso~objvers = 'A' AND
        rsdodso~timestmp >= timestmp AND
        t~langu = lt_langu-langu.

* ISET
    SELECT infoset timestmp tstpnm infoarea FROM rsqiset
      INTO CORRESPONDING FIELDS OF TABLE t_rsqiset WHERE
        objvers = 'A' AND
        timestmp >= timestmp.

    SELECT rsqiset~infoset t~langu t~txtsh t~txtlg FROM rsqiset "#EC CI_NO_TRANSFORM
      INNER JOIN rsqisett AS t "#EC CI_BUFFJOIN
     ON rsqiset~infoset = t~infoset
     AND rsqiset~objvers = t~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rsqisett
      FOR ALL ENTRIES IN lt_langu
      WHERE
        rsqiset~objvers = 'A' AND
        rsqiset~timestmp >= timestmp AND
        t~langu = lt_langu-langu.

* ALVL
    SELECT aggrlevel infoprov timestmp tstpnm infoarea FROM rspls_alvl "#EC CI_GENBUFF
      INTO CORRESPONDING FIELDS OF TABLE t_rspls_alvl WHERE
        objvers = 'A' AND
        timestmp >= timestmp.

    SELECT rspls_alvl~aggrlevel t~langu t~txtsh t~txtlg FROM rspls_alvl "#EC CI_NO_TRANSFORM
      INNER JOIN rspls_alvlt AS t "#EC CI_BUFFJOIN
     ON rspls_alvl~aggrlevel = t~aggrlevel
     AND rspls_alvl~objvers = t~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rspls_alvlt
      FOR ALL ENTRIES IN lt_langu
      WHERE
        rspls_alvl~objvers = 'A' AND
        rspls_alvl~timestmp >= timestmp AND
        t~langu = lt_langu-langu.

* PLSE
    SELECT srvnm infoprov timestmp tstpnm FROM rsplf_srv "#EC CI_GENBUFF
        INTO CORRESPONDING FIELDS OF TABLE t_rsplf_srv WHERE
          objvers = 'A' AND
          timestmp >= timestmp.

    SELECT rsplf_srv~srvnm t~langu t~txtlg FROM rsplf_srv "#EC CI_NO_TRANSFORM
      INNER JOIN rsplf_srvt AS t "#EC CI_BUFFJOIN
     ON rsplf_srv~srvnm = t~srvnm
     AND rsplf_srv~objvers = t~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rsplf_srvt
      FOR ALL ENTRIES IN lt_langu
      WHERE
        rsplf_srv~objvers = 'A' AND
        rsplf_srv~timestmp >= timestmp AND
        t~langu = lt_langu-langu.

* PLSQ
    SELECT seqnm timestmp tstpnm FROM rspls_sequence "#EC CI_GENBUFF
        INTO CORRESPONDING FIELDS OF TABLE t_rspls_sequence WHERE
          objvers = 'A' AND
          timestmp >= timestmp.

    SELECT rspls_sequence~seqnm t~langu t~txtlg FROM rspls_sequence  "#EC CI_NO_TRANSFORM
      INNER JOIN rspls_sequencet AS t "#EC CI_BUFFJOIN
     ON rspls_sequence~seqnm = t~seqnm
     AND rspls_sequence~objvers = t~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rspls_sequencet
      FOR ALL ENTRIES IN lt_langu
      WHERE
        rspls_sequence~objvers = 'A' AND
        rspls_sequence~timestmp >= timestmp AND
        t~langu = lt_langu-langu.

* SPOK (InfoSpokes)
    SELECT infospoke timestmp tstpnm ohsource FROM rsbspoke
      INTO CORRESPONDING FIELDS OF TABLE t_rsbspoke WHERE
        objvers = 'A' AND
        timestmp >= timestmp.

    SELECT rsbspoke~infospoke t~langu t~txtsh t~txtlg FROM rsbspoke "#EC CI_NO_TRANSFORM
      INNER JOIN rsbspoket AS t "#EC CI_BUFFJOIN
     ON rsbspoke~infospoke = t~infospoke
     AND rsbspoke~objvers = t~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rsbspoket
      FOR ALL ENTRIES IN lt_langu
      WHERE
        rsbspoke~objvers = 'A' AND
        rsbspoke~timestmp >= timestmp AND
        t~langu = lt_langu-langu.

* DEST (Destinations)
    SELECT ohdest desttype logsys timestmp tstpnm new_ohd infoarea
       FROM rsbohdest
      INTO CORRESPONDING FIELDS OF TABLE t_rsbohdest WHERE
        objvers = 'A' AND
        new_ohd = 'X' AND
        timestmp >= timestmp.

    SELECT rsbohdest~ohdest t~langu t~txtsh t~txtlg FROM rsbohdest "#EC CI_NO_TRANSFORM
      INNER JOIN rsbohdestt AS t "#EC CI_BUFFJOIN
     ON rsbohdest~ohdest = t~ohdest
     AND rsbohdest~objvers = t~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rsbohdestt
      FOR ALL ENTRIES IN lt_langu
      WHERE
        rsbohdest~objvers = 'A' AND
        new_ohd = 'X' AND
        rsbohdest~timestmp >= timestmp AND
        t~langu = lt_langu-langu.

  ENDIF.


  IF sync_apd = 'X'.
* ANPR (Analysis Process)
    SELECT process tstpnm timestmp appl FROM rsant_process  "#EC CI_NOFIRST
         INTO CORRESPONDING FIELDS OF TABLE lt_rsant_process WHERE
           objvers = 'A' AND
           timestmp >= timestmp.
    LOOP AT lt_rsant_process ASSIGNING <fs_rsant_process>.
      ls_object_list-tlogo = 'ANPR'.
      ls_object_list-objnm = <fs_rsant_process>-process.
      ls_object_list-tstpnm = <fs_rsant_process>-tstpnm.
      ls_object_list-timestmp = <fs_rsant_process>-timestmp.
      ls_object_list-txtlg = <fs_rsant_process>-appl.
      APPEND ls_object_list TO t_rsant_process.
    ENDLOOP.

    SELECT rsant_process~process t~spras t~txtsh t~txtlg  "#EC CI_NO_TRANSFORM
        FROM rsant_process
        INNER JOIN rsant_processt AS t
       ON rsant_process~process = t~process
       AND rsant_process~objvers = t~objvers
        INTO CORRESPONDING FIELDS OF TABLE t_rsant_processt
        FOR ALL ENTRIES IN lt_langu
        WHERE
          rsant_process~objvers = 'A' AND
          rsant_process~timestmp >= timestmp AND
          t~spras = lt_langu-langu.
  ENDIF.

*Synch InfoObject-Catalogs
  IF sync_iobjcat = 'X'.
* Catalogs
    SELECT * FROM rsdiobc
      INTO TABLE t_rsdiobc WHERE
      timestmp >= timestmp AND
        objvers = 'A'.


* Texts for Catalogs
    SELECT rsdiobc~infoobjcat t~langu t~txtsh t~txtlg FROM rsdiobc "#EC CI_NO_TRANSFORM
        INNER JOIN rsdiobct AS t "#EC CI_BUFFJOIN
       ON rsdiobc~infoobjcat = t~infoobjcat
       AND rsdiobc~objvers = t~objvers
        INTO CORRESPONDING FIELDS OF TABLE t_rsdiobct
        FOR ALL ENTRIES IN lt_langu
        WHERE
          rsdiobc~objvers = 'A' AND
          rsdiobc~timestmp >= timestmp AND
          t~langu = lt_langu-langu.
  ENDIF.


  IF sync_iobj = 'X' OR sync_workbench = 'X'.
    "Necessary when Workbench is synched (for Char-InfoProvider)!!
* IOBJ
    SELECT iobjnm iobjtp timestmp tstpnm FROM rsdiobj "#EC CI_GENBUFF
    INTO CORRESPONDING FIELDS OF TABLE t_rsdiobj WHERE
      objvers = 'A' AND
      timestmp >= timestmp.

    SELECT iobjnm langu txtsh txtlg FROM rsdiobjv "#EC CI_NO_TRANSFORM
         INTO CORRESPONDING FIELDS OF TABLE t_rsdiobjt
         FOR ALL ENTRIES IN lt_langu
         WHERE
           objvers = 'A' AND
           langu = lt_langu-langu AND
           timestmp >= timestmp.

*Characteristics are not synchr. here because in BW 7.4 the View
*RSDVCHA can't be added as table parameter (contains SSTRING)

  ENDIF.

  IF sync_iobj = 'X'.
* Details for KeyFigures
    SELECT * FROM rsdkyf AS k
              INNER JOIN rsdiobj "#EC CI_BUFFJOIN
              ON k~kyfnm = rsdiobj~iobjnm AND
              rsdiobj~objvers = k~objvers
              INTO CORRESPONDING FIELDS OF TABLE t_rsdkyf
              WHERE
                rsdiobj~timestmp >= timestmp AND
                rsdiobj~objvers = 'A'.

*Time Characteristics are not synchr. here because in BW 7.4 the
*View RSDVTIM can't be added as table parameter (contains SSTRING)


* Details for Units
    SELECT * FROM rsdvuni AS u
              INNER JOIN rsdiobj "#EC CI_BUFFJOIN
              ON u~uninm = rsdiobj~iobjnm AND
              rsdiobj~objvers = u~objvers
              INTO CORRESPONDING FIELDS OF TABLE t_rsdvuni
              WHERE
                rsdiobj~timestmp >= timestmp AND
                rsdiobj~objvers = 'A'.

  ENDIF.



  IF sync_reporting = 'X' OR sync_workbench = 'X'.
    "in case of workbench sync we also need to sync Queries because
    "Queries can be used in new BW releases also in Transformations!
* Queries must be read from v_rep_join because GENUNIID is needed!
    SELECT * FROM v_rep_join
       INTO TABLE t_v_rep_join WHERE
         objvers = 'A' AND
         deftp = 'REP' AND
         ( timestmp >= timestmp OR lastused >= timestmp ).

* Get all texts to reusable reporting components
    SELECT t~eltuid t~langu t~txtsh t~txtlg FROM rszcompdir "#EC CI_NO_TRANSFORM
         INNER JOIN rszelttxt AS t
         ON rszcompdir~compuid = t~eltuid
         AND rszcompdir~objvers = t~objvers
         INTO CORRESPONDING FIELDS OF TABLE t_v_eltdir_txt
         FOR ALL ENTRIES IN lt_langu
      WHERE
          rszcompdir~objvers = 'A' AND
          rszcompdir~timestmp >= timestmp AND
          t~langu = lt_langu-langu.
  ENDIF.

  IF sync_reporting = 'X'.
* Reusable KeyFigures, Structures and Filters
* V_COMPDIR_COMPIC delivers duplicates in case of diff. languages!
* better use V_CMP_JOIN
    SELECT DISTINCT compuid infocube compid
       version deftp timestmp tstpnm
    FROM v_compdir_compic
    INTO CORRESPONDING FIELDS OF TABLE t_v_rep_reuse
      WHERE
      objvers = 'A' AND
      timestmp >= timestmp AND (
      deftp = 'SOB' OR
      deftp = 'STR' OR
      deftp = 'SEL' OR
      deftp = 'CKF' ).

* Variables
    SELECT * FROM rszglobv INTO TABLE t_rszglobv
    WHERE
           objvers = 'A' AND
           timestmp >= timestmp.

* XLWB (Workbooks)
    SELECT * FROM rsrwbindex INTO TABLE t_rsrwbindex "#EC CI_NOFIRST
    WHERE objvers = 'A' AND
          timestmp >= timestmp.

    SELECT rsrwbindex~workbookid t~langu t~title FROM rsrwbindex "#EC CI_NO_TRANSFORM
          INNER JOIN rsrwbindext AS t
         ON rsrwbindex~workbookid = t~workbookid
         AND rsrwbindex~objvers = t~objvers
          INTO CORRESPONDING FIELDS OF TABLE t_rsrwbindext
          FOR ALL ENTRIES IN lt_langu
          WHERE
            rsrwbindex~objvers = 'A' AND
            rsrwbindex~timestmp >= timestmp AND
            t~langu = lt_langu-langu.


* BTMP (7.x WebTemplates)
    SELECT * FROM rszwbtmphead INTO TABLE t_rszwbtmphead "#EC CI_GENBUFF
    WHERE objvers = 'A' AND
         timestmp >= timestmp.

    SELECT t~objid t~langu t~txtlg FROM rszwbtmphead "#EC CI_NO_TRANSFORM
           INNER JOIN rszwbtmpheadtxt AS t "#EC CI_BUFFJOIN
          ON rszwbtmphead~objid = t~objid
          AND rszwbtmphead~objvers = t~objvers
           INTO CORRESPONDING FIELDS OF TABLE t_rszwbtmpheadtxt
           FOR ALL ENTRIES IN lt_langu
           WHERE
             rszwbtmphead~objvers = 'A' AND
             rszwbtmphead~timestmp >= timestmp AND
             t~langu = lt_langu-langu.

* TMPL (3.x WebTemplates)
    SELECT * FROM rszwtemplate INTO TABLE t_rszwtemplate
     WHERE objvers = 'A' AND
          timestmp >= timestmp.

    SELECT t~objid t~langu t~txtlg FROM rszwtemplate  "#EC CI_NO_TRANSFORM
           INNER JOIN rszwobjtxt AS t "#EC CI_BUFFJOIN
          ON rszwtemplate~tmplid = t~objid
          AND rszwtemplate~objvers = t~objvers
           INTO CORRESPONDING FIELDS OF TABLE t_rszwobjtxt
           FOR ALL ENTRIES IN lt_langu
           WHERE
             rszwtemplate~objvers = 'A' AND
             rszwtemplate~timestmp >= timestmp AND
             t~langu = lt_langu-langu.
  ENDIF.


  IF sync_workbench = 'X'.
* Source Systems
    SELECT * FROM rsbasidoc
     INTO TABLE t_rsbasidoc
    WHERE timestmp >= timestmp.


* ISFS (3.x DataSources)
*    SELECT * FROM rsoltpsource
*      INTO CORRESPONDING FIELDS OF TABLE rsoltpsource WHERE
*        objvers = 'A' AND
*        timestmp >= timestmp.

    SELECT s~oltpsource s~logsys s~type s~tstpnm s~timestmp
      FROM rsoltpsource AS s
      INNER JOIN rsisosmap AS m "#EC CI_BUFFJOIN
      ON s~oltpsource = m~oltpsource
        AND s~logsys = m~logsys
        AND s~objvers = m~objvers
    INTO CORRESPONDING FIELDS OF TABLE t_rsoltpsource
       WHERE
      s~objvers = 'A' AND
      s~timestmp >= timestmp.


    SELECT rsoltpsource~oltpsource rsoltpsource~logsys t~langu "#EC CI_NO_TRANSFORM
           t~txtsh t~txtlg
         FROM rsoltpsource
         INNER JOIN rsoltpsourcet AS t
        ON rsoltpsource~oltpsource = t~oltpsource
        AND rsoltpsource~logsys = t~logsys
        AND rsoltpsource~objvers = t~objvers
      INNER JOIN rsisosmap AS m "to get only DS used in 3.x Data Flows "#EC CI_BUFFJOIN
      ON rsoltpsource~oltpsource = m~oltpsource
        AND rsoltpsource~logsys = m~logsys
        AND rsoltpsource~objvers = m~objvers
         INTO CORRESPONDING FIELDS OF TABLE t_rsoltpsourcet  "#EC CI_NOFIRST
         FOR ALL ENTRIES IN lt_langu
         WHERE
           rsoltpsource~objvers = 'A' AND
           rsoltpsource~timestmp >= timestmp AND
           t~langu = lt_langu-langu.


* RSDS (7.x DS); Always full sync because this table is only relevant
* for getting version and date of change, the DataSources
* will be received  from table RSTRAN
    SELECT datasource logsys type applnm exstructure delta
           timestmp tstpnm
      FROM rsds
      INTO CORRESPONDING FIELDS OF TABLE t_rsds WHERE
        objvers = 'A'." AND timestmp >= timestmp.

    SELECT rsds~datasource rsds~logsys t~langu t~txtsh t~txtlg  "#EC CI_NO_TRANSFORM
      FROM rsds
      INNER JOIN rsdst AS t
     ON rsds~datasource = t~datasource
     AND rsds~logsys = t~logsys
     AND rsds~objvers = t~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rsdst
      FOR ALL ENTRIES IN lt_langu
      WHERE
        rsds~objvers = 'A' AND
        rsds~timestmp >= timestmp AND
        t~langu = lt_langu-langu.



* RSIS (3.x InfoSources)
    SELECT isource comstru timestmp tstpnm FROM rsis
      INTO CORRESPONDING FIELDS OF TABLE t_rsis WHERE
        objvers = 'A' AND
        timestmp >= timestmp.

    SELECT rsis~isource t~langu t~txtsh t~txtlg FROM rsis "#EC CI_NO_TRANSFORM
      INNER JOIN rsist AS t "#EC CI_BUFFJOIN
     ON rsis~isource = t~isource
     AND rsis~objvers = t~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rsist
      FOR ALL ENTRIES IN lt_langu
      WHERE
        rsis~objvers = 'A' AND
        rsis~timestmp >= timestmp AND
        t~langu = lt_langu-langu.


* TRCS (7.x InfoSources)
    SELECT isource timestmp tstpnm FROM rsksnew
        INTO CORRESPONDING FIELDS OF TABLE t_rsksnew WHERE
          objvers = 'A' AND
          timestmp >= timestmp.

    SELECT rsksnew~isource t~langu t~txtlg FROM rsksnew "#EC CI_NO_TRANSFORM
      INNER JOIN rsksnewt AS t "#EC CI_BUFFJOIN
     ON rsksnew~isource = t~isource
     AND rsksnew~objvers = t~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rsksnewt
      FOR ALL ENTRIES IN lt_langu
      WHERE
        rsksnew~objvers = 'A' AND
        rsksnew~timestmp >= timestmp AND
        t~langu = lt_langu-langu.

* 3.x Transfer Structures
    SELECT * FROM rsts
        INTO TABLE t_rsts WHERE
          objvers = 'A' AND
          timestmp >= timestmp.



* TRFN (7.x Transformations), only texts
    SELECT rstran~tranid t~langu t~txtsh t~txtlg FROM rstran "#EC CI_NO_TRANSFORM
      INNER JOIN rstrant AS t "#EC CI_BUFFJOIN
     ON rstran~tranid = t~tranid
     AND rstran~objvers = t~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rstrant
      FOR ALL ENTRIES IN lt_langu
      WHERE
        rstran~objvers = 'A' AND
        rstran~timestmp >= timestmp AND
        t~langu = lt_langu-langu.

* RSISOSMAP (Mapping between InfoSources and OLTP Sources, 3.x)
    "the timestamp in RSISOSMAP is not updated in SAP, so join on RSTS
    SELECT * FROM rsisosmap
      INNER JOIN rsts "#EC CI_BUFFJOIN
      ON rsisosmap~transtru = rsts~transtru
      AND rsisosmap~objvers = rsts~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rsisosmap
      WHERE
        rsisosmap~objvers = 'A' AND
        rsts~timestmp >= timestmp.


* RSUPDINFO (Mapping Infos for Update Rules, 3.x)
    SELECT * FROM rsupdinfo "#EC CI_NOFIRST
            INTO TABLE t_rsupdinfo WHERE
              objvers = 'A' AND
              timestmp >= timestmp.

* RSDCUBEMULTI
    SELECT m~infocube m~posit m~partcube FROM rsdcube AS c
    INNER JOIN rsdcubemulti AS m "#EC CI_BUFFJOIN
     ON m~infocube = c~infocube
     AND m~objvers = c~objvers
      INTO CORRESPONDING FIELDS OF TABLE t_rsdcubemulti WHERE
        c~objvers = 'A' AND
        m~infocube NOT LIKE '/CPMB/%' AND
        c~timestmp >= timestmp.

* RSQTOBJ (Table Objects in the InfoSet)
    SELECT t~infoset t~talias t~tname t~ttype FROM rsqiset AS i
    INNER JOIN rsqtobj AS t "#EC CI_BUFFJOIN
     ON i~infoset = t~infoset
     AND i~objvers = t~objvers
       INTO CORRESPONDING FIELDS OF TABLE t_rsqtobj WHERE
        i~objvers = 'A' AND
        i~timestmp >= timestmp AND
        t~ttype <> ''.


  ENDIF.


  IF sync_chains = 'X'.
* RSPC (Process Chains) -> no real date of change available,
* because running a chain activates it automatically!
    IF sync_bpc <> 'X'."BPC Module is not lic., exclude BPC chains
      SELECT chain_id timestmp tstpnm applnm FROM rspcchainattr
          INTO CORRESPONDING FIELDS OF TABLE t_rspcchainattr WHERE
            objvers = 'A' AND
            chain_id NOT LIKE '/CPMB/%' AND
            timestmp >= timestmp.

      SELECT rspcchainattr~chain_id t~langu t~txtlg FROM rspcchainattr "#EC CI_NO_TRANSFORM
        INNER JOIN rspcchaint AS t
       ON rspcchainattr~chain_id = t~chain_id
       AND rspcchainattr~objvers = t~objvers
        INTO CORRESPONDING FIELDS OF TABLE t_rspcchaint
        FOR ALL ENTRIES IN lt_langu
        WHERE
          rspcchainattr~objvers = 'A' AND
          rspcchainattr~chain_id NOT LIKE '/CPMB/%' AND
          rspcchainattr~timestmp >= timestmp AND
          t~langu = lt_langu-langu.
    ELSE.
      SELECT chain_id timestmp tstpnm applnm FROM rspcchainattr
                INTO CORRESPONDING FIELDS OF TABLE t_rspcchainattr
                WHERE objvers = 'A' AND timestmp >= timestmp.

      SELECT rspcchainattr~chain_id t~langu t~txtlg FROM rspcchainattr "#EC CI_NO_TRANSFORM
        INNER JOIN rspcchaint AS t
       ON rspcchainattr~chain_id = t~chain_id
       AND rspcchainattr~objvers = t~objvers
        INTO CORRESPONDING FIELDS OF TABLE t_rspcchaint
        FOR ALL ENTRIES IN lt_langu
        WHERE
          rspcchainattr~objvers = 'A' AND
          rspcchainattr~timestmp >= timestmp AND
          t~langu = lt_langu-langu.
    ENDIF.

  ENDIF.


  IF sync_func = 'X'.
* FUNC (Function Modules by dev-classes) View: INFO_FUNCT
* No language selection because elements might be missing if no
* description maintained in the chosen language
    SELECT funcname spras area pname include fmode devclass stext
          FROM info_funct
           INTO CORRESPONDING FIELDS OF TABLE t_func
            WHERE
               info_funct~devclass IN lt_clas.

*  select name sdate stime from trdir
*   into corresponding fields of table func where
*   SUBC = 'I' and
*  SDATE = timestmp_date and
*  stime >= timestmp_time.

* FUGR (Function Groups + texts by dev-classes)
* No language selection because elements might be missing if no
* description maintained in the chosen language
    SELECT * FROM info_fugrt
       INTO TABLE t_fugr WHERE
         devclass IN lt_clas.

  ENDIF.


  IF sync_prog = 'X'.
* PROG (ABAP Reports)
    SELECT tadir~obj_name tadir~devclass
           trdir~udat trdir~unam
     FROM tadir
      INNER JOIN trdir ON "#EC CI_BUFFJOIN
       tadir~obj_name = trdir~name
        INTO TABLE lt_reports
          WHERE
            tadir~pgmid = 'R3TR' AND
            tadir~object = 'PROG' AND
            tadir~devclass IN lt_clas AND
            trdir~udat >= timestmp_date.
    LOOP AT lt_reports ASSIGNING <fs_reports>.
      ls_tresn-obj_namelo = <fs_reports>-progname.
      ls_tresn-devclass = <fs_reports>-devclass.
      ls_tresn-moddate = <fs_reports>-udat.
      ls_tresn-author = <fs_reports>-unam.
      APPEND ls_tresn TO t_tadir_prog.
    ENDLOOP.

* PROG (Texts for ABAP Reports)
    SELECT trdirt~name trdirt~sprsl trdirt~text FROM trdirt "#EC CI_NO_TRANSFORM
    INNER JOIN tadir ON
      trdirt~name = tadir~obj_name
      INNER JOIN trdir ON  "#EC CI_BUFFJOIN
        trdirt~name = trdir~name
         INTO TABLE t_trdirt
          FOR ALL ENTRIES IN lt_langu
           WHERE
            sprsl = lt_langu-langu AND
            tadir~pgmid = 'R3TR' AND
            tadir~object = 'PROG' AND
            tadir~devclass IN lt_clas AND
            trdir~udat >= timestmp_date.
  ENDIF.

  IF sync_wdyn = 'X'.
* WDYN (Web Dynpros)
    SELECT tadir~obj_name tadir~devclass
           wdy_component~changedon wdy_component~changedby
     FROM tadir
      INNER JOIN wdy_component ON "#EC CI_BUFFJOIN
       tadir~obj_name = wdy_component~component_name
        INTO TABLE lt_wdyn
          WHERE
            tadir~pgmid = 'R3TR' AND
            tadir~object = 'WDYN' AND
            tadir~delflag <> 'X' AND
            tadir~devclass IN lt_clas AND
            wdy_component~version = 'A' AND
            wdy_component~type = '0' AND
            wdy_component~changedon >= timestmp_date.
    LOOP AT lt_wdyn ASSIGNING <fs_wdyn>.
      ls_tresn-obj_namelo = <fs_wdyn>-component.
      ls_tresn-devclass = <fs_wdyn>-devclass.
      ls_tresn-moddate = <fs_wdyn>-changedon.
      ls_tresn-author = <fs_wdyn>-changedby.
      APPEND ls_tresn TO t_wdyn.
    ENDLOOP.

* WDYN (Texts for Web Dynpros)
    SELECT  wdy_componentt~component_name wdy_componentt~langu "#EC CI_NO_TRANSFORM
            wdy_componentt~description
      FROM wdy_componentt
    INNER JOIN tadir ON
      wdy_componentt~component_name = tadir~obj_name
      INNER JOIN wdy_component ON "#EC CI_BUFFJOIN
        wdy_componentt~component_name = wdy_component~component_name
         INTO TABLE t_wdy_componentt
          FOR ALL ENTRIES IN lt_langu
           WHERE
            langu = lt_langu-langu AND
            wdy_component~version = 'A' AND
            wdy_component~type = '0' AND
            tadir~pgmid = 'R3TR' AND
            tadir~object = 'WDYN' AND
            tadir~delflag <> 'X' AND
            tadir~devclass IN lt_clas AND
            wdy_component~changedon >= timestmp_date.
  ENDIF.

  IF sync_clas = 'X'.
* CLAS (ABAP Classes), sync texts and tech. info together
    SELECT vseoclass~clsname vseoclass~langu vseoclass~descript
           vseoclass~changedby vseoclass~changedon tadir~devclass
       FROM vseoclass INNER JOIN tadir "#EC CI_BUFFJOIN
        ON vseoclass~clsname = tadir~obj_name
         INTO CORRESPONDING FIELDS OF TABLE t_vseoclass
           WHERE
            tadir~pgmid = 'R3TR' AND
            tadir~object = 'CLAS' AND
            tadir~devclass IN lt_clas AND
            vseoclass~version = '1' AND
            vseoclass~changedon >= timestmp_date.
  ENDIF.


  IF sync_auth = 'X'.
    SELECT mandt agr_name parent_agr change_usr change_tim change_dat
     FROM agr_define "#EC CI_GENBUFF
      INTO CORRESPONDING FIELDS OF TABLE t_agr_define
      WHERE agr_name NOT LIKE 'SAP%' AND
            change_dat >= timestmp_date.

    SELECT agr_texts~mandt agr_texts~agr_name agr_texts~spras "#EC CI_NO_TRANSFORM
           agr_texts~line agr_texts~text
      FROM agr_texts
      INNER JOIN agr_define ON "#EC CI_BUFFJOIN
       agr_define~mandt = agr_texts~mandt AND
       agr_define~agr_name = agr_texts~agr_name
      INTO TABLE t_agr_texts
       FOR ALL ENTRIES IN lt_langu
         WHERE
          spras = lt_langu-langu AND
          agr_texts~agr_name NOT LIKE 'SAP%' AND
          line = '00000' AND
          agr_define~change_dat >= timestmp_date.
  ENDIF.


ENDFUNCTION.

Z_RFC_READ_REPORT v1_1

Source Code of Z_RFC_READ_REPORT
ABAP
FUNCTION Z_RFC_READ_REPORT
  IMPORTING
    VALUE(PROGRAM) LIKE SY-REPID
  EXPORTING
    VALUE(SYSTEM) LIKE SY-SYSID
    VALUE(TRDIR) LIKE TRDIR
  TABLES
    QTAB LIKE BAPITGB
  EXCEPTIONS
    RELEASE_1_1
    NOT_AUTHORIZED.





  refresh qtab.
  read report program into qtab.
  select single * from trdir where name = program. "#EC CI_ALL_FIELDS_NEEDED
  system = sy-sysid.
*************New ADÜ_20250430
  IF sy-subrc <> 0.
"handled later in the Performer Suite
  ENDIF.
*************End ADÜ_20250430



endfunction.

Z_RFC_CODESCAN v2_3

Source Code of Z_RFC_CODESCAN
ABAP
FUNCTION Z_RFC_CODESCAN
  IMPORTING
    VALUE(I_CASE) TYPE RS_BOOL DEFAULT ''
    VALUE(I_SKIP_COMMENT) TYPE RS_BOOL DEFAULT 'X'
    VALUE(I_REGEX) TYPE RS_BOOL DEFAULT ''
    VALUE(I_UPDRU) TYPE RS_BOOL DEFAULT 'X'
    VALUE(I_TRANR) TYPE RS_BOOL DEFAULT 'X'
    VALUE(I_TRANS) TYPE RS_BOOL DEFAULT 'X'
    VALUE(I_IOBJROUT) TYPE RS_BOOL DEFAULT 'X'
    VALUE(I_IP) TYPE RS_BOOL OPTIONAL
    VALUE(I_DTP) TYPE RS_BOOL OPTIONAL
    VALUE(I_REPS) TYPE RS_BOOL OPTIONAL
    VALUE(I_CLAS) TYPE RS_BOOL OPTIONAL
    VALUE(I_FUNC) TYPE RS_BOOL OPTIONAL
    VALUE(I_PLSE) TYPE RS_BOOL OPTIONAL
  TABLES
    T_STRING_RANGE LIKE RSRANGE
    T_DEVCL_RANGE LIKE RSRANGE
    T_REPS_RANGE LIKE RSRANGE
    T_SUBC_RANGE LIKE RSRANGE
    T_CLAS_RANGE LIKE RSRANGE
    T_FUGR_RANGE LIKE RSRANGE
    DATA LIKE TAB512
  EXCEPTIONS
    RELEASE_2_3
    INPUT_CANNOT_BE_TREATED
    NOT_AUTHORIZED.



  data:
    ls_data            like line of data,
    ls_result          type s_result,
    ls_line            type c length 255,
    lv_nspacegen       type namespace,
    lv_name_w_o_prefix type rs_char30,
    lt_string          type t_string,
    ls_string          type s_string.

  field-symbols:
    <string>  type s_string,
    <s_range> type rsrange.

*--------------------------------------------------------------------

  clear:
    gt_rsaabap,
    gt_object,
    gt_result.

  loop at t_string_range assigning <s_range>.

    if ( <s_range>-high = 'ODSO' or <s_range>-high = 'CUBE'
      or <s_range>-high = 'CHAR' or <s_range>-high = 'IOBJ')
      or <s_range>-high = 'ADSO'. "ADü_20189424 - DP-96
      call function 'RSD_NSPACE_PAR_GET_FROM_NAME'
        exporting
          i_objnm           = <s_range>-low
        importing
*         E_NAMESPACE       =
          e_nspacegen       = lv_nspacegen
*         E_SYSTP           =
          e_name_w_o_prefix = lv_name_w_o_prefix
*         E_SOBJNM_W_O_PREFIX =
        exceptions
          name_error        = 1
          others            = 2.

      if sy-subrc = 0.
        "regular expressions: the . is a placeholder for a single sign
        if <s_range>-high = 'ODSO'.
          "sign after prefix is A
          concatenate lv_nspacegen 'A' lv_name_w_o_prefix '.0'
           into ls_string.
          "Start Change ADü_20189424 - DP-96
        elseif <s_range>-high = 'ADSO'.
          "sign after prefix is A
          concatenate lv_nspacegen 'A' lv_name_w_o_prefix '.'
           into ls_string.
          "End Change ADü_20189424 - DP-96
        elseif <s_range>-high = 'CUBE'.
          "sign after prefix can be D,E or F
          concatenate lv_nspacegen '.' lv_name_w_o_prefix
           into ls_string.
        elseif ( <s_range>-high = 'CHAR' or <s_range>-high = 'IOBJ' ).
          concatenate lv_nspacegen '.' lv_name_w_o_prefix
           into ls_string.

          "Start Change ADü_20180426 - DP-1945
          data: ls_string2 type s_string,
                ls_string3 type s_string,
                ls_fieldnm type rsdiobjfieldnm.

          select single fieldnm
            from rsdiobj
              into ls_fieldnm
                where iobjnm  = <s_range>-low
                  and objvers = 'A'.
*************New ADÜ_20250430
          IF sy-subrc <> 0.
            "handled later in the Performer Suite
          ENDIF.
*************End ADÜ_20250430

          if ls_fieldnm is not initial.

            concatenate '-' ls_fieldnm '\.' into ls_string2.
            append ls_string2 to lt_string.
            concatenate '-' ls_fieldnm '\s' into ls_string3.
            append ls_string3 to lt_string.

          endif.
          "End Change ADü_20180426 - DP-1945

        endif.
      endif.
    else.
      ls_string = <s_range>-low.
    endif.

    append ls_string to lt_string.

  endloop.


  if i_updru = 'X' or i_tranr = 'X' or i_trans = 'X'
     or i_iobjrout = 'X'.
    perform scan_rsaabap
      tables lt_string
      using i_skip_comment i_case i_regex i_updru
            i_tranr i_trans i_iobjrout.
  endif.

  if i_dtp = 'X'.
*BEGIN New ADü_20250328
    authority-check object 'S_RS_DTP'
     id 'RSTLDTPSRC' field '*'
     id 'RSSTDTPSRC' field '*'
     id 'RSONDTPSRC' field '*'
     id 'RSTLDTPTGT' field '*'
     id 'RSSTDTPTGT' field '*'
     id 'RSONDTPTGT' field '*'
     id 'ACTVT' field '03'.
    if sy-subrc <> 0.
      raise not_authorized.
    else.
*END New ADü_20250328
      perform scan_dtp
      tables lt_string t_devcl_range
      using i_skip_comment i_case i_regex.
*BEGIN New ADü_20250328
    endif.
*END New ADü_20250328
  endif.

  if i_ip = 'X'.
    perform scan_ip
      tables lt_string t_devcl_range
      using i_skip_comment i_case i_regex.
  endif.

  if i_reps = 'X'.
    perform get_reps
      tables t_devcl_range t_reps_range t_subc_range.
  endif.

  if i_clas = 'X'.
    perform get_clas
      tables t_devcl_range t_clas_range.
  endif.

  if i_func = 'X'.
    perform get_func
    tables t_devcl_range t_fugr_range.
  endif.

  if i_plse = 'X'.
    perform get_plse
    tables lt_string t_devcl_range
      using i_skip_comment i_case i_regex.
  endif.


  if not gt_object is initial.
    perform scan_include_code
      tables lt_string
        using i_skip_comment i_case i_regex.
  endif.

  "Fill result table
  loop at gt_result into ls_result.
    if i_skip_comment = 'X'.
      if ls_result-line(1) = '*'.
        continue.
      else.
        ls_line = ls_result-line.
        shift ls_line left deleting leading space.
        "Start change ADü_20180618 - DP-1210
        "AMDP Code
        if   ls_result-routinetype = 'RT20'
          or ls_result-routinetype = 'RT21'
          or ls_result-routinetype = 'RT22'
          or ls_result-routinetype = 'RT23'
          or ls_result-routinetype = 'RT24'
          or ls_result-routinetype = 'RT30'
          or ls_result-routinetype = 'RT31'
          or ls_result-routinetype = 'RT32'
          or ls_result-routinetype = 'RT33'.
          if ls_line(2) = '--'.
            continue.
          endif.
          "ABAP Code
        else.
          "End change ADü_20180618 - DP-1210
          if ls_line(1) = '"'.
            continue.
          endif.
          "Start change ADü_20180618 - DP-1210
        endif.
        "End change ADü_20180618 - DP-1210
      endif.
    endif.
    ls_data = ls_result.
    append ls_data to data.

  endloop.

endfunction.


*&--------------------------------------------------------------------*
*&      Form  scan_rsaabap
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form scan_rsaabap
    tables lt_string
    using i_skip_comment i_case i_regex i_updru i_tranr
           i_trans i_iobjrout.

  types:
    begin of s_lookup,
      targetname    type rstran-targetname,
      targettype    type rstran-targettype,
      targetsubtype type rstran-targetsubtype,
      sourcename    type rstran-sourcename,
      sourcetype    type rstran-sourcetype,
      sourcesubtype type rstran-sourcesubtype,
      codeid        type rsaabap-codeid,
      tranid        type rstran-tranid,
      set_runtime   type char1,
      iobjnm        type rsupdrout-iciobjnm,
      routinetype   type c length 4,
      routine       type n length 4,
    end of s_lookup,
    t_lookup type standard table of s_lookup.

  data:
    l_tabix          like sy-tabix,
    lt_rsaabap       type t_rsaabap,
    ls_rsaabap       type s_rsaabap,
    ls_match_result  type match_result,
    lt_lookup_finder type t_lookup,
    ls_lookup_temp   type s_lookup,
    lt_lookup_temp   type t_lookup,
    ls_lookup        type s_lookup,
    l_updtype        like rsupddat-updtype,
    ls_result        type s_result,
    lv_txtlg         type rstxtlg.

  field-symbols:
    <string>  type s_string,
    <s_range> type rsrange.


  clear gt_rsaabap.
* Restrict on version M, because RSAABAP contains deleted coding
* that exists only in version A but not in version M!
  select a~codeid codetp line_no line
    from              rsaabap  as a
      inner join      rsarout  as r
    on a~codeid = r~codeid and a~objvers = r~objvers
    into corresponding fields of table gt_rsaabap
    where a~objvers = 'A'
    and a~codeid in (
      select codeid from rsarout
        where objvers = 'M').                               "#EC *

  "Start Change ADü_20180618 - DP-1210
  data: lv_rstranscript     type string value 'RSTRANSCRIPT',
        lv_rstranstepscript type string value 'RSTRANSTEPSCRIPT',
        lv_rstransteprout   type string value 'RSTRANSTEPROUT',
        lv_bwrelease        type saprelease,
        lv_bw4hana          type rs_bool value ''.

  types: begin of lty_sscript,
           tranid  type rstranid,
           script  type string,
           ruleid  type rstran_ruleid,
           stepid  type rstran_stepid,
           codeid  type rscodeid,
           line_no type rsaabap-line_no,
         end of lty_sscript,

         begin of lty_script,
           tranid  type rstranid,
           procnm  type char30,
           codeid  type rscodeid,
           script  type string,
           line_no type rsaabap-line_no,
         end of lty_script,

         begin of lty_rstransteprout,
           tranid   type rstranid,
           ruleid   type rstran_ruleid,
           stepid   type rstran_stepid,
           codeid   type rscodeid,
           on_hana  type rs_bool,
           line_no  type rsaabap-line_no,
           kind     type char7,
           code     type string,
           code_inv type string,
         end of lty_rstransteprout.

  data: ls_script           type lty_script,
        ls_g_script         type lty_script,
        ls_sscript          type lty_sscript,
        ls_g_sscript        type lty_sscript,
        lt_script           type table of lty_script,
        lt_g_script         type table of lty_script,
        lt_sscript          type table of lty_sscript,
        lt_g_sscript        type table of lty_sscript,
        ls_rstransteprout   type lty_rstransteprout,
        ls_g_rstransteprout type lty_rstransteprout,
        lt_rstransteprout   type table of lty_rstransteprout,
        lt_g_rstransteprout type table of lty_rstransteprout,
        lt_cvers type table of cvers.

****************New ALU 20250701
SELECT component release
  FROM cvers
  INTO TABLE lt_cvers.
* Versuch SAP_BW zu finden
CLEAR lv_bwrelease.
LOOP AT lt_cvers INTO DATA(ls_cvers).
  IF ls_cvers-component = 'SAP_BW'.
    lv_bwrelease = ls_cvers-release.
    EXIT. "#EC CI_NOORDER
  ENDIF.
ENDLOOP.

* Wenn nichts gefunden → BW/4HANA prüfen
IF lv_bwrelease IS INITIAL.
  lv_bw4hana = rs_c_true.

  LOOP AT lt_cvers INTO ls_cvers.
    IF ls_cvers-component = 'DW4CORE'.
      lv_bwrelease = ls_cvers-release.
      EXIT. "#EC CI_NOORDER
    ENDIF.
  ENDLOOP.
ENDIF.
****************End ALU 20250701 Onapsis Change

  if lv_bw4hana = rs_c_false.
    if lv_bwrelease < 740. "#EC NUMBER_OK
      "nothing
    elseif lv_bwrelease >= 740 and lv_bwrelease < 750. "#EC NUMBER_OK

      select tranid procnm script
        from (lv_rstranscript)
          into corresponding fields of table lt_script
            where objvers = 'A'.

    elseif lv_bwrelease >= 750. "#EC NUMBER_OK

      select tranid procnm script
            from (lv_rstranscript)
              into corresponding fields of table lt_script
                where objvers = 'A'.

      select tranid ruleid stepid codeid script
            from (lv_rstranstepscript)
              into corresponding fields of table lt_sscript
                where objvers = 'A'.
    endif.
  elseif lv_bw4hana = rs_c_true.
    select tranid ruleid stepid codeid code code_inv
      from (lv_rstransteprout)
        into corresponding fields of table lt_rstransteprout
          where objvers = 'A'.
  endif.
  "End Change ADü_20180618 - DP-1210

  "Start Change ADü_20180426 - DP-1945
  data: ls_complstring type string.
  loop at lt_string assigning <string>.
    if sy-tabix = 1.
      ls_complstring = <string>.
    else.
      concatenate ls_complstring '|' <string> into ls_complstring.
    endif.
  endloop.
  "End Change ADü_20180426 - DP-1945

  sort gt_rsaabap by codeid.
  loop at gt_rsaabap into ls_rsaabap.
    l_tabix = sy-tabix.
    "LOOP AT lt_string ASSIGNING <string>. "ADü_20180426 - DP-1945
    clear ls_match_result.
    if i_case = ' ' and i_regex = 'X'.
      find first occurrence of regex ls_complstring "<string> "ADü_20180426 - DP-1945
      in ls_rsaabap-line
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = 'X'.
      find first occurrence of regex ls_complstring "<string> "ADü_20180426 - DP-1945
      in ls_rsaabap-line
        in character mode
        respecting case
        results ls_match_result.
    elseif i_case = ' ' and i_regex = ''.
      find first occurrence of ls_complstring "<string> "ADü_20180426 - DP-1945
      in ls_rsaabap-line
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = ''.
      find first occurrence of ls_complstring "<string> "ADü_20180426 - DP-1945
      in ls_rsaabap-line
        in character mode
        respecting case
        results ls_match_result.
    endif.
    if sy-subrc <> 0.
      delete gt_rsaabap index l_tabix.
    endif.
    "ENDLOOP. "ADü_20180426 - DP-1945
  endloop.

  "Start Change ADü_20180618 - DP-1210
  "get the full scripts with comments:
  class cl_oo_include_naming definition load.
  data lo_clif_incl_naming  type ref to if_oo_clif_incl_naming.
  data lo_class_incl_naming type ref to if_oo_class_incl_naming.
  data l_t_method_w_include type seop_methods_w_include.
  field-symbols: <s_method_w_include> type seop_method_w_include.
  data: l_clskey type seoclskey,
        lt_abap  type abaptxt255_tab,
        ls_abap  type line of abaptxt255_tab,
        length   type i,
        last     type char30.

  "HANA Script
  loop at lt_script into ls_script.

    concatenate '/BIC/' ls_script-procnm+3 into l_clskey.

    call method cl_oo_include_naming=>get_instance_by_cifkey
      exporting
        cifkey         = l_clskey
      receiving
        cifref         = lo_clif_incl_naming
      exceptions
        no_objecttype  = 1
        internal_error = 2
        others         = 3.

    if sy-subrc = 0.
      lo_class_incl_naming ?= lo_clif_incl_naming.
      l_t_method_w_include =
        lo_class_incl_naming->get_all_method_includes( ).
      loop at l_t_method_w_include assigning <s_method_w_include>.
        clear: length, last.
        length = strlen( <s_method_w_include>-cpdkey ) - 9.
        last = <s_method_w_include>-cpdkey+length.
        if last = 'PROCEDURE'.
          clear lt_abap.
          read report <s_method_w_include>-incname into lt_abap.
          loop at lt_abap into ls_abap.
            ls_g_script-tranid   = ls_script-tranid.
            ls_g_script-procnm   = ls_script-procnm.
            ls_g_script-codeid   = ls_script-procnm+3.
            ls_g_script-script   = ls_abap.
            ls_g_script-line_no  = sy-tabix.
            append ls_g_script to lt_g_script.
          endloop.
        endif.
      endloop.
    endif.
  endloop.

  "AMDP
  loop at lt_sscript into ls_sscript.

    concatenate '/BIC/' ls_sscript-codeid into l_clskey.

    call method cl_oo_include_naming=>get_instance_by_cifkey
      exporting
        cifkey         = l_clskey
      receiving
        cifref         = lo_clif_incl_naming
      exceptions
        no_objecttype  = 1
        internal_error = 2
        others         = 3.

    if sy-subrc = 0.
      lo_class_incl_naming ?= lo_clif_incl_naming.
      l_t_method_w_include =
        lo_class_incl_naming->get_all_method_includes( ).
      loop at l_t_method_w_include assigning <s_method_w_include>.
        clear: length, last.
        length = strlen( <s_method_w_include>-cpdkey ) - 9.
        last = <s_method_w_include>-cpdkey+length.
        if last = 'PROCEDURE'.
          clear lt_abap.
          read report <s_method_w_include>-incname into lt_abap.
          loop at lt_abap into ls_abap.
            ls_g_sscript-tranid   = ls_sscript-tranid.
            ls_g_sscript-codeid   = ls_sscript-codeid.
            ls_g_sscript-script   = ls_abap.
            ls_g_sscript-line_no  = sy-tabix.
            append ls_g_sscript to lt_g_sscript.
          endloop.
        endif.
      endloop.
    endif.
  endloop.

  "BW4HANA
  loop at lt_rstransteprout into ls_rstransteprout.
    clear lt_abap.
    split ls_rstransteprout-code at cl_abap_char_utilities=>newline into table lt_abap.
    loop at lt_abap into ls_abap.
      ls_g_rstransteprout-tranid   = ls_rstransteprout-tranid.
      ls_g_rstransteprout-codeid   = ls_rstransteprout-codeid.
      ls_g_rstransteprout-code     = ls_abap.
      ls_g_rstransteprout-line_no  = sy-tabix.
      append ls_g_rstransteprout to lt_g_rstransteprout.
    endloop.
  endloop.

  "Search code in new tables:
  "RSTRANSCRIPT
  loop at lt_g_script into ls_g_script.
    l_tabix = sy-tabix.
    clear ls_match_result.
    if i_case = ' ' and i_regex = 'X'.
      find first occurrence of regex ls_complstring
      in ls_g_script-script
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = 'X'.
      find first occurrence of regex ls_complstring
      in ls_g_script-script
        in character mode
        respecting case
        results ls_match_result.
    elseif i_case = ' ' and i_regex = ''.
      find first occurrence of ls_complstring
      in ls_g_script-script
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = ''.
      find first occurrence of ls_complstring
      in ls_g_script-script
        in character mode
        respecting case
        results ls_match_result.
    endif.
    if sy-subrc <> 0.
      delete lt_g_script index l_tabix.
    endif.
  endloop.

  "RSTRANSTEPSCRIPT
  loop at lt_g_sscript into ls_g_sscript.
    l_tabix = sy-tabix.
    clear ls_match_result.
    if i_case = ' ' and i_regex = 'X'.
      find first occurrence of regex ls_complstring
      in ls_g_sscript-script
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = 'X'.
      find first occurrence of regex ls_complstring
      in ls_g_sscript-script
        in character mode
        respecting case
        results ls_match_result.
    elseif i_case = ' ' and i_regex = ''.
      find first occurrence of ls_complstring
      in ls_g_sscript-script
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = ''.
      find first occurrence of ls_complstring
      in ls_g_sscript-script
        in character mode
        respecting case
        results ls_match_result.
    endif.
    if sy-subrc <> 0.
      delete lt_g_sscript index l_tabix.
    endif.
  endloop.
  "End Change ADü_20180618 - DP-1210

  "RSTRANSTEPROUT
  sort lt_g_rstransteprout by codeid.
  loop at lt_g_rstransteprout into ls_g_rstransteprout.
    l_tabix = sy-tabix.
    clear ls_match_result.
    if i_case = ' ' and i_regex = 'X'.
      find first occurrence of regex ls_complstring
      in ls_g_rstransteprout-code
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = 'X'.
      find first occurrence of regex ls_complstring
      in ls_g_rstransteprout-code
        in character mode
        respecting case
        results ls_match_result.
    elseif i_case = ' ' and i_regex = ''.
      find first occurrence of ls_complstring
      in ls_g_rstransteprout-code
        in character mode
        ignoring case
        results ls_match_result.
    elseif i_case = 'X' and i_regex = ''.
      find first occurrence of ls_complstring
      in ls_g_rstransteprout-code
        in character mode
        respecting case
        results ls_match_result.
    endif.
    if sy-subrc <> 0.
      delete lt_g_rstransteprout  index l_tabix.
    endif.
  endloop.


  if gt_rsaabap is initial.
    "Start Change ADü_20180618 - DP-1210
    if lt_g_script is initial and lt_g_sscript is initial.
      "End Change ADü_20180618 - DP-1210
      if lt_g_rstransteprout is initial.
        return.
      endif.
      "Start Change ADü_20180618 - DP-1210
    endif.
    "End Change ADü_20180618 - DP-1210
  endif.

  "----------------------------------------------------------------
  " Scan routines of Update Rules (3.x)
  "----------------------------------------------------------------
  if i_updru = 'X'.

    types:
      begin of s_rsupd,
        updid    like rsupdinfo-updid,
        infocube like rsupdinfo-infocube,
        isource  like rsupdinfo-isource,
        codeid   like rsupdrout-codeid,
        routine  like rsupdrout-routine,
        iciobjnm like rsupdrout-iciobjnm,
      end of s_rsupd,
      t_rsupd type standard table of s_rsupd.

    data: lt_rsupd type t_rsupd.

    field-symbols <s_rsupd> type s_rsupd.

    clear lt_rsaabap.
    loop at gt_rsaabap into ls_rsaabap where codetp = 'UR'.
      append ls_rsaabap to lt_rsaabap.
    endloop.
    if not lt_rsaabap is initial.

      clear lt_lookup_temp.
      select a~updid infocube isource codeid routine iciobjnm
        into table lt_rsupd
        from rsupdinfo as a
        inner join rsupdrout as b on a~updid = b~updid
        for all entries in lt_rsaabap
          where
            b~codeid  = lt_rsaabap-codeid and
            a~objvers = 'A'               and
            b~objvers = 'A'.

      loop at lt_rsupd assigning <s_rsupd>.
        ls_lookup_temp-targetname = <s_rsupd>-infocube.
        ls_lookup_temp-sourcename = <s_rsupd>-isource.
        ls_lookup_temp-codeid = <s_rsupd>-codeid.
        if <s_rsupd>-routine = '9998'.
          ls_lookup_temp-routinetype = 'RT07'.
        elseif <s_rsupd>-routine = '9999'.
          ls_lookup_temp-routinetype = 'RT09'.
        else.
          ls_lookup_temp-routinetype = 'RT08'.
        endif.
        ls_lookup_temp-routine = <s_rsupd>-routine.
        ls_lookup_temp-tranid = <s_rsupd>-updid.
        ls_lookup_temp-iobjnm = <s_rsupd>-iciobjnm.
        append ls_lookup_temp to lt_lookup_temp.
      endloop.

      sort lt_lookup_temp by codeid.
      loop at lt_rsaabap into ls_rsaabap.

        clear ls_lookup.
        read table lt_lookup_temp into ls_lookup
        with key codeid = ls_rsaabap-codeid binary search.
        if sy-subrc = 0.
          clear l_updtype.
          select single updtype into l_updtype from rsupddat
            where
              updid   = ls_lookup-tranid and
              objvers = 'A'              and
              routine = ls_lookup-routine.              "#EC CI_NOORDER

          "no update
          if l_updtype = 'NOP'.
            delete lt_rsaabap.
          else.
            clear ls_result.
            move-corresponding ls_lookup  to ls_result.
            move-corresponding ls_rsaabap to ls_result.
            "Derive description of the Update Rule
            concatenate ls_lookup-targetname ls_lookup-sourcename
                        into ls_result-txtlg separated by space.
            append ls_result to gt_result.
          endif.
        endif.

      endloop.

    endif.
  endif.

  "----------------------------------------------------------------
  " Scan routines of Transfer Rules (3.x)
  "----------------------------------------------------------------
  if i_tranr = 'X'.
    TYPES:
      BEGIN OF ty_rstsrules,"relevant for InfoObject Routines
        transtru     LIKE rstsrules-transtru,
        comstru      LIKE rstsrules-comstru,
        iobjnm       LIKE rstsrules-iobjnm,
        convrout_l   LIKE rstsrules-convrout_l,
        startroutine LIKE rsts-startroutine,
      END OF ty_rstsrules,
      t_rstsrules TYPE STANDARD TABLE OF ty_rstsrules.

    DATA lt_rstsrules TYPE t_rstsrules.
    FIELD-SYMBOLS <s_rstsrules> TYPE ty_rstsrules.

    TYPES:
      BEGIN OF ty_rsts,"relevant for Startroutine and Global code
        transtru     LIKE rsts-transtru,
        odsname      LIKE rsts-odsname,
        glbcode      LIKE rsts-glbcode,
        startroutine LIKE rsts-startroutine,
      END OF ty_rsts,
      t_rsts TYPE STANDARD TABLE OF ty_rsts.

    DATA lt_rsts TYPE t_rsts.
    FIELD-SYMBOLS <s_rsts> TYPE ty_rsts.


    clear lt_rsaabap.
    loop at gt_rsaabap into ls_rsaabap where codetp = 'TR'.
      append ls_rsaabap to lt_rsaabap.
    endloop.
    if not lt_rsaabap is initial.

      clear lt_lookup_temp.

      SELECT transtru comstru iobjnm convrout_l
        INTO TABLE lt_rstsrules
        FROM rstsrules
        FOR ALL ENTRIES IN lt_rsaabap
        WHERE
          convrout_l = lt_rsaabap-codeid AND
          objvers    = 'A'.                                 "#EC *

      SELECT transtru odsname glbcode startroutine
      INTO TABLE lt_rsts
      FROM rsts
      FOR ALL ENTRIES IN lt_rsaabap
      WHERE
        ( glbcode = lt_rsaabap-codeid OR
        startroutine = lt_rsaabap-codeid )
        AND
        objvers    = 'A'.

      CLEAR ls_lookup_temp.
      LOOP AT lt_rstsrules ASSIGNING <s_rstsrules>.
        ls_lookup_temp-tranid = <s_rstsrules>-transtru.
        ls_lookup_temp-codeid = <s_rstsrules>-convrout_l.
        ls_lookup_temp-iobjnm = <s_rstsrules>-iobjnm.
        APPEND ls_lookup_temp TO lt_lookup_temp.
      ENDLOOP.

      CLEAR ls_lookup_temp.
      LOOP AT lt_rsts ASSIGNING <s_rsts>.
        ls_lookup_temp-tranid = <s_rsts>-transtru.
        ls_lookup_temp-iobjnm = ''.
        IF <s_rsts>-glbcode IS NOT INITIAL.
          ls_lookup_temp-codeid = <s_rsts>-glbcode.
          ls_lookup_temp-routinetype = 'RT12'.
          APPEND ls_lookup_temp TO lt_lookup_temp.
        ENDIF.
        IF <s_rsts>-startroutine IS NOT INITIAL.
          ls_lookup_temp-codeid = <s_rsts>-startroutine.
          ls_lookup_temp-routinetype = 'RT10'.
          APPEND ls_lookup_temp TO lt_lookup_temp.
        ENDIF.
      ENDLOOP.

      sort lt_lookup_temp by codeid.
      loop at lt_rsaabap into ls_rsaabap.
        clear ls_lookup.
        read table lt_lookup_temp into ls_lookup
        with key codeid = ls_rsaabap-codeid binary search.
        if sy-subrc = 0.
          clear ls_result.
          if ls_lookup-iobjnm is not initial.
            ls_lookup-routinetype = 'RT11'.
          endif.
          move-corresponding ls_lookup  to ls_result.
          move-corresponding ls_rsaabap to ls_result.

          append ls_result to gt_result.
        endif.
      endloop.

    endif.
  endif.

  "----------------------------------------------------------------
  " Scan routines of Transformations (7.x)
  "----------------------------------------------------------------
  if i_trans = 'X'.

    clear lt_rsaabap.
    loop at gt_rsaabap into ls_rsaabap where codetp = 'TF'.
      append ls_rsaabap to lt_rsaabap.
    endloop.
    if not lt_rsaabap is initial.

      "------- Transformations (rules)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype codeid a~tranid fieldnm
        into table lt_lookup_temp
        from rstran as a
        inner join rstranroutmap as b on a~tranid = b~tranid
        for all entries in lt_rsaabap
        where
          expert    = ''                and
          b~codeid  = lt_rsaabap-codeid and
          a~objvers = 'A'               and
          b~objvers = 'A'               and
          param_id  = 1                 and
          paramtype = 1.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT04'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations (start routine)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype startroutine tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_rsaabap
        where
          startroutine = lt_rsaabap-codeid and
          objvers      = 'A'.                               "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT01'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations (end routine)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
        sourcesubtype endroutine tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_rsaabap
        where
          endroutine = lt_rsaabap-codeid and
          objvers    = 'A'.                                 "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT02'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations (expert routine)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype expert tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_rsaabap
        where
          expert  = lt_rsaabap-codeid and
          objvers = 'A'.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT03'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations (Global declaration part 1)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype glbcode tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_rsaabap
        where
          glbcode = lt_rsaabap-codeid and
          objvers = 'A'.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT05'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations (Global declaration part 2)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype glbcode2 tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_rsaabap
        where
          glbcode2 = lt_rsaabap-codeid and
          objvers  = 'A'.                                   "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT06'.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "-------
      sort lt_lookup_finder by codeid.
      loop at lt_rsaabap into ls_rsaabap.
        clear ls_lookup.
        read table lt_lookup_finder into ls_lookup
         with key codeid = ls_rsaabap-codeid binary search.
        if sy-subrc = 0.
          clear ls_result.
          if ls_lookup-sourcetype = 'RSDS'.
            condense ls_lookup-sourcename.
          endif.
          move-corresponding ls_lookup  to ls_result.
          move-corresponding ls_rsaabap to ls_result.
          "Get description of Transformation
          clear lv_txtlg.
*************New ALU_20250630
          PERFORM get_txtlg USING ls_lookup-tranid CHANGING lv_txtlg.
*************End ALU_20250630
          if sy-subrc <> 0.
            "If no text found derive description of the Transformation
            concatenate ls_lookup-sourcetype ls_lookup-sourcename '->'
                        ls_lookup-targettype ls_lookup-targetname
                         into lv_txtlg separated by space.
          endif.
          ls_result-txtlg = lv_txtlg.

          append ls_result to gt_result.
        endif.
      endloop.
    endif.

    "Start Change ADü_20180618 - DP-1210
    "handle AMDP Scripts
    "RT20 -> HANA Script (Expert Routine)
    "RT21 -> AMDP Start Routine
    "RT22 -> AMDP End Routine
    "RT23 -> AMDP Expert Routine
    "RT24 -> AMDP InfoObject Routine

    "HANA Script
    if lt_g_script is not initial.
      clear lt_lookup_finder.
      "------- Transformations - HANA Script (Expert Routine)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype tranid
        into corresponding fields of table lt_lookup_temp
        from rstran
        for all entries in lt_g_script
        where tranid  = lt_g_script-tranid
        and   objvers = 'A'.                                "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT20'.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "-------
      sort lt_lookup_finder by codeid.
      loop at lt_g_script into ls_g_script.
        clear ls_lookup.
        read table lt_lookup_finder into ls_lookup
         with key tranid = ls_g_script-tranid binary search.
        if sy-subrc = 0.
          clear ls_result.
          if ls_lookup-sourcetype = 'RSDS'.
            condense ls_lookup-sourcename.
          endif.
          move-corresponding ls_lookup  to ls_result.
          move-corresponding ls_g_script to ls_result.
          ls_result-line = ls_g_script-script.
          "Get description of Transformation
          clear lv_txtlg.
*************New ALU_20250630
          PERFORM get_txtlg USING ls_lookup-tranid CHANGING lv_txtlg.
*************End ALU_20250630
          if sy-subrc <> 0.
            "If no text found derive description of the Transformation
            concatenate ls_lookup-sourcetype ls_lookup-sourcename '->'
                        ls_lookup-targettype ls_lookup-targetname
                         into lv_txtlg separated by space.
          endif.
          ls_result-txtlg = lv_txtlg.
          ls_result-codetp = 'TF'.

          append ls_result to gt_result.
        endif.
      endloop.

    endif.

    "AMDP
    if lt_g_sscript is not initial.
      clear lt_lookup_finder.
      "------- Transformations - AMDP Start Routine
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype startroutine tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_g_sscript
        where
          startroutine = lt_g_sscript-codeid and
          objvers      = 'A'.                               "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT21'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations - AMDP End Routine
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
        sourcesubtype endroutine tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_g_sscript
        where
          endroutine = lt_g_sscript-codeid and
          objvers    = 'A'.                                 "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT22'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations - AMDP Expert Routine
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype expert tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_g_sscript
        where
          expert  = lt_g_sscript-codeid and
          objvers = 'A'.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT23'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "------- Transformations - AMDP InfoObject Routine
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype codeid a~tranid fieldnm
        into table lt_lookup_temp
        from rstran as a
        inner join rstranroutmap as b on a~tranid = b~tranid
        for all entries in lt_g_sscript
        where
          expert    = ''                  and
          b~codeid  = lt_g_sscript-codeid and
          a~objvers = 'A'                 and
          b~objvers = 'A'                 and
          param_id  = 1                   and
          paramtype = 1.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT24'.
        append ls_lookup to lt_lookup_finder.
      endloop.

      "-------
      sort lt_lookup_finder by codeid.
      loop at lt_g_sscript into ls_g_sscript.
        clear ls_lookup.
        read table lt_lookup_finder into ls_lookup
         with key codeid = ls_g_sscript-codeid binary search.
        if sy-subrc = 0.
          clear ls_result.
          if ls_lookup-sourcetype = 'RSDS'.
            condense ls_lookup-sourcename.
          endif.
          move-corresponding ls_lookup  to ls_result.
          move-corresponding ls_g_sscript to ls_result.
          ls_result-line = ls_g_sscript-script.
          "Get description of Transformation
          clear lv_txtlg.
*************New ALU_20250630
          PERFORM get_txtlg USING ls_lookup-tranid CHANGING lv_txtlg.
*************End ALU_20250630
          if sy-subrc <> 0.
            "If no text found derive description of the Transformation
            concatenate ls_lookup-sourcetype ls_lookup-sourcename '->'
                        ls_lookup-targettype ls_lookup-targetname
                         into lv_txtlg separated by space.
          endif.
          ls_result-txtlg = lv_txtlg.
          ls_result-codetp = 'TF'.

          append ls_result to gt_result.
        endif.
      endloop.
    endif.
    "End Change ADü_20180618 - DP-1210

    "BW4/HANA
    if lt_g_rstransteprout is not initial.
      clear lt_lookup_finder.
      clear lt_lookup_temp.
      "------- Transformations - Start Routine
      select ('targetname targettype targetsubtype sourcename sourcetype sourcesubtype startroutine tranid set_runtime')
         into table lt_lookup_temp from rstran
        for all entries in lt_g_rstransteprout
        where
          startroutine = lt_g_rstransteprout-codeid and
          objvers      = 'A'.                               "#EC *

      loop at lt_lookup_temp into ls_lookup.
        if ls_lookup-set_runtime = 'O'.
          ls_lookup-routinetype = 'RT34'.
        else.
          ls_lookup-routinetype = 'RT30'.
        endif.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "------- Transformations - End Routine
      clear lt_lookup_temp.
      select ('targetname targettype targetsubtype sourcename sourcetype sourcesubtype endroutine tranid set_runtime')
         into table lt_lookup_temp from rstran
        for all entries in lt_g_rstransteprout
        where
          endroutine = lt_g_rstransteprout-codeid and
          objvers    = 'A'.                                 "#EC *

      loop at lt_lookup_temp into ls_lookup.
        if ls_lookup-set_runtime = 'O'.
          ls_lookup-routinetype = 'RT35'.
        else.
          ls_lookup-routinetype = 'RT31'.
        endif.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "------- Transformations - Expert Routine
      clear lt_lookup_temp.
      select ('targetname targettype targetsubtype sourcename sourcetype sourcesubtype expert tranid set_runtime')
         into table lt_lookup_temp from rstran
        for all entries in lt_g_rstransteprout
        where
          expert  = lt_g_rstransteprout-codeid and
          objvers = 'A'.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        if ls_lookup-set_runtime = 'O'.
          ls_lookup-routinetype = 'RT37'.
        else.
          ls_lookup-routinetype = 'RT33'.
        endif.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "------- Transformations - InfoObject Routine
      clear lt_lookup_temp.
      select ('targetname targettype targetsubtype sourcename sourcetype sourcesubtype codeid a~tranid a~set_runtime fieldnm')
        into table lt_lookup_temp
        from rstran as a
        inner join rstranroutmap as b on a~tranid = b~tranid
        for all entries in lt_g_rstransteprout
        where
          expert    = ''                  and
          b~codeid  = lt_g_rstransteprout-codeid and
          a~objvers = 'A'                 and
          b~objvers = 'A'                 and
          param_id  = 1                   and
          paramtype = 1.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        if ls_lookup-set_runtime = 'O'.
          ls_lookup-routinetype = 'RT36'.
        else.
          ls_lookup-routinetype = 'RT32'.
        endif.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "------- Transformations (Global declaration part 1)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype glbcode tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_g_rstransteprout
        where
          glbcode = lt_g_rstransteprout-codeid and
          objvers = 'A'.                                    "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT05'.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "------- Transformations (Global declaration part 2)
      clear lt_lookup_temp.
      select targetname targettype targetsubtype sourcename sourcetype
         sourcesubtype glbcode2 tranid
         into table lt_lookup_temp from rstran
        for all entries in lt_g_rstransteprout
        where
          glbcode2 = lt_g_rstransteprout-codeid and
          objvers  = 'A'.                                   "#EC *

      loop at lt_lookup_temp into ls_lookup.
        ls_lookup-routinetype = 'RT06'.
        append ls_lookup to lt_lookup_finder.
      endloop.
      "-------
      sort lt_lookup_finder by codeid.
      loop at lt_g_rstransteprout into ls_g_rstransteprout.
        clear ls_lookup.
        read table lt_lookup_finder into ls_lookup
         with key codeid = ls_g_rstransteprout-codeid binary search.
        if sy-subrc = 0.
          clear ls_result.
          if ls_lookup-sourcetype = 'RSDS'.
            condense ls_lookup-sourcename.
          endif.
          move-corresponding ls_lookup  to ls_result.
          move-corresponding ls_g_rstransteprout to ls_result.
          ls_result-line = ls_g_rstransteprout-code.
          "Get description of Transformation
          clear lv_txtlg.
*************New ALU_20250630
          PERFORM get_txtlg USING ls_lookup-tranid CHANGING lv_txtlg.
*************End ALU_20250630
          if sy-subrc <> 0.
            "If no text found derive description of the Transformation
            concatenate ls_lookup-sourcetype ls_lookup-sourcename '->'
                        ls_lookup-targettype ls_lookup-targetname
                         into lv_txtlg separated by space.
          endif.
          ls_result-txtlg = lv_txtlg.
          ls_result-codetp = 'TF'.

          append ls_result to gt_result.
        endif.
      endloop.
    endif.

  endif.

  "----------------------------------------------------------------
  " Scan InfoObject (Char.) Transfer-Routines
  "----------------------------------------------------------------
  if i_iobjrout = 'X'.

    types:
      begin of s_chabas,
        chabasnm like rsdchabas-chabasnm,
        iobjrout like rsdchabas-iobjrout,
      end of s_chabas,
      t_chabas type standard table of s_chabas.

    data lt_chabas type t_chabas.
    field-symbols <s_chabas> type s_chabas.

    clear lt_rsaabap.
    loop at gt_rsaabap into ls_rsaabap where codetp = 'IC'.
      append ls_rsaabap to lt_rsaabap.
    endloop.
    if not lt_rsaabap is initial.

      clear: lt_lookup_temp, lt_chabas.
      select  chabasnm iobjrout
        into table lt_chabas
        from rsdchabas
        for all entries in lt_rsaabap
        where
          iobjrout = lt_rsaabap-codeid and
          objvers    = 'A'.                                 "#EC *

      loop at lt_chabas assigning <s_chabas>.
        clear ls_lookup.
        ls_lookup-iobjnm = <s_chabas>-chabasnm.
        ls_lookup-codeid = <s_chabas>-iobjrout.
        append ls_lookup to lt_lookup_temp.
      endloop.

      sort lt_lookup_temp by codeid.
      loop at lt_rsaabap into ls_rsaabap.
        clear ls_lookup.
        read table lt_lookup_temp into ls_lookup
         with key codeid = ls_rsaabap-codeid binary search.
        if sy-subrc = 0.
          clear ls_result.
          ls_lookup-routinetype = 'RT15'.
          move-corresponding ls_lookup  to ls_result.
          move-corresponding ls_rsaabap to ls_result.
          append ls_result to gt_result.
        endif.
      endloop.

    endif.
  endif.

endform.                    "scan_rsaabap



*&--------------------------------------------------------------------*
*&      Form  scan_dtp
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form scan_dtp
  tables lt_string t_devcl_range
    using i_skip_comment i_case i_regex.

  data:
    l_t_dtp_range     type t_devcl_range,
    l_s_dtp_range     type s_devcl_range,
    lt_obj            type standard table of tadir-obj_name,
    ls_match_result   type match_result,
    l_dtpnm           type rsbkdtpnm,
    ls_rsbkdtpt       like rsbkdtpt,
    lt_rsbkdtpt       like table of rsbkdtpt,
    lr_cl_rsbk_dtp    type ref to cl_rsbk_dtp,
    lr_cl_rsbc_filter type ref to cl_rsbc_filter,
    ls_dtprule        type mch_s_sourcecode,
    lt_dtprule        type mch_t_sourcecode,
    ls_result         type s_result.

  field-symbols:
    <string>  type s_string,
    <s_range> type rsrange,
    <s_obj>   like line of lt_obj.
  "------------------------------------------------------------------

  select obj_name into table lt_obj from tadir
    where
      pgmid    = 'R3TR'           and
      object   = 'DTPA'.                                    "#EC *

  select * into table lt_rsbkdtpt from rsbkdtpt
    where
      langu   = sy-langu and
      objvers = 'A'.

  sort lt_rsbkdtpt by dtp.

  loop at lt_obj assigning <s_obj>.

    clear:
      lr_cl_rsbk_dtp,
      lr_cl_rsbc_filter.

    "===== Get Filter-Routines =====
    l_dtpnm = <s_obj>.
    lr_cl_rsbk_dtp    = cl_rsbk_dtp=>factory( l_dtpnm ).
    try.
        lr_cl_rsbc_filter = lr_cl_rsbk_dtp->get_obj_ref_filter( ).
      catch cx_rs_access_error.
        continue.
    endtry.

    loop at lr_cl_rsbc_filter->n_t_dtprule into ls_dtprule.

      loop at lt_string assigning <string>.
        clear ls_match_result.
        if i_case = ' ' and i_regex = ' '.
          find first occurrence of <string> in ls_dtprule-line
            in character mode
            ignoring case
            results ls_match_result.
        elseif i_case = 'X' and i_regex = ' '.
          find first occurrence of <string> in ls_dtprule-line
            in character mode
            respecting case
            results ls_match_result.
        elseif i_case = ' ' and i_regex = 'X'.
          find first occurrence of regex <string> in ls_dtprule-line
            in character mode
            ignoring case
            results ls_match_result.
        elseif i_case = 'X' and i_regex = 'X'.
          find first occurrence of regex <string> in ls_dtprule-line
            in character mode
            respecting case
            results ls_match_result.
        endif.
        if ls_match_result-offset <> 0.
          clear ls_result.
          ls_result-codetp      = 'DTP'.
          ls_result-targetname  = <s_obj>.
          ls_result-routinetype = 'RT13'.
          ls_result-iobjnm      = ls_dtprule-field.
          ls_result-line_no     = ls_dtprule-line_no.
          ls_result-line        = ls_dtprule-line.
          "Get description
          read table lt_rsbkdtpt into ls_rsbkdtpt
           with key dtp = <s_obj> binary search.
          if sy-subrc = 0.
            ls_result-txtlg = ls_rsbkdtpt-txtlg.
          endif.
          append ls_result to gt_result.
        endif.
      endloop.

    endloop.

  endloop.

endform.                    "scan_dtp



*&--------------------------------------------------------------------*
*&      Form  scan_ip
*&--------------------------------------------------------------------*
form scan_ip
    tables lt_string t_devcl_range
    using i_skip_comment i_case i_regex.
  data:
    l_t_devcl_range type t_devcl_range,
    l_s_devcl_range type s_devcl_range,
    lt_obj          type standard table of tadir-obj_name,
    ls_rsldprule    like rsldprule,
    lt_rsldprule    like table of ls_rsldprule,
    ls_match_result type match_result,
    ls_rsldpiot     like rsldpiot,
    lt_rsldpiot     like table of rsldpiot,
    ls_result       type s_result.

  field-symbols:
    <string>  type s_string,
    <s_range> type rsrange,
    <s_obj>   like line of lt_obj.


  loop at t_devcl_range assigning <s_range>.
    l_s_devcl_range-sign   = <s_range>-sign.
    l_s_devcl_range-option = <s_range>-option.
    l_s_devcl_range-low    = <s_range>-low.
    l_s_devcl_range-high   = <s_range>-high.
    append l_s_devcl_range to l_t_devcl_range.
  endloop.

  "------------------------------------------------------------------

  select obj_name into table lt_obj from tadir
    where
      pgmid    = 'R3TR'           and
      object   = 'ISIP'.                                    "#EC *

  select * into table lt_rsldpiot from rsldpiot
    where
      langu = sy-langu and
      objvers = 'A'.

  sort lt_rsldpiot by logdpid.

  loop at lt_obj assigning <s_obj>.

    clear lt_rsldprule.
    select
        r~logdpid
        r~objvers
        r~fieldname
        r~lnr
        r~iobjnm
        line
      into table lt_rsldprule
      from rsldpsel as s inner join rsldprule as r
      on s~logdpid = r~logdpid and
         s~objvers = r~objvers and
         s~fieldname = r~fieldname
      where
        s~logdpid = <s_obj> and
        s~objvers = 'A'.

    loop at lt_rsldprule into ls_rsldprule.

      loop at lt_string assigning <string>.

        clear ls_match_result.
        if i_case = ' ' and i_regex = ' '.
          find first occurrence of <string> in ls_rsldprule-line
            in character mode
            ignoring case
            results ls_match_result.
        elseif i_case = 'X' and i_regex = ' '.
          find first occurrence of <string> in ls_rsldprule-line
            in character mode
            respecting case
            results ls_match_result.
        elseif i_case = ' ' and i_regex = 'X'.
          find first occurrence of regex <string> in ls_rsldprule-line
            in character mode
            ignoring case
            results ls_match_result.
        elseif i_case = 'X' and i_regex = 'X'.
          find first occurrence of regex <string> in ls_rsldprule-line
            in character mode
            respecting case
            results ls_match_result.
        endif.

        if ls_match_result-offset <> 0.
          clear ls_result.
          ls_result-codetp      = 'IP'.
          ls_result-targetname  = <s_obj>.
          ls_result-routinetype = 'RT14'.
          ls_result-txtlg       = ls_rsldprule-fieldname.
          ls_result-iobjnm      = ls_rsldprule-iobjnm.
          ls_result-line_no     = sy-tabix.
          ls_result-line        = ls_rsldprule-line.
          read table lt_rsldpiot into ls_rsldpiot
          with key logdpid = ls_rsldprule-logdpid binary search.
          if sy-subrc = 0.
            ls_result-txtlg = ls_rsldpiot-text.
          endif.
          append ls_result to gt_result.
        endif.

      endloop.

    endloop.

  endloop.
endform.                    "scan_ip


*&--------------------------------------------------------------------*
*&      Form  Get_REPS
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form get_reps
  tables t_devcl_range t_reps_range t_subc_range.

  data:
    l_t_devcl_range type t_devcl_range,
    l_s_devcl_range type s_devcl_range,
    l_t_name_range  type t_name_range,
    l_s_name_range  type s_name_range,
    l_t_subc_range  type t_subc_range,
    l_s_subc_range  type s_subc_range.

  field-symbols:
    <s_range>       type rsrange.

  "------------------------------------------------------------------
  " Range Importparam. in Selektionstab. mit passendem Typ übertragen
  "------------------------------------------------------------------
  loop at t_devcl_range assigning <s_range>.
    l_s_devcl_range-sign   = <s_range>-sign.
    l_s_devcl_range-option = <s_range>-option.
    l_s_devcl_range-low    = <s_range>-low.
    l_s_devcl_range-high   = <s_range>-high.
    append l_s_devcl_range to l_t_devcl_range.
  endloop.

  loop at t_reps_range assigning <s_range>.
    l_s_name_range-sign   = <s_range>-sign.
    l_s_name_range-option = <s_range>-option.
    l_s_name_range-low    = <s_range>-low.
    l_s_name_range-high   = <s_range>-high.
    append l_s_name_range to l_t_name_range.
  endloop.

  loop at t_subc_range assigning <s_range>.
    l_s_subc_range-sign   = <s_range>-sign.
    l_s_subc_range-option = <s_range>-option.
    l_s_subc_range-low    = <s_range>-low.
    l_s_subc_range-high   = <s_range>-high.
    append l_s_subc_range to l_t_subc_range.
  endloop.
  "------------------------------------------------------------------

  select object obj_name into table gt_object from tadir
     as a inner join trdir as r on a~obj_name = r~name
      where
       pgmid    = 'R3TR'   and
       object   = 'PROG'   and
       obj_name in l_t_name_range  and
       devclass in l_t_devcl_range and
       subc     in l_t_subc_range.                          "#EC *


endform.                    "Get_REPS


*&--------------------------------------------------------------------*
*&      Form  get_FUNC
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
*      -->I_T_DEVCL_RANGE  text
*      -->I_T_FUGR_RANGE   text
*---------------------------------------------------------------------*
form get_func
  tables t_devcl_range t_fugr_range.

  data:
    l_t_devcl_range type t_devcl_range,
    l_s_devcl_range type s_devcl_range,
    l_t_fugr_range  type t_fugr_range,
    l_s_fugr_range  type s_fugr_range,
    lt_obj          type standard table of s_object,
    l_fgroup        type rs38l-area,
    l_program       type progname.

  field-symbols:
    <s_range> type rsrange,
    <s_obj>   like line of lt_obj.

  "------------------------------------------------------------------
  " Range Importparam. in Selektionstab. mit passendem Typ übertragen
  "------------------------------------------------------------------
  loop at t_devcl_range assigning <s_range>.
    l_s_devcl_range-sign   = <s_range>-sign.
    l_s_devcl_range-option = <s_range>-option.
    l_s_devcl_range-low    = <s_range>-low.
    l_s_devcl_range-high   = <s_range>-high.
    append l_s_devcl_range to l_t_devcl_range.
  endloop.

  loop at t_fugr_range assigning <s_range>.
    l_s_fugr_range-sign   = <s_range>-sign.
    l_s_fugr_range-option = <s_range>-option.
    l_s_fugr_range-low    = <s_range>-low.
    l_s_fugr_range-high   = <s_range>-high.
    append l_s_fugr_range to l_t_fugr_range.
  endloop.
  "------------------------------------------------------------------

  select object obj_name into table lt_obj from tadir
    where
      pgmid    = 'R3TR'           and
      object   = 'FUGR'           and
      obj_name in l_t_fugr_range  and
      devclass in l_t_devcl_range.                          "#EC *

  loop at lt_obj assigning <s_obj>.
    l_fgroup = <s_obj>-obj_name.
    clear l_program.

    call function 'FUNCTION_INCLUDE_CONCATENATE'
      changing
        program                  = l_program
        complete_area            = l_fgroup
      exceptions
        not_enough_input         = 1
        no_function_pool         = 2
        delimiter_wrong_position = 3
        others                   = 4.

    check sy-subrc is initial and l_program is not initial.
    <s_obj>-object = 'FUGR'.
    <s_obj>-incl_name = l_program.
    append <s_obj> to gt_object.
  endloop.

endform.                    "get_FUNC



*&--------------------------------------------------------------------*
*&      Form  get_plse
*&--------------------------------------------------------------------*
*       Search in Planning Functions
*---------------------------------------------------------------------*
form get_plse
    tables lt_string t_devcl_range
    using i_skip_comment i_case i_regex.

  data:
    lt_obj          type standard table of tadir-obj_name,
    ls_rsplf_srv_p  type rsplf_srv_p,
    lt_rsplf_srv_p  type table of rsplf_srv_p,
    ls_match_result type match_result,
    ls_rsplf_srvt   type rsplf_srvt,
    lt_rsplf_srvt   type table of rsplf_srvt,
    ls_result       type s_result.

  field-symbols:
    <string>  type s_string,
    <s_range> type rsrange,
    <s_obj>   like line of lt_obj.
  "------------------------------------------------------------------

  select obj_name into table lt_obj from tadir
    where
      pgmid    = 'R3TR' and
      object   = 'PLSE'.                                    "#EC *

  select * into table lt_rsplf_srvt from rsplf_srvt
    where
      langu = sy-langu and
      objvers = 'A'.                                        "#EC *

  sort lt_rsplf_srvt by srvnm.

  loop at lt_obj assigning <s_obj>.

    clear lt_rsplf_srv_p.
    select * from rsplf_srv_p
      into table lt_rsplf_srv_p
      where
        srvnm = <s_obj> and
        objvers = 'A'   and
        parnm = 'FLINE'.                                    "#EC *


**new ADü_20170613
    data: lv_string   type          string,
          lt_splitted type table of string,
          ls_splitted type          string,
          lv_index    type          i value 0.

    clear: lv_string, lv_index.

    loop at lt_rsplf_srv_p into ls_rsplf_srv_p.
      concatenate lv_string ls_rsplf_srv_p-value into lv_string.
    endloop.

    split lv_string at cl_abap_char_utilities=>cr_lf into table lt_splitted.

    read table lt_rsplf_srv_p into ls_rsplf_srv_p index 1. "#EC CI_NOORDER

    loop at lt_splitted into ls_splitted.
      lv_index = lv_index + 1.

      "LOOP AT lt_rsplf_srv_p INTO ls_rsplf_srv_p.

**end new ADü_20170613

      loop at lt_string assigning <string>.

        clear ls_match_result.
        if i_case = ' ' and i_regex = ' '.
          find first occurrence of <string> in ls_splitted "ls_rsplf_srv_p-value
            in character mode
            ignoring case
            results ls_match_result.
        elseif i_case = 'X' and i_regex = ' '.
          find first occurrence of <string> in ls_splitted "ls_rsplf_srv_p-value
            in character mode
            respecting case
            results ls_match_result.
        elseif i_case = ' ' and i_regex = 'X'.
          find first occurrence of regex <string>
            in ls_splitted "ls_rsplf_srv_p-value
            in character mode
            ignoring case
            results ls_match_result.
        elseif i_case = 'X' and i_regex = 'X'.
          find first occurrence of regex <string>
            in ls_splitted "ls_rsplf_srv_p-value
            in character mode
            respecting case
            results ls_match_result.
        endif.

        if ls_match_result-offset <> 0.
          clear ls_result.
          ls_result-codetp      = 'PF'.
          ls_result-targetname  = <s_obj>.
          ls_result-routinetype = 'RT19'.
          ls_result-txtlg       = ''.
          ls_result-iobjnm      = ''.
          ls_result-line_no     = lv_index. "ls_rsplf_srv_p-indx.
          ls_result-line        = ls_splitted. "ls_rsplf_srv_p-value.
          read table lt_rsplf_srvt into ls_rsplf_srvt
          with key srvnm = ls_rsplf_srv_p-srvnm binary search.
          if sy-subrc = 0.
            ls_result-txtlg = ls_rsplf_srvt-txtlg.
          endif.
          append ls_result to gt_result.
        endif.

      endloop.

    endloop.

  endloop.

endform.                    "get_plse



*&--------------------------------------------------------------------*
*&      Form  get_clas
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form get_clas
  tables t_devcl_range t_clas_range.

  data:
    l_t_devcl_range type t_devcl_range,
    l_s_devcl_range type s_devcl_range,
    l_t_clas_range  type t_clas_range,
    l_s_clas_range  type s_clas_range,
    lt_obj          type standard table of s_object,
    l_clskey        type seoclskey,
    l_obj           type tadir-obj_name,
    lt_includes     type seop_methods_w_include.

  field-symbols:
    <s_range>   type rsrange,
    <s_obj>     like line of lt_obj,
    <s_include> like line of lt_includes.

  "------------------------------------------------------------------
  " Range Importparam. in Selektionstab. mit passendem Typ übertragen
  "------------------------------------------------------------------
  loop at t_devcl_range assigning <s_range>.
    l_s_devcl_range-sign   = <s_range>-sign.
    l_s_devcl_range-option = <s_range>-option.
    l_s_devcl_range-low    = <s_range>-low.
    l_s_devcl_range-high   = <s_range>-high.
    append l_s_devcl_range to l_t_devcl_range.
  endloop.

  loop at t_clas_range assigning <s_range>.
    l_s_clas_range-sign   = <s_range>-sign.
    l_s_clas_range-option = <s_range>-option.
    l_s_clas_range-low    = <s_range>-low.
    l_s_clas_range-high   = <s_range>-high.
    append l_s_clas_range to l_t_clas_range.
  endloop.
  "------------------------------------------------------------------

  select object obj_name into table lt_obj from tadir
    where
      pgmid    = 'R3TR'          and
      object   = 'CLAS'          and
      obj_name in l_t_clas_range and
      devclass in l_t_devcl_range.                          "#EC *

  loop at lt_obj assigning <s_obj>.
    l_clskey = <s_obj>-obj_name.
* ts 28.10.2014 - Start comment
*    CALL FUNCTION 'SEO_CLASS_GET_METHOD_INCLUDES'
*      EXPORTING
*        clskey                       = l_clskey
*      IMPORTING
*        includes                     = lt_includes
*      EXCEPTIONS
*        _internal_class_not_existing = 1
*        OTHERS                       = 2.
*
*    LOOP AT lt_includes ASSIGNING <s_include>.
*      <s_obj>-object = 'METH'.
*      <s_obj>-incl_name = <s_include>-incname.
*      <s_obj>-obj_name = l_clskey.
*      <s_obj>-meth_name = <s_include>-cpdkey+30.
*      APPEND <s_obj> TO gt_object.
*    ENDLOOP.
* ts 28.10.2014 - End comment

* ts 28.10.2014 - Start insert
    class cl_oo_include_naming definition load.
    data lo_clif_incl_naming  type ref to if_oo_clif_incl_naming.
    data lo_class_incl_naming type ref to if_oo_class_incl_naming.
    data l_t_method_w_include type seop_methods_w_include.
    field-symbols: <s_method_w_include> type seop_method_w_include.

    call method cl_oo_include_naming=>get_instance_by_cifkey
      exporting
        cifkey         = l_clskey
      receiving
        cifref         = lo_clif_incl_naming
      exceptions
        no_objecttype  = 1
        internal_error = 2
        others         = 3.

    if sy-subrc = 0.
      lo_class_incl_naming ?= lo_clif_incl_naming.
      l_t_method_w_include =
        lo_class_incl_naming->get_all_method_includes( ).
      loop at l_t_method_w_include assigning <s_method_w_include>.
        <s_obj>-object = 'METH'.
        <s_obj>-incl_name = <s_method_w_include>-incname.
        <s_obj>-obj_name  = l_clskey.
        <s_obj>-meth_name = <s_method_w_include>-cpdkey+30.
        append <s_obj> to gt_object.
      endloop.
      "ADü - Start insert 20170621
      "Public Section
      <s_obj>-object    = 'METH'.
      <s_obj>-incl_name = lo_class_incl_naming->public_section.
      <s_obj>-obj_name  = l_clskey.
      <s_obj>-meth_name = 'PUBLIC SECTION'.
      append <s_obj> to gt_object.
      "Private Section
      <s_obj>-object    = 'METH'.
      <s_obj>-incl_name = lo_class_incl_naming->private_section.
      <s_obj>-obj_name  = l_clskey.
      <s_obj>-meth_name = 'PRIVATE SECTION'.
      append <s_obj> to gt_object.
      "Protected Section
      <s_obj>-object    = 'METH'.
      <s_obj>-incl_name = lo_class_incl_naming->protected_section.
      <s_obj>-obj_name  = l_clskey.
      <s_obj>-meth_name = 'PROTECTED SECTION'.
      append <s_obj> to gt_object.
      "Local Implementations
      <s_obj>-object    = 'METH'.
      <s_obj>-incl_name = lo_class_incl_naming->locals_imp.
      <s_obj>-obj_name  = l_clskey.
      <s_obj>-meth_name = 'LOCAL IMPLEMENTATIONS'.
      append <s_obj> to gt_object.
      "ADü - End insert 20170621
    endif.
* ts 28.10.2014 - End insert

  endloop.

endform.                    "get_clas



*&--------------------------------------------------------------------*
*&      Form  scan_include_code
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form scan_include_code
  tables lt_string
    using i_skip_comment i_case i_regex.

  data:
    lt_object        type standard table of s_object,
    ls_object        type s_object, "TS, 20140509
    lt_include       type standard table of tadir-obj_name,
    lv_program       type sy-repid,
    lt_abap          type abaptxt255_tab,
    lt_match_results type match_result_tab,
    ls_match_result  like line of lt_match_results,
    ls_result        type s_result,
    lv_func          type rs38l-name,
    lv_func_incl     type rs38l-name.

  field-symbols:
    <string>  type s_string,
    <s_range> type rsrange,
    <obj>     type s_object,
    <include> type tadir-obj_name,
    <abap>    like line of lt_abap.


*--------------------------------------------------------------------
  "Get includes
  clear lt_object.
  "for reports and classes we already have the includes
  loop at gt_object assigning <obj> where object = 'FUGR'.
    clear lt_include.
    lv_program = <obj>-incl_name.

    call function 'RS_GET_ALL_INCLUDES'
      exporting
        program      = lv_program
      tables
        includetab   = lt_include
      exceptions
        not_existent = 1
        no_program   = 2
        others       = 3.

    check sy-subrc is initial.

    loop at lt_include assigning <include>.
      ls_object-object = 'FUNC'.
      ls_object-incl_name = <include>.
      append ls_object to gt_object.
    endloop.

  endloop.

  sort lt_object.
  delete adjacent duplicates from lt_object.
  append lines of lt_object to gt_object.

  "Source scan
  loop at gt_object assigning <obj>.

    if <obj>-object = 'PROG'.
      <obj>-incl_name = <obj>-obj_name.
    endif.
    read report <obj>-incl_name into lt_abap.
    if sy-subrc is not initial.
      continue.
    endif.

    loop at lt_string assigning <string>.

      clear lt_match_results.
      if i_case = '' and i_regex = ''.
        find all occurrences of <string> in table lt_abap
          in character mode
          ignoring case
          results lt_match_results.
      elseif i_case = 'X' and i_regex = ''.
        find all occurrences of <string> in table lt_abap
          in character mode
          respecting case
          results lt_match_results.
      elseif i_case = '' and i_regex = 'X'.
        find all occurrences of regex <string> in table lt_abap
          in character mode
          ignoring case
          results lt_match_results.
      elseif i_case = 'X' and i_regex = 'X'.
        find all occurrences of regex <string> in table lt_abap
          in character mode
          respecting case
          results lt_match_results.
      endif.

      loop at lt_match_results into ls_match_result.
        read table lt_abap
        index ls_match_result-line assigning <abap>.
        if sy-subrc = 0.
          clear ls_result.
          ls_result-codetp = <obj>-object(2).
          "if FUNC: Get name of FM
          if <obj>-object = 'FUNC' or <obj>-object = 'FUGR'.
            clear lv_func.

            call function 'FUNCTION_INCLUDE_INFO'
            "IMPORTING
            "FUNCTAB        =
            "NAMESPACE      =
            "PNAME          =
              changing
                funcname            = lv_func
                "GROUP          =
                include             = <obj>-incl_name
              exceptions
                function_not_exists = 1
                include_not_exists  = 2
                group_not_exists    = 3
                no_selections       = 4
                no_function_include = 5
                others              = 6.
            if sy-subrc = 0.
              <obj>-obj_name = lv_func.
            endif.

          endif.

          if <obj>-object = 'METH'.
            ls_result-txtlg = <obj>-meth_name.
          endif.
          ls_result-targetname = <obj>-obj_name.
          ls_result-sourcename = <obj>-incl_name.
          ls_result-line_no    = ls_match_result-line.
          ls_result-line       = <abap>.


          case ls_result-codetp.
            when 'PR'.
              ls_result-routinetype = 'RT16'.
            when 'ME'.
              ls_result-routinetype = 'RT17'.
            when 'FU'.
              ls_result-routinetype = 'RT18'.
          endcase.
          append ls_result to gt_result.
        endif.
      endloop.

    endloop.

  endloop.

endform.                    "scan_include_code

*&--------------------------------------------------------------------*
*&      Form  get transformation text
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM get_txtlg USING    p_tranid TYPE rstrant-tranid
                CHANGING p_txtlg  TYPE rstrant-txtlg.

  SELECT SINGLE txtlg INTO p_txtlg FROM rstrant
    WHERE langu = sy-langu
      AND tranid = p_tranid
      AND objvers = 'A'.

ENDFORM.

Z_RFC_GET_DTP_DETAILS v1_5

Source Code of Z_RFC_GET_DTP_DETAILS
ABAP
FUNCTION Z_RFC_GET_DTP_DETAILS
  IMPORTING
    VALUE(I_DTP) TYPE RSBKDTPNM
  EXPORTING
    VALUE(E_MAXSIZE) TYPE RSBKMAXSIZE
    VALUE(DATA_VAR) TYPE MCH_T_VAR_SELECT
  TABLES
    DATA_SEL LIKE RSSELECT
    DATA_RULE LIKE MCH_S_SOURCECODE
    DATA_GROUP LIKE RSBK_S_FIELDS_KEYFL
  EXCEPTIONS
    RELEASE_1_5
    NOT_AUTHORIZED
    NOT_GET_FILTER_DETAILS.



*************End ADÜ_20250430




  data l_r_rsbk_dtp type ref to cl_rsbk_dtp.
  data l_r_rsbc_filter type ref to cl_rsbc_filter.
  data l_r_rsbc_error_handler_tpl
         type ref to cl_rsbc_error_handler_tpl.

  data: l_t_groupfields  type rsbk_tx_fields_keyfl,
        l_th_groupfields type hashed table of rsbk_sx_fields_keyfl
                          with unique key segid.
  data ls_group       type rsbk_s_fields_keyfl.
  data ls_seltab      type rsbk_s_select.
  data ls_ruletab     type mch_s_sourcecode.
  data ls_groupfields type rsbk_sx_fields_keyfl.
  data lv_sel         type rsselect.
  data lv_rule        type mch_s_sourcecode.
  data lv_group       type rsbk_s_fields_keyfl.
  data lv_maxsize     type rsbkmaxsize.

* ==== Get Filter details ====
  try.
*BEGIN New ADü_20250328
      authority-check object 'S_RS_DTP'
       id 'RSTLDTPSRC' field '*'
       id 'RSSTDTPSRC' field '*'
       id 'RSONDTPSRC' field '*'
       id 'RSTLDTPTGT' field '*'
       id 'RSSTDTPTGT' field '*'
       id 'RSONDTPTGT' field '*'
       id 'ACTVT' field '03'.
      if sy-subrc <> 0.
        raise not_authorized.
      else.
*END New ADü_20250328
        l_r_rsbk_dtp = cl_rsbk_dtp=>factory( i_dtp ).
        l_r_rsbc_filter =
         l_r_rsbk_dtp->if_rsbk_dtp_display~get_obj_ref_filter( ).
*BEGIN New ADü_20250328
      endif.
*END New ADü_20250328
    catch cx_rs_access_error.
*************New ADÜ_20250430
        RAISE not_get_filter_details.
*************End ADÜ_20250430
  endtry.

* ==== Get Semantic Groups details ====
  call method l_r_rsbk_dtp->if_rsbk_dtp_display~get_groupfields
    importing
      e_t_groupfields = l_t_groupfields.
  insert lines of l_t_groupfields into table l_th_groupfields.


* Fill result table for selections:
  loop at l_r_rsbc_filter->n_t_seltab into ls_seltab.

    move ls_seltab-field to lv_sel-fieldnm.
    move ls_seltab-sign to lv_sel-sign.
    move ls_seltab-option to lv_sel-option.
    move ls_seltab-low to lv_sel-low.
    move ls_seltab-high to lv_sel-high.
    append lv_sel to data_sel.

  endloop.

* Fill result table for ABAP-Routines in selections
  loop at l_r_rsbc_filter->n_t_dtprule into ls_ruletab.

    move-corresponding ls_ruletab to lv_rule.
    append lv_rule to data_rule.

  endloop.

* Fill result table for Variables in selections
  move-corresponding l_r_rsbc_filter->n_t_varseltab to data_var.

* Fill result table for Semantic Groups
  loop at l_th_groupfields into ls_groupfields.
    loop at ls_groupfields-t_fields into ls_group.

      move ls_group-fieldname to lv_group-fieldname.
      move ls_group-txtlg to lv_group-txtlg.
      append lv_group to data_group.

    endloop.
  endloop.

* Get Max. Package Size
  try.
      call method l_r_rsbk_dtp->get_maxsize
        receiving
          r_maxsize = lv_maxsize.
    catch cx_rs_not_authorized.
      message id sy-msgid type sy-msgty number sy-msgno
      with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endtry.

  e_maxsize = lv_maxsize.

endfunction.

Z_RFC_AUTH_CHECK v1_2

Source Code of Z_RFC_AUTH_CHECK
ABAP
FUNCTION Z_RFC_AUTH_CHECK
  IMPORTING
    VALUE(I_COMPID) TYPE XUVAL
    VALUE(I_PROVIDER) TYPE XUVAL
    VALUE(I_INFOAREA) TYPE XUVAL OPTIONAL
    VALUE(I_ACTIVITY) TYPE XUVAL
    VALUE(I_OWNER) TYPE XUVAL
  TABLES
    T_USER LIKE BAPITGB
  EXCEPTIONS
    RELEASE_1_2.




  TYPES: BEGIN OF ty_user,
                bname TYPE xubname,
                name_text TYPE ad_namtext,
         END OF ty_user.

  FIELD-SYMBOLS <fs_user> TYPE ty_user.

  DATA: lt_user TYPE TABLE OF ty_user,
        chk_comp TYPE c LENGTH 1,
        chk_comp1 TYPE c LENGTH 1.

  REFRESH t_user.

  SELECT  bname name_text FROM user_addrp INTO TABLE lt_user."#EC CI_NOWHERE
  SORT lt_user.

  LOOP AT lt_user ASSIGNING <fs_user>.

    CLEAR: chk_comp, chk_comp1.

    CALL FUNCTION 'AUTHORITY_CHECK'
      EXPORTING
        user                = <fs_user>-bname
        object              = 'S_RS_COMP'
        field1              = 'RSZCOMPID'
        value1              = i_compid
        field2              = 'RSZCOMPTP'
        value2              = 'REP'
        field3              = 'RSINFOCUBE'
        value3              = i_provider
        field4              = 'ACTVT'
        value4              = i_activity
        field5              = 'RSINFOAREA'
        value5              = i_infoarea
      EXCEPTIONS
        user_dont_exist     = 1
        user_is_authorized  = 2
        user_not_authorized = 3
        user_is_locked      = 4
        OTHERS              = 5.
    IF sy-subrc = 2.
      chk_comp = 'X'.
    ENDIF.

    CALL FUNCTION 'AUTHORITY_CHECK'
      EXPORTING
        user                = <fs_user>-bname
        object              = 'S_RS_COMP1'
        field1              = 'RSZCOMPID'
        value1              = i_compid
        field2              = 'RSZCOMPTP'
        value2              = 'REP'
        field3              = 'RSZOWNER'
        value3              = i_owner
        field4              = 'ACTVT'
        value4              = i_activity
        field5              = ''
        value5              = ''
      EXCEPTIONS
        user_dont_exist     = 1
        user_is_authorized  = 2
        user_not_authorized = 3
        user_is_locked      = 4
        OTHERS              = 5.

    IF sy-subrc = 2.
      chk_comp1 = 'X'.
    ENDIF.

    IF chk_comp = 'X' AND chk_comp1 = 'X'.
      APPEND <fs_user> TO t_user.
    ENDIF.

  ENDLOOP.


ENDFUNCTION.

Z_RFC_USAGE_ANALYSIS v2_1

Source Code of Z_RFC_USAGE_ANALYSIS
ABAP
FUNCTION Z_RFC_USAGE_ANALYSIS
  IMPORTING
    VALUE(I_VERSION) TYPE RSOBJVERS DEFAULT 'A'
    VALUE(I_IOBJNM) TYPE RSIOBJNM OPTIONAL
    VALUE(I_ATTRINM) TYPE RSATTRINM OPTIONAL
    VALUE(I_VALUE) TYPE RSCHAVL OPTIONAL
    VALUE(I_COMPID) TYPE RSZCOMPID OPTIONAL
    VALUE(I_UID) TYPE SYSUUID_25 OPTIONAL
    VALUE(I_EXTENDED) TYPE SONV-FLAG OPTIONAL
    VALUE(I_LEVEL_MAX) TYPE INT4 DEFAULT 99
  TABLES
    T_CHAVL LIKE RSA_S_CHAVL
    T_DATA LIKE V_COMPDIR_COMPIC
    T_DATA2 LIKE TAB512
    T_DATA_RANGE LIKE TAB512
  EXCEPTIONS
    RELEASE_2_1.





* A] Elemente in Query-Selektionen  -> RSZRANGE
* B] Berechnete Kennzahlen -> RSZCALC
*--------------------------------------------------------------------

  TYPES:
    BEGIN OF ty_uid_deftp,
      compuid TYPE sysuuid_25,
      deftp   TYPE rszdeftp,
    END OF ty_uid_deftp.

  DATA:
    l_subrc        TYPE rs_bool,
    l_iobjnm       TYPE rsiobjnm,
    l_uid          TYPE sysuuid_25,
    l_iobjtp       TYPE rsiobjtp,
    l_s_uid_deftp  TYPE ty_uid_deftp,
    l_t_data       TYPE ty_t_data_scan,
    l_t_data_range TYPE ty_t_data_range,
    l_s_data       TYPE v_compdir_compic,"Struktur für Export Parameter
    l_s_data2      TYPE char512,         "Struktur für Export Parameter
    l_s_data_range TYPE char512.         "Struktur für Export Parameter

  FIELD-SYMBOLS:
    <s_data>       TYPE ty_s_data_scan,
    <s_data_range> TYPE ty_s_data_range,
    <fs_chavl>     TYPE rsa_s_chavl.

  LOOP AT t_chavl ASSIGNING <fs_chavl>.
    ls_chavl-sign   = 'I'.
    ls_chavl-option = 'EQ'.
    ls_chavl-low    = <fs_chavl>-chavl.
    APPEND ls_chavl TO gt_chavl.
  ENDLOOP.

  "Globalen Parameter setzen
  p_level_max = i_level_max.

  "Wiederverwendbare Elemente puffern
  SELECT * FROM rszcompdir INTO TABLE g_t_rszcompdir  "#EC CI_NOFIRST
     WHERE objvers = 'A'.

  IF i_iobjnm IS NOT INITIAL.
    "------------------------------------------------------------------
    " Where-used analysis for InfoObjects
    "------------------------------------------------------------------

    "Check if a display attribute is entered:
    IF i_attrinm IS NOT INITIAL.
      PERFORM scan_attr_dis USING i_iobjnm i_attrinm i_version
                            CHANGING l_t_data.
    ELSE.
      SELECT SINGLE iobjtp FROM rsdiobj INTO l_iobjtp "#EC CI_NOORDER
         WHERE iobjnm = i_iobjnm."#EC CI_GENBUFF
*************New ADÜ_20250430
      IF sy-subrc <> 0.
        "handled later in the Performer Suite
      ENDIF.
*************End ADÜ_20250430
      IF l_iobjtp = 'KYF'.
        PERFORM scan_kyfnm USING i_iobjnm i_version CHANGING l_t_data.
      ELSEIF i_value IS NOT INITIAL OR gt_chavl IS NOT INITIAL.
        PERFORM scan_value_sel
            USING i_value i_iobjnm i_version gt_chavl
            CHANGING l_t_data l_t_data_range.
      ELSE.
*       l_seltp = rsd_c_metaiobj-charact.
        PERFORM scan_char USING i_iobjnm i_version CHANGING l_t_data.
      ENDIF.
    ENDIF.

  ELSEIF i_compid IS NOT INITIAL.
    "------------------------------------------------------------------
    " Analysis for Reusable Query Elements
    "------------------------------------------------------------------

    "Get type and uid from view V_COMPDIR_ELTDIR
    SELECT SINGLE compuid deftp FROM v_compdir_eltdir
           INTO l_s_uid_deftp WHERE compid = i_compid."#EC CI_NOORDER
    IF sy-subrc = 0.
      l_uid   = l_s_uid_deftp-compuid.
      CLEAR l_iobjnm.
*     CASE l_deftp.
      CASE l_s_uid_deftp-deftp.
        WHEN 'VAR'.
          "Get iobjnm from view rszglobv
          SELECT SINGLE iobjnm FROM rszglobv "#EC CI_NOORDER "#EC CI_NOFIRST
                 INTO l_iobjnm WHERE vnam = i_compid." "#EC CI_NOFIELD
*************New ADÜ_20250430
          IF sy-subrc <> 0.
            "handled later in the Performer Suite
          ENDIF.
*************End ADÜ_20250430

      ENDCASE.
      PERFORM scan_compid USING i_compid i_version l_iobjnm l_uid
                          CHANGING l_t_data.
    ENDIF.

  ELSEIF i_uid IS NOT INITIAL.
    "------------------------------------------------------------------
    " Analysis for UID
    "------------------------------------------------------------------
    IF i_extended IS INITIAL.
      SELECT SINGLE deftp FROM v_compdir_eltdir  "#EC CI_NOORDER
        INTO CORRESPONDING FIELDS OF l_s_uid_deftp
        WHERE compuid = i_uid.
    ELSE.
      SELECT SINGLE deftp FROM rszeltdir  "#EC CI_NOORDER
      INTO CORRESPONDING FIELDS OF l_s_uid_deftp
      WHERE eltuid = i_uid.
    ENDIF.
    IF sy-subrc = 0.
      l_uid   = i_uid.
      PERFORM scan_compid USING i_compid i_version l_iobjnm l_uid
                          CHANGING l_t_data.
    ENDIF.

  ENDIF.

  "------------------------------------------------------------------
  " Exportparameter füllen
  "------------------------------------------------------------------
  "Tabelle T_DATA + T_DATA2
  LOOP AT l_t_data ASSIGNING <s_data>.
    AT FIRST.
      "Header Zeile für Exportparameter T_DATA2 erzeugen
      l_s_data2 = 'COMPUID;LEVEL;DEFT;COMPID;COMPUID_PARENT'.
      APPEND l_s_data2 TO t_data2[].
    ENDAT.

    "Parameter T_DATA
    MOVE-CORRESPONDING <s_data> TO l_s_data.
    APPEND l_s_data TO t_data[].

    "Parameter T_DATA2
    CLEAR l_s_data2.
    CONCATENATE
        <s_data>-compuid
        <s_data>-level
        <s_data>-deftp
        <s_data>-compid
        <s_data>-compuid_parent
      INTO l_s_data2 SEPARATED BY ';'.
    APPEND l_s_data2 TO t_data2[].
  ENDLOOP.

  "Doppelte Einträge löschen
  SORT t_data[] BY compuid.
  DELETE ADJACENT DUPLICATES FROM t_data[].

  "Tabelle T_DATA_RANGE
  LOOP AT l_t_data_range ASSIGNING <s_data_range>.
    AT FIRST."#EC CI_SORTED
      "Header Zeile für Exportparameter T_DATA_RANGE erzeugen
      l_s_data_range =
        'COMPUID;IOBJNM;SIGN;OPT;LOW;LOWFLAG;HIGH;HIGHFLAG;HIENM'.
      APPEND l_s_data_range TO t_data_range[].
    ENDAT.

    READ TABLE l_t_data ASSIGNING <s_data>
       WITH KEY compuid_parent = <s_data_range>-compuid.
    IF sy-subrc = 0.
      <s_data_range>-compuid = <s_data>-compuid.
    ENDIF.

    CLEAR l_s_data_range.
    CONCATENATE
        <s_data_range>-compuid
        <s_data_range>-iobjnm
        <s_data_range>-sign
        <s_data_range>-opt
        <s_data_range>-low
        <s_data_range>-lowflag
        <s_data_range>-high
        <s_data_range>-highflag
        <s_data_range>-hienm
      INTO l_s_data_range SEPARATED BY ';'.
    APPEND l_s_data_range TO t_data_range[].
  ENDLOOP.

ENDFUNCTION.


*&--------------------------------------------------------------------*
*&      Form  scan_attr_dis
*&--------------------------------------------------------------------*
FORM scan_attr_dis
  USING
    i_iobjnm
    i_attrinm
    i_version
  CHANGING
    c_t_data.

  DATA:
    l_t_eltuid  TYPE ty_t_eltuid,
    l_eltuid    TYPE sysuuid_25,
    l_s_data    TYPE ty_s_data_scan.

  FIELD-SYMBOLS:
    <s_data>    TYPE rsz_x_eltdir,
    <s_eltuid>  TYPE ty_s_eltuid.

  FREE l_t_eltuid.

  SELECT DISTINCT eltuid FROM rszeltattr INTO TABLE l_t_eltuid  "#EC CI_NOFIRST
    WHERE objvers = i_version
      AND iobjnm  = i_iobjnm
      AND attrinm = i_attrinm.

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

ENDFORM.                    "scan_attr_dis


*&--------------------------------------------------------------------*
*&      Form  scan_kyfnm
*&--------------------------------------------------------------------*
FORM scan_kyfnm
  USING
    i_iobjnm
    i_version
  CHANGING
    c_t_data.

  DATA:
    l_t_eltuid  TYPE ty_t_eltuid,
    l_eltuid    TYPE sysuuid_25,
    l_s_data    TYPE ty_s_data_scan.

  FIELD-SYMBOLS:
    <s_data>    TYPE rsz_x_eltdir,
    <s_eltuid>  TYPE ty_s_eltuid.

  "------------------------------------------------------------------
  " A] Kennzahl in Tabelle RSZRANGE suchen...
  "    (Eingeschränkte Kennzahl oder direkt in Query)
  "------------------------------------------------------------------
  FREE l_t_eltuid.

  SELECT DISTINCT eltuid FROM rszrange INTO TABLE l_t_eltuid  "#EC CI_NOFIRST
    WHERE objvers = i_version
      AND iobjnm  = rsd_c_metaiobj-keyfigure
      AND seltp   = rzd1_c_seltp-keyfig
      AND low     = i_iobjnm.

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

  "------------------------------------------------------------------
  " B] Kennzahl in Tabelle RSZCALC suchen...
  "    (Formel und berechnete Kennzahl)
  "------------------------------------------------------------------
  FREE l_t_eltuid.
  SELECT DISTINCT eltuid FROM rszcalc INTO TABLE l_t_eltuid "#EC CI_NOFIRST
    WHERE ( objvers = i_version                    )
      AND ( oper1   = i_iobjnm OR oper2 = i_iobjnm ).

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

ENDFORM.                    "scan_kyfnm


*&-------------------------------------------------------------------*
*&      Form  scan_value_sel
*&-------------------------------------------------------------------*
*       Search for characteristics with special selection
*--------------------------------------------------------------------*
FORM scan_value_sel
  USING
    i_value
    i_iobjnm
    i_version
    lt_chavl LIKE gt_chavl
  CHANGING
    c_t_data
    c_t_data_range TYPE ty_t_data_range.

  DATA:
    l_value        TYPE rschavl,
    l_eltuid       TYPE sysuuid_25,
    l_s_data       TYPE ty_s_data_scan,
    l_t_data_range TYPE ty_t_data_range.

  FIELD-SYMBOLS:
    <s_data_range> TYPE ty_s_data_range.

  FREE l_t_data_range.

  IF i_value CS '*' OR i_value CS '%'.
    l_value = i_value.
    REPLACE ALL OCCURRENCES OF '*' IN l_value WITH '%'.
    SELECT DISTINCT "#EC CI_NOFIRST
        eltuid
        iobjnm
        sign
        opt
        low
        lowflag
        high
        highflag
        hienm
      FROM rszrange INTO CORRESPONDING FIELDS OF TABLE l_t_data_range
      WHERE objvers = i_version
        AND iobjnm  LIKE i_iobjnm "1_8; support Nav-Attributes
         AND ( ( opt = 'EQ' AND low LIKE l_value AND lowflag = 1 )
           OR ( opt = 'BT' AND low <= l_value AND lowflag = 1
             AND high >= l_value AND highflag = 1 ) ).
  ELSEIF i_value IS NOT INITIAL.
    SELECT DISTINCT  "#EC CI_NOFIRST
        eltuid
        iobjnm
        sign
        opt
        low
        lowflag
        high
        highflag
        hienm
      FROM rszrange INTO CORRESPONDING FIELDS OF TABLE l_t_data_range
      WHERE objvers = i_version
        AND iobjnm  LIKE i_iobjnm"1_8; support Nav-Attributes
        AND ( ( opt = 'EQ' AND low = i_value )
         OR ( opt = 'BT' AND low <= i_value AND lowflag = 1
              AND high >= i_value  AND highflag = 1 ) ).
  ELSEIF lt_chavl IS NOT INITIAL. "Several values are passed (in table)
    SELECT DISTINCT  "#EC CI_NOFIRST
        eltuid
        iobjnm
        sign
        opt
        low
        lowflag
        high
        highflag
        hienm
      FROM rszrange INTO CORRESPONDING FIELDS OF TABLE l_t_data_range
      WHERE objvers =  i_version
        AND iobjnm  LIKE  i_iobjnm "1_8; support Nav-Attributes
        AND low     IN lt_chavl.
  ENDIF.

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_data_range ASSIGNING <s_data_range>.
    l_eltuid = <s_data_range>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid        = l_eltuid.
    l_s_data-compuid_parent = l_eltuid.

    <s_data_range>-compuid = l_eltuid.
    APPEND <s_data_range> TO c_t_data_range.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

ENDFORM.                    "scan_value_sel

*&-------------------------------------------------------------------*
*&      Form  scan_char
*&-------------------------------------------------------------------*
*--------------------------------------------------------------------
* A] Merkmale in Queries             -> RSZELTDIR
* B] Merkmale in Queries             -> RSZSELECT
* C] Merkmale in Ausnahmeaggregation -> RSZCALC
* D] Merkmale in Variablen           -> RSZGLOBV
* E] Merkmale als Attribut           -> RSZELTATTR
*--------------------------------------------------------------------
FORM scan_char
  USING
    i_iobjnm
    i_version
  CHANGING
    c_t_data.

  DATA:
    l_t_eltuid     TYPE ty_t_eltuid,
    l_eltuid       TYPE sysuuid_25,
    l_s_rszeltxref TYPE ty_s_rszeltxref,
    l_s_rszelttxt  TYPE rszelttxt,
    l_subrc        TYPE rs_bool,
    l_srch_attr    TYPE string,
    l_s_data       TYPE ty_s_data_scan.

  FIELD-SYMBOLS:
    <s_data>       TYPE ty_s_data_scan,
    <s_eltuid>     TYPE ty_s_eltuid,
    <s_rszcompdir> TYPE rszcompdir.

  CONCATENATE '%__' i_iobjnm INTO l_srch_attr.

  "------------------------------------------------------------------
  " A] RSZELTDIR
  "------------------------------------------------------------------
  FREE l_t_eltuid.
  SELECT DISTINCT eltuid FROM rszeltdir
    INTO CORRESPONDING FIELDS OF TABLE l_t_eltuid
    WHERE ( objvers     = i_version                                )
      AND ( defaulthint = i_iobjnm OR defaulthint LIKE l_srch_attr ).

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

  "------------------------------------------------------------------
  " B] RSZSELECT
  "------------------------------------------------------------------
  FREE l_t_eltuid.
  SELECT DISTINCT eltuid FROM rszselect  "#EC CI_NOFIRST
    INTO CORRESPONDING FIELDS OF TABLE l_t_eltuid
    WHERE objvers = i_version
      AND ( ( iobjnm = i_iobjnm OR coniobjnm = i_iobjnm )
       OR ( iobjnm LIKE l_srch_attr OR coniobjnm LIKE l_srch_attr ) ).

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

  "------------------------------------------------------------------
  " C] RSZCALC
  "------------------------------------------------------------------
  FREE l_t_eltuid.
  SELECT DISTINCT eltuid FROM rszcalc INTO TABLE l_t_eltuid "#EC CI_NOFIRST
    WHERE objvers = i_version
      AND ( aggrcha = i_iobjnm
       OR   aggrcha LIKE l_srch_attr ).

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

  "------------------------------------------------------------------
  " D] RSZGLOBV
  "------------------------------------------------------------------
  FREE l_t_eltuid.
  SELECT DISTINCT varuniid FROM rszglobv INTO TABLE l_t_eltuid
    WHERE objvers = i_version
      AND ( iobjnm = i_iobjnm
       OR   iobjnm LIKE l_srch_attr ).

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

  "--------------------------------------------------------------------
  " E] RSZELTATTR
  "--------------------------------------------------------------------
  "In case of 7.x Queries: Attributes are yet detected by selection
  "on table RSZELTDIR, but in case of 3.x Queries they have to be
  "detected by reading table RSZELTATTR
  FREE l_t_eltuid.
  SELECT DISTINCT eltuid FROM rszeltattr INTO TABLE l_t_eltuid  "#EC CI_NOFIRST
    WHERE objvers = i_version
      AND attrinm = i_iobjnm.

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_eltuid ASSIGNING <s_eltuid>.
    l_eltuid = <s_eltuid>-eltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.
  ENDLOOP.

ENDFORM.                    "scan_char


*&--------------------------------------------------------------------*
*&      Form  scan_compid
*&--------------------------------------------------------------------*
FORM scan_compid
  USING
    i_compid
    i_version
    i_iobjnm
    i_uid
  CHANGING
    c_t_data.

  DATA:
    l_eltuid       TYPE sysuuid_25,
    l_s_rszeltxref TYPE ty_s_rszeltxref,
    l_t_rszeltxref TYPE TABLE OF ty_s_rszeltxref,
    l_s_data       TYPE ty_s_data_scan.

  SELECT DISTINCT seltuid teltuid laytp FROM rszeltxref
    INTO TABLE l_t_rszeltxref
    WHERE objvers = i_version
      AND teltuid = i_uid.

  "Elemente anfügen und an den Elementen hochhangeln
  LOOP AT l_t_rszeltxref INTO l_s_rszeltxref.
    l_eltuid = l_s_rszeltxref-seltuid.

    CLEAR l_s_data.
    l_s_data-compuid_parent = l_eltuid.

    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_eltuid
        i_version
      CHANGING
        c_t_data
        l_s_data.

  ENDLOOP.

ENDFORM.                    "scan_compid


*&--------------------------------------------------------------------*
*&      Form  SCAN_QUERY_ELEM_PARENT
*&--------------------------------------------------------------------*
FORM scan_query_elem_parent
  USING
    i_iobjnm
    i_teltuid
    i_version
  CHANGING
    c_t_data         TYPE ty_t_data_scan
    c_s_data_parent  TYPE ty_s_data_scan.

  DATA:
    l_s_rszeltxref   TYPE ty_s_rszeltxref,
    l_t_rszeltxref   TYPE ty_t_rszeltxref,
    l_level          TYPE c LENGTH 4,
    l_compuid        TYPE sysuuid_25.

  "Handelt es sich um ein wiederverw. Query Element? => hinzufügen
  PERFORM add_record
    USING
      i_iobjnm
      i_teltuid
      i_version
    CHANGING
      c_t_data
      c_s_data_parent.

  l_level   = c_s_data_parent-level.
  l_compuid = c_s_data_parent-compuid.

  "Übergeordnete Elemete ermitteln (SELTUID)
  SELECT seltuid teltuid laytp FROM rszeltxref
    INTO TABLE l_t_rszeltxref
    WHERE objvers = 'A'
      AND teltuid = i_teltuid.

  LOOP AT l_t_rszeltxref INTO l_s_rszeltxref.

    c_s_data_parent-level   = l_level.
    c_s_data_parent-compuid = l_compuid.

    "Rekursion beenden?
    CHECK l_level < p_level_max.

    "Eine Stufe hoch (die oberste Ebene entspricht der Query)
    PERFORM scan_query_elem_parent
      USING
        i_iobjnm
        l_s_rszeltxref-seltuid
        i_version
      CHANGING
        c_t_data
        c_s_data_parent.

  ENDLOOP.

ENDFORM.                    "SCAN_QUERY_ELEM_PARENT


*&--------------------------------------------------------------------*
*&      Form  add_record
*&--------------------------------------------------------------------*
FORM add_record
  USING
    i_iobjnm        TYPE rsiobjnm
    i_eltuid        TYPE sysuuid_25
    i_version       TYPE rsobjvers
  CHANGING
    c_t_data        TYPE ty_t_data_scan
    c_s_data_parent TYPE ty_s_data_scan.

  DATA:
    l_s_data        TYPE ty_s_data_scan,
    l_s_rszglobv    TYPE rszglobv,
    l_level         TYPE c LENGTH 4.

  FIELD-SYMBOLS:
    <s_rszcompdir> TYPE rszcompdir.

  "------------------------------------------------------------------
  " Wiederverwendbares Element?
  "------------------------------------------------------------------
  READ TABLE g_t_rszcompdir ASSIGNING <s_rszcompdir>
   WITH TABLE KEY compuid = i_eltuid.
  IF sy-subrc = 0.

    CLEAR l_s_data.
    MOVE <s_rszcompdir>-compuid  TO l_s_data-compuid.
    MOVE <s_rszcompdir>-compid   TO l_s_data-compid.
    MOVE <s_rszcompdir>-version  TO l_s_data-version.
    MOVE <s_rszcompdir>-tstpnm   TO l_s_data-tstpnm.
    MOVE <s_rszcompdir>-timestmp TO l_s_data-timestmp.

    l_level = c_s_data_parent-level + '0001'.
    MOVE l_level                 TO l_s_data-level.
    MOVE c_s_data_parent-compuid TO l_s_data-compuid_parent.

    "Datensatz schon vorhanden?
    READ TABLE c_t_data TRANSPORTING NO FIELDS
      WITH KEY
        compuid        = <s_rszcompdir>-compuid
        compuid_parent = l_s_data-compuid_parent.

    IF sy-subrc NE 0.

*    IF l_s_data-compuid NE l_s_data-compuid_parent.

      IF l_s_data-compuid EQ l_s_data-compuid_parent.
        CLEAR l_s_data-compuid_parent.
      ENDIF.

      "Zusätzl. Infos aus RSZCOMPIC
      SELECT SINGLE infocube FROM rszcompic INTO l_s_data-infocube
        WHERE compuid = i_eltuid
          AND objvers = i_version. "#EC CI_NOORDER

      "Zusätzl. Infos lesen aus RSZELTDIR
      SELECT SINGLE deftp FROM rszeltdir INTO (l_s_data-deftp)
        WHERE eltuid  = i_eltuid
          AND objvers = i_version.

      "Zusätzl. Infos aus V_CMP_JOIN
      SELECT SINGLE deftp FROM v_cmp_join INTO (l_s_data-deftp)
        WHERE compuid = i_eltuid
          AND objvers = i_version."#EC CI_NOORDER

      "Text lesen aus RSZELTTXT
      SELECT SINGLE txtlg FROM rszelttxt INTO l_s_data-txtlg
        WHERE eltuid  = l_s_data-compuid
          AND objvers = i_version
          AND langu   = sy-langu.

      INSERT l_s_data INTO TABLE c_t_data.

*     ENDIF.

      "Letzten Satz für Level und Vorgänger merken
      c_s_data_parent = l_s_data.

    ENDIF.

    RETURN.

  ENDIF.

*  "------------------------------------------------------------------
*  " Variable?
*  "------------------------------------------------------------------
  SELECT SINGLE * FROM rszglobv INTO l_s_rszglobv
    WHERE varuniid = i_eltuid
      AND objvers  = 'A'."#EC CI_ALL_FIELDS_NEEDED

  IF sy-subrc = 0.
    l_s_data-compuid = l_s_rszglobv-varuniid.
    l_s_data-compid  = l_s_rszglobv-vnam.
    INSERT l_s_data INTO TABLE c_t_data.
  ENDIF.

ENDFORM.                    " ADD_RECORD

Z_RFC_GET_STRING v1_9

Source Code of Z_RFC_GET_STRING v1_9
ABAP
FUNCTION z_rfc_get_string
  IMPORTING
    VALUE(i_table) TYPE dd02l-tabname
    VALUE(i_field) TYPE feld_name OPTIONAL
    VALUE(i_rawstring) TYPE sonv-flag OPTIONAL
    VALUE(i_scan_string) TYPE char80 OPTIONAL
    VALUE(i_scan_field) TYPE feld_name OPTIONAL
    VALUE(i_rowcount) TYPE soid-accnt DEFAULT 0
    VALUE(i_decryption) TYPE sonv-flag DEFAULT 'X'
    VALUE(i_databufferdecompress) TYPE sonv-flag DEFAULT ''
    VALUE(i_limit) TYPE int4 DEFAULT -1
    VALUE(i_offset) TYPE int4 DEFAULT -1
  EXPORTING
    VALUE(e_string) TYPE string
    VALUE(e_stringtab) TYPE stringtab
    VALUE(e_rc) TYPE int4
    VALUE(e_msg) TYPE string
  TABLES
    t_fields LIKE rfc_db_fld
    t_options LIKE rtxtldat
  EXCEPTIONS
    release_1_9
    not_authorized
    table_not_available
    buffer_overflow
    conversion_codepage
    codepage_converter_init
    parameter_invalid_type
    parameter_invalid_range.



  "Check Auth.
  CALL FUNCTION 'VIEW_AUTHORITY_CHECK'
    EXPORTING
      view_action                    = 'S'
      view_name                      = i_table
    EXCEPTIONS
      no_authority                   = 2
      no_clientindependent_authority = 2
      no_linedependent_authority     = 2
      OTHERS                         = 1.

  IF sy-subrc = 2.
    RAISE not_authorized.
  ELSEIF sy-subrc = 1.
    RAISE table_not_available.
  ENDIF.

  DATA:
    lr_error     TYPE REF TO cx_root,
    lr_dataref   TYPE REF TO data,
    lv_rawstring TYPE rswr_data_xstring,
    lv_zip       TYPE c LENGTH 1.

* Variables
  DATA:
    lv_string     TYPE string,
    lv_decrypt    TYPE string,
    lv_temp       TYPE string,
    ls_dfies      TYPE dfies,
    lt_dfields    TYPE ddfields,
    lt_alldfields TYPE ddfields,
    lt_stringtab  TYPE stringtab, "temp. result table
    lv_skip       TYPE c LENGTH 1. "Flag for skipping dataset insert
  FIELD-SYMBOLS:
    <lt_tab>  TYPE ANY TABLE,
    <ls_line> TYPE any,
    <lv_any>  TYPE any.

*************New ADÜ_20240209
        DATA: lt_fieldnames TYPE TABLE OF fieldname,
              lv_fieldnames TYPE string,
              lt_keyfields type table of fieldname,
              lv_keyfields type string.
*************End New ADÜ_20240209

  IF i_field IS INITIAL.
*catch any exception and pass message along to caller
    TRY.

*Get meta data for table
        CALL FUNCTION 'DDIF_NAMETAB_GET'
          EXPORTING
            tabname   = i_table
          TABLES
            dfies_tab = lt_alldfields
          EXCEPTIONS
            OTHERS    = 2.

        IF sy-subrc <> 0.
          e_rc = 4.
          e_msg = 'TABLE NOT FOUND, PLEASE TRY AGAIN.'.
          RETURN.
        ENDIF.

        IF t_fields[] IS INITIAL.
*No restrictions provided; use all fields
          lt_dfields = lt_alldfields.
        ELSE.
*Verify that all fieldnames specified exist in table
          LOOP AT t_fields ASSIGNING <lv_any>.
            READ TABLE lt_alldfields INTO ls_dfies
            WITH KEY fieldname = <lv_any>.
            IF sy-subrc <> 0.
*Specified field not found in table
              e_rc = 4.
              CONCATENATE 'FIELD' <lv_any> 'NOT FOUND IN TABLE' i_table
              INTO e_msg SEPARATED BY space.
              RETURN.
            ENDIF.
*Fieldname found; insert line into working dfies table
            INSERT ls_dfies INTO TABLE lt_dfields.
            "NEW  06.02.2024
            INSERT ls_dfies-fieldname INTO TABLE lt_fieldnames.
          ENDLOOP.
        ENDIF.

        CREATE DATA lr_dataref TYPE STANDARD TABLE OF (i_table).
        ASSIGN lr_dataref->* TO <lt_tab>.

*************New ADÜ_20240209
        loop at lt_dfields into ls_dfies.
          if ls_dfies-keyflag = 'X'.
            insert ls_dfies-fieldname INTO TABLE lt_keyfields.
          endif.
        endloop.

        CONCATENATE lines of lt_fieldnames INTO lv_fieldnames SEPARATED BY ', '.
        CONCATENATE lines of lt_keyfields INTO lv_keyfields SEPARATED BY ', '.

        IF i_limit <= 0.
          IF i_offset <= 0.
            SELECT (lv_fieldnames) FROM (i_table) WHERE (t_options) INTO CORRESPONDING FIELDS OF TABLE @<lt_tab> .
          ELSE.
            SELECT (lv_fieldnames) FROM (i_table) WHERE (t_options) Order by (lv_keyfields) INTO CORRESPONDING FIELDS OF TABLE @<lt_tab> OFFSET @i_offset.
          ENDIF.
        ELSE.
          IF i_offset <= 0.
            SELECT (lv_fieldnames) FROM (i_table) WHERE (t_options) INTO CORRESPONDING FIELDS OF TABLE @<lt_tab> UP TO @i_limit ROWS.
          ELSE.
            SELECT (lv_fieldnames) FROM (i_table) WHERE (t_options) Order by (lv_keyfields) INTO CORRESPONDING FIELDS OF TABLE @<lt_tab> UP TO @i_limit ROWS OFFSET @i_offset.
          ENDIF.
        ENDIF.
*************End New ADÜ_20240209

*************New ADÜ_20180209
        IF i_databufferdecompress = 'X' AND i_table = 'RSBKCMD'.
          DATA: lt_rsbkcmd  TYPE TABLE OF rsbkcmd,
                ls_rsbkcmd  TYPE rsbkcmd,
                lt_rsbkcmd2 TYPE TABLE OF rsbkcmd.

          lt_rsbkcmd = <lt_tab>.
          CLEAR <lt_tab>.

          LOOP AT lt_rsbkcmd INTO ls_rsbkcmd.
            IF ls_rsbkcmd-cmd = 'COMPRESS'.
              IMPORT instances TO lt_rsbkcmd2 FROM DATA BUFFER ls_rsbkcmd-tpl_instance.
              INSERT LINES OF lt_rsbkcmd2 INTO TABLE <lt_tab>.
              CLEAR lt_rsbkcmd2.
            ELSE.
              INSERT ls_rsbkcmd INTO TABLE <lt_tab>.
            ENDIF.
          ENDLOOP.
        ENDIF.
************End New ADÜ_20180209

        LOOP AT <lt_tab> ASSIGNING <ls_line>.

          FREE lt_stringtab.

          LOOP AT lt_dfields INTO ls_dfies.
            CLEAR: lv_string, lv_decrypt.
            ASSIGN COMPONENT ls_dfies-position
               OF STRUCTURE <ls_line> TO <lv_any>.
            lv_temp = <lv_any>. "force the type conversion

            "Zipped?
            IF ls_dfies-fieldname = 'COMPRESSION'.
              lv_zip = lv_temp.
            ENDIF.

            "special treatment for RAWSTRING fields
            IF ls_dfies-datatype = 'RSTR' AND i_decryption = 'X'.
              lv_rawstring = lv_temp.
              PERFORM decrypt_rawstring
                USING lv_zip lv_rawstring CHANGING lv_decrypt.
              e_string = lv_decrypt.
              lv_temp = lv_decrypt.
            ENDIF.

            lv_string = lv_temp.
            INSERT lv_string INTO TABLE lt_stringtab.
            "In case a string scan is done check if found
            IF i_scan_string IS NOT INITIAL.
              IF i_scan_field = ls_dfies-fieldname.
                IF lv_string CP i_scan_string.
                  CLEAR lv_skip.
                ELSE."string not found
                  lv_skip = 'X'.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDLOOP.

          "In case scan had no hit -> no insert in result table
          IF lv_skip IS INITIAL.
            APPEND LINES OF lt_stringtab  TO e_stringtab.
          ENDIF.

          "Exit if a rowcount restriction was set
          IF i_rowcount > 0 AND sy-tabix GE i_rowcount.
            EXIT.
          ENDIF.

        ENDLOOP.

      CATCH cx_root INTO lr_error.
        e_rc = 4.
        e_msg = lr_error->get_text( ).
    ENDTRY.

  ELSE."read single line and field
    IF i_rawstring = 'X' AND i_decryption = 'X'.
      SELECT SINGLE (i_field) FROM (i_table)
         INTO lv_rawstring WHERE (t_options).
*************New ADÜ_20250430
      IF sy-subrc <> 0.
      "handled later in the Performer Suite
      ENDIF.
*************End ADÜ_20250430
      CLEAR lv_zip.
      PERFORM decrypt_rawstring
         USING lv_zip lv_rawstring CHANGING lv_decrypt.
      e_string = lv_decrypt.
      "BEGIN NEW
    ELSEIF i_rawstring = 'X' AND i_decryption = ''.
      SELECT SINGLE (i_field) FROM (i_table)
       INTO lv_rawstring WHERE (t_options).
*************New ADÜ_20250430
      IF sy-subrc <> 0.
      "handled later in the Performer Suite
      ENDIF.
*************End ADÜ_20250430
      e_string = lv_rawstring.
      "END NEW
    ELSE.
      SELECT SINGLE (i_field) FROM (i_table)
       INTO e_string WHERE (t_options).
*************New ADÜ_20250430
      IF sy-subrc <> 0.
      "handled later in the Performer Suite
      ENDIF.
*************End ADÜ_20250430
    ENDIF.
  ENDIF.

ENDFUNCTION.

*&--------------------------------------------------------------------*
*&      Form  decrypt_rawstring
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM decrypt_rawstring USING lv_zip lv_rawstring CHANGING lv_decrypt.

  "Transform rawstring to text
  DATA: lv_converter TYPE REF TO cl_abap_conv_in_ce.
  DATA: lv_xstring   TYPE xstring.


*     unzip if compressed
  IF NOT lv_zip IS INITIAL.
    TRY.
        cl_abap_gzip=>decompress_binary(
                    EXPORTING
                         gzip_in = lv_rawstring
                    IMPORTING
                         raw_out = lv_xstring ).
      CATCH: cx_parameter_invalid_range cx_sy_buffer_overflow.
*************New ADÜ_20250625
        RAISE buffer_overflow.
*************End ADÜ_20250625
    ENDTRY.
  ELSE.
    lv_xstring = lv_rawstring.
  ENDIF.

*     read
  lv_converter = cl_abap_conv_in_ce=>create(
                    input       = lv_xstring
                    encoding    = 'UTF-8'
                    replacement = '?'
                    ignore_cerr = abap_true ).

  TRY.
      CALL METHOD lv_converter->read( IMPORTING data = lv_decrypt ).
    CATCH cx_sy_conversion_codepage.
*************New ADÜ_20250625
        RAISE conversion_codepage.
*************End ADÜ_20250625
*-- Should ignore errors in code conversions
    CATCH cx_sy_codepage_converter_init.
*************New ADÜ_20250625
        RAISE codepage_converter_init.
*************End ADÜ_20250625
*-- Should ignore errors in code conversions
    CATCH cx_parameter_invalid_type.
*************New ADÜ_20250625
        RAISE parameter_invalid_type.
*************End ADÜ_20250625
    CATCH cx_parameter_invalid_range.
*************New ADÜ_20250625
        RAISE parameter_invalid_range.
*************End ADÜ_20250625

  ENDTRY.

ENDFORM.                    "decrypt_rawstring

Z_RFC_GET_STRING v1_7
(info) If SAP_BASIS RELEASE < 7.51 SP13

Source Code of Z_RFC_GET_STRING v1_7
ABAP
FUNCTION Z_RFC_GET_STRING
  IMPORTING
    VALUE(I_TABLE) TYPE DD02L-TABNAME
    VALUE(I_FIELD) TYPE FELD_NAME OPTIONAL
    VALUE(I_RAWSTRING) TYPE SONV-FLAG OPTIONAL
    VALUE(I_SCAN_STRING) TYPE CHAR80 OPTIONAL
    VALUE(I_SCAN_FIELD) TYPE FELD_NAME OPTIONAL
    VALUE(I_ROWCOUNT) TYPE SOID-ACCNT DEFAULT 0
    VALUE(I_DECRYPTION) TYPE SONV-FLAG DEFAULT 'X'
    VALUE(I_DATABUFFERDECOMPRESS) TYPE SONV-FLAG DEFAULT ''
  EXPORTING
    VALUE(E_STRING) TYPE STRING
    VALUE(E_STRINGTAB) TYPE STRINGTAB
    VALUE(E_RC) TYPE INT4
    VALUE(E_MSG) TYPE STRING
  TABLES
    T_FIELDS LIKE RFC_DB_FLD
    T_OPTIONS LIKE RTXTLDAT
  EXCEPTIONS
    RELEASE_1_7
    NOT_AUTHORIZED
    TABLE_NOT_AVAILABLE.



  "Check Auth.
  CALL FUNCTION 'VIEW_AUTHORITY_CHECK'
    EXPORTING
      view_action                    = 'S'
      view_name                      = i_table
    EXCEPTIONS
      no_authority                   = 2
      no_clientindependent_authority = 2
      no_linedependent_authority     = 2
      OTHERS                         = 1.

  IF sy-subrc = 2.
    RAISE not_authorized.
  ELSEIF sy-subrc = 1.
    RAISE table_not_available.
  ENDIF.

  DATA:
    lr_error     TYPE REF TO cx_root,
    lr_dataref   TYPE REF TO data,
    lv_rawstring TYPE rswr_data_xstring,
    lv_zip       TYPE c LENGTH 1.

* Variables
  DATA:
    lv_string     TYPE string,
    lv_decrypt    TYPE string,
    lv_temp       TYPE string,
    ls_dfies      TYPE dfies,
    lt_dfields    TYPE ddfields,
    lt_alldfields TYPE ddfields,
    lt_stringtab  TYPE stringtab, "temp. result table
    lv_skip       TYPE c LENGTH 1. "Flag for skipping dataset insert
  FIELD-SYMBOLS:
    <lt_tab>  TYPE ANY TABLE,
    <ls_line> TYPE any,
    <lv_any>  TYPE any.


  IF i_field IS INITIAL.
*catch any exception and pass message along to caller
    TRY.

*Get meta data for table
        CALL FUNCTION 'DDIF_NAMETAB_GET'
          EXPORTING
            tabname   = i_table
          TABLES
            dfies_tab = lt_alldfields
          EXCEPTIONS
            OTHERS    = 2.

        IF sy-subrc <> 0.
          e_rc = 4.
          e_msg = 'TABLE NOT FOUND, PLEASE TRY AGAIN.'.
          RETURN.
        ENDIF.

        IF t_fields[] IS INITIAL.
*No restrictions provided; use all fields
          lt_dfields = lt_alldfields.
        ELSE.
*Verify that all fieldnames specified exist in table
          LOOP AT t_fields ASSIGNING <lv_any>.
            READ TABLE lt_alldfields INTO ls_dfies
            WITH KEY fieldname = <lv_any>.
            IF sy-subrc <> 0.
*Specified field not found in table
              e_rc = 4.
              CONCATENATE 'FIELD' <lv_any> 'NOT FOUND IN TABLE' i_table
              INTO e_msg SEPARATED BY space.
              RETURN.
            ENDIF.
*Fieldname found; insert line into working dfies table
            INSERT ls_dfies INTO TABLE lt_dfields.
          ENDLOOP.
        ENDIF.

        CREATE DATA lr_dataref TYPE STANDARD TABLE OF (i_table).
        ASSIGN lr_dataref->* TO <lt_tab>.

        SELECT * FROM (i_table) INTO TABLE <lt_tab>
        WHERE (t_options).

*************New ADÜ_20180209
        IF i_databufferdecompress = 'X' AND i_table = 'RSBKCMD'.
          DATA: lt_rsbkcmd  TYPE TABLE OF rsbkcmd,
                ls_rsbkcmd  TYPE rsbkcmd,
                lt_rsbkcmd2 TYPE TABLE OF rsbkcmd.

          lt_rsbkcmd = <lt_tab>.
          CLEAR <lt_tab>.

          LOOP AT lt_rsbkcmd INTO ls_rsbkcmd.
            IF ls_rsbkcmd-cmd = 'COMPRESS'.
              IMPORT instances TO lt_rsbkcmd2 FROM DATA BUFFER ls_rsbkcmd-tpl_instance.
              INSERT LINES OF lt_rsbkcmd2 INTO TABLE <lt_tab>.
              CLEAR lt_rsbkcmd2.
            ELSE.
              INSERT ls_rsbkcmd INTO TABLE <lt_tab>.
            ENDIF.
          ENDLOOP.
        ENDIF.
************End New ADÜ_20180209

        LOOP AT <lt_tab> ASSIGNING <ls_line>.

          FREE lt_stringtab.

          LOOP AT lt_dfields INTO ls_dfies.
            CLEAR: lv_string, lv_decrypt.
            ASSIGN COMPONENT ls_dfies-position
               OF STRUCTURE <ls_line> TO <lv_any>.
            lv_temp = <lv_any>. "force the type conversion

            "Zipped?
            IF ls_dfies-fieldname = 'COMPRESSION'.
              lv_zip = lv_temp.
            ENDIF.

            "special treatment for RAWSTRING fields
            IF ls_dfies-datatype = 'RSTR' AND i_decryption = 'X'.
              lv_rawstring = lv_temp.
              PERFORM decrypt_rawstring
                USING lv_zip lv_rawstring CHANGING lv_decrypt.
              e_string = lv_decrypt.
              lv_temp = lv_decrypt.
            ENDIF.

            lv_string = lv_temp.
            INSERT lv_string INTO TABLE lt_stringtab.
            "In case a string scan is done check if found
            IF i_scan_string IS NOT INITIAL.
              IF i_scan_field = ls_dfies-fieldname.
                IF lv_string CP i_scan_string.
                  CLEAR lv_skip.
                ELSE."string not found
                  lv_skip = 'X'.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDLOOP.

          "In case scan had no hit -> no insert in result table
          IF lv_skip IS INITIAL.
            APPEND LINES OF lt_stringtab  TO e_stringtab.
          ENDIF.

          "Exit if a rowcount restriction was set
          IF i_rowcount > 0 AND sy-tabix GE i_rowcount.
            EXIT.
          ENDIF.

        ENDLOOP.

      CATCH cx_root INTO lr_error.
        e_rc = 4.
        e_msg = lr_error->get_text( ).
    ENDTRY.

  ELSE."read single line and field
    IF i_rawstring = 'X' AND i_decryption = 'X'.
      SELECT SINGLE (i_field) FROM (i_table)
         INTO lv_rawstring WHERE (t_options).
*************New ADÜ_20250430
      IF sy-subrc <> 0.
      "handled later in the Performer Suite
      ENDIF.
*************End ADÜ_20250430
      CLEAR lv_zip.
      PERFORM decrypt_rawstring
         USING lv_zip lv_rawstring CHANGING lv_decrypt.
      e_string = lv_decrypt.
      "BEGIN NEW
    ELSEIF i_rawstring = 'X' AND i_decryption = ''.
      SELECT SINGLE (i_field) FROM (i_table)
       INTO lv_rawstring WHERE (t_options).
*************New ADÜ_20250430
      IF sy-subrc <> 0.
      "handled later in the Performer Suite
      ENDIF.
*************End ADÜ_20250430
      e_string = lv_rawstring.
      "END NEW
    ELSE.
      SELECT SINGLE (i_field) FROM (i_table)
       INTO e_string WHERE (t_options).
*************New ADÜ_20250430
      IF sy-subrc <> 0.
      "handled later in the Performer Suite
    ENDIF.
*************End ADÜ_20250430
  ENDIF.
 ENDIF.

ENDFUNCTION.

*&--------------------------------------------------------------------*
*&      Form  decrypt_rawstring
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM decrypt_rawstring USING lv_zip lv_rawstring CHANGING lv_decrypt.

  "Transform rawstring to text
  DATA: lv_converter TYPE REF TO cl_abap_conv_in_ce.
  DATA: lv_xstring   TYPE xstring.


*     unzip if compressed
  IF NOT lv_zip IS INITIAL.
    TRY.
        cl_abap_gzip=>decompress_binary(
                    EXPORTING
                         gzip_in = lv_rawstring
                    IMPORTING
                         raw_out = lv_xstring ).
      CATCH: cx_parameter_invalid_range cx_sy_buffer_overflow.
*************New ADÜ_20250625
        RAISE buffer_overflow.
*************End ADÜ_20250625
    ENDTRY.
  ELSE.
    lv_xstring = lv_rawstring.
  ENDIF.

*     read
  lv_converter = cl_abap_conv_in_ce=>create(
                    input       = lv_xstring
                    encoding    = 'UTF-8'
                    replacement = '?'
                    ignore_cerr = abap_true ).

  TRY.
      CALL METHOD lv_converter->read( IMPORTING data = lv_decrypt ).
    CATCH cx_sy_conversion_codepage.
*************New ADÜ_20250625
        RAISE conversion_codepage.
*************End ADÜ_20250625
*-- Should ignore errors in code conversions
    CATCH cx_sy_codepage_converter_init.
*************New ADÜ_20250625
        RAISE codepage_converter_init.
*************End ADÜ_20250625
*-- Should ignore errors in code conversions
    CATCH cx_parameter_invalid_type.
*************New ADÜ_20250625
        RAISE parameter_invalid_type.
*************End ADÜ_20250625
    CATCH cx_parameter_invalid_range.
*************New ADÜ_20250625
        RAISE parameter_invalid_range.
*************End ADÜ_20250625

  ENDTRY.

ENDFORM.                    "decrypt_rawstring

Z_RFC_TRANSLATION v1_3

Source Code of Z_RFC_TRANSLATION
ABAP
FUNCTION Z_RFC_TRANSLATION
  IMPORTING
    VALUE(I_DELIMITER) LIKE SONV-FLAG DEFAULT '¦'
  TABLES
    T_VALUES LIKE TAB512
  EXCEPTIONS
    RELEASE_1_3
    NOT_AUTHORIZED.




  field-symbols: <fs_values>    type tab512,
                 <fieldname>    type string,
                 <target_struc> type any,
                 <fieldvalue>   type any.

  data:
    ls_tab          type tab512,
    lt_fieldnames   type standard table of string,
    lt_values       type standard table of string,
    lr_target_struc type ref to data,
    lv_tabname      type tabname,
    lv_value        type string,
    lv_fieldname    type string.

  "get fields from first dataset
  read table t_values[] into ls_tab index 1.
  if sy-subrc <> 0.
    "empty table passed - not valid
    return.
  endif.


  loop at t_values[] assigning <fs_values>.

    clear: lv_value, lv_tabname.
    free: lt_fieldnames, lt_values.
    split <fs_values>  at i_delimiter into table lt_fieldnames.

    "Get table
    loop at lt_fieldnames[] assigning <fieldname>.

      if <fieldname>(5) eq 'TABLE'.

        split <fieldname> at '===' into table lt_values.
        read table lt_values into lv_value index 2.
        if sy-subrc = 0.
          lv_tabname = lv_value.
          exit.
        endif.

      endif.
    endloop.

    "create table structure dynamically
    free lr_target_struc.
    create data lr_target_struc type (lv_tabname).
    assign lr_target_struc->* to <target_struc>.

    "Write fields
    loop at lt_fieldnames[] assigning <fieldname>.

      clear: lv_value.
      free: lt_values.

      if <fieldname>(5) eq 'TABLE'.
        continue.
      endif.

      split <fieldname> at '===' into table lt_values.
      read table lt_values into lv_fieldname index 1.
      if sy-subrc <> 0.
        continue.
      endif.
      read table lt_values into lv_value index 2.
      if sy-subrc <> 0.
        continue.
      endif.

      assign component lv_fieldname of structure <target_struc>
       to <fieldvalue>.
      if sy-subrc <> 0.
        write:/ 'FIELD ', <fieldname>, 'NOT FOUND'.
        continue.
      endif.

      <fieldvalue> = lv_value.

    endloop.
*BEGIN New ADü_20250328
    authority-check object 'S_TABU_NAM'
    id 'ACTVT' field '02'
    id 'TABLE' field lv_tabname.
    if sy-subrc <> 0.
      raise not_authorized.
    else.
*END New ADü_20250328
      modify (lv_tabname) from <target_struc>.
*BEGIN New ADü_20250328
    endif.
*END New ADü_20250328

  endloop.

  call function 'DB_COMMIT'.


endfunction.

Z_RFC_ADSO_GETDTL_XML v1_2

Source Code of Z_RFC_ADSO_GETDTL_XML
ABAP
FUNCTION Z_RFC_ADSO_GETDTL_XML
  IMPORTING
    VALUE(I_ADSONM) TYPE RSOADSONM
  EXPORTING
    VALUE(E_TEXT) TYPE RSOADSODESCR
    VALUE(E_INFOAREA) TYPE RSINFOAREA
    VALUE(EV_ADSOFLAGS_XML) TYPE STRING
    VALUE(EV_OBJECT_XML) TYPE STRING
    VALUE(EV_DIMENSION_XML) TYPE STRING
    VALUE(EV_KEY_XML) TYPE STRING
    VALUE(EV_HASH_XML) TYPE STRING
    VALUE(EV_INDEX_XML) TYPE STRING
    VALUE(EV_PARTITION_XML) TYPE STRING
    VALUE(EV_CHA_CONST_XML) TYPE STRING
    VALUE(EV_VALIDITY_XML) TYPE STRING
  EXCEPTIONS
    RELEASE_1_2
    NOT_AUTHORIZED.



  data: lt_parameters type abap_parmbind_tab.
  data: ls_parameter  type abap_parmbind.
  data: lo_ref        type ref to data.
*****20210422 ADü_Begin Bug DP-5283
  data: objvers_a     type rsobjvers value 'A'.
*****20210422 ADü_End

  field-symbols: <any> type any.

  " get method parameter types
  select
  sconame,
  type
  from seosubcodf
  into table @data(lt_method_param_types)
  where clsname = 'CL_RSO_ADSO_API'
    and cmpname = 'READ'
    and type <> ''
  order by editorder.

  loop at lt_method_param_types assigning field-symbol(<ls_method_param_type>).
    try.
        create data lo_ref type (<ls_method_param_type>-type).
      catch cx_sy_create_data_error.
        " probably type of class
        data(lv_type) = |CL_RSO_ADSO_API=>{ <ls_method_param_type>-type }|.
        try.
            create data lo_ref type (lv_type).
          catch cx_sy_create_data_error..
            " no plan c
            exit.
        endtry.
    endtry.

    case <ls_method_param_type>-sconame+0(1).
      when 'E'.
        data(lv_kind) = cl_abap_objectdescr=>importing.
      when 'I'.
        lv_kind =  cl_abap_objectdescr=>exporting.
      when others.
        exit.
    endcase.

    ls_parameter = value abap_parmbind(
        name  = <ls_method_param_type>-sconame
        kind  = lv_kind
        value = lo_ref  ).
*****20210422 ADü_Begin Bug DP-5283
    if ls_parameter-name = 'I_OBJVERS'.
      assign lo_ref->* to <any>.
      <any> = objvers_a.
    endif.
*****20210422 ADü_End
    insert ls_parameter into table lt_parameters.
    free: ls_parameter.
*****20210422 ADü_Begin Bug DP-5283
    unassign <any>.
*****20210422 ADü_End

  endloop.

  read table lt_parameters assigning field-symbol(<ls_parameter>) with key name = 'I_ADSONM'.
  if sy-subrc = 0.
    assign <ls_parameter>-value->* to <any>.
    <any> = i_adsonm.
  endif.

  try.
*BEGIN New ADü_20250328
      authority-check object 'S_RS_ADSO'
       id 'RSINFOAREA' field '*'
       id 'RSOADSONM' field '*'
       id 'RSOADSOPAR' field '*'
       id 'ACTVT' field '03'.
      if sy-subrc <> 0.
        raise not_authorized.
      else.
*END New ADü_20250328
        call method ('CL_RSO_ADSO_API')=>read parameter-table lt_parameters.
*BEGIN New ADü_20250328
      endif.
*END New ADü_20250328
    catch cx_root. " catch all errors and exit -> no exceptions defined
      return.
  endtry.

  " Transform to XML for Export
  loop at lt_parameters assigning <ls_parameter>.

    assign <ls_parameter>-value->*  to <any>.
    " For easier consumption in the create Module switch the naming in XML to I_
    " for the importing Parameters of the create method
    if <ls_parameter>-name+0(1) = 'E'.
      data(lv_name) = |I{ <ls_parameter>-name+1(29) }|.
    else.
      lv_name = <ls_parameter>-name.
    endif.

    data(lt_srcbind) = value abap_trans_srcbind_tab( (
    name  = lv_name
    value = <ls_parameter>-value ) ).

    case <ls_parameter>-name.
      when 'E_TEXT'.
        e_text = <any>.
      when 'E_INFOAREA'.
        e_infoarea = <any>..
      when 'E_S_ADSOFLAGS'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_adsoflags_xml.
      when 'E_T_OBJECT'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_object_xml.
      when 'E_T_DIMENSION'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_dimension_xml.
      when 'E_T_KEY'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_key_xml.
      when 'E_T_HASH'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_hash_xml.
      when 'E_T_INDEX'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_index_xml.
      when 'E_T_PARTITION'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_partition_xml.
      when 'E_T_CHA_CONST'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_cha_const_xml.
      when 'E_T_VALIDITY'.
        call transformation (`ID`) source (lt_srcbind) result xml ev_validity_xml.
    endcase.
  endloop.

endfunction.

Z_RFC_ADSO_CREATE_XML v1_3

Source Code of Z_RFC_ADSO_CREATE_XML
ABAP
FUNCTION Z_RFC_ADSO_CREATE_XML
  IMPORTING
    VALUE(I_ADSONM) TYPE RSOADSONM
    VALUE(I_TEXT) TYPE RSOADSODESCR OPTIONAL
    VALUE(I_INFOAREA) TYPE RSINFOAREA OPTIONAL
    VALUE(IV_ADSOFLAGS) TYPE STRING
    VALUE(IV_OBJECT) TYPE STRING
    VALUE(IV_DIMENSION) TYPE STRING
    VALUE(IV_KEY) TYPE STRING
    VALUE(IV_HASH) TYPE STRING
    VALUE(IV_INDEX) TYPE STRING
    VALUE(IV_PARTITION) TYPE STRING
    VALUE(IV_CHA_CONST) TYPE STRING
    VALUE(IV_VALIDITY) TYPE STRING
  EXCEPTIONS
    NOT_ACTIVE
    NOT_CREATED
    RELEASE_1_3
    NOT_AUTHORIZED.



   DATA: lt_resbind    TYPE abap_trans_resbind_tab.
   DATA: ls_resbind    TYPE abap_trans_resbind.
   DATA: lt_parameters TYPE abap_parmbind_tab.
   DATA: ls_parameter  TYPE abap_parmbind.
   DATA: lo_ref        TYPE REF TO data.

   FIELD-SYMBOLS: <any> TYPE any.

   " get method parameter types
   SELECT
   sconame,
   type
   FROM seosubcodf
   INTO TABLE @DATA(lt_method_param_types)
   WHERE clsname = 'CL_RSO_ADSO_API'
     AND cmpname = 'CREATE'
     AND type <> ''
   ORDER BY editorder.

   LOOP AT lt_method_param_types ASSIGNING FIELD-SYMBOL(<ls_method_param_type>).
     FREE: ls_parameter, ls_resbind, lt_resbind.

     TRY. " create data reference for parameter
         CREATE DATA lo_ref TYPE (<ls_method_param_type>-type).
       CATCH cx_sy_create_data_error.
         " probably type of class
         DATA(lv_type) = |CL_RSO_ADSO_API=>{ <ls_method_param_type>-type }|.
         TRY.
             CREATE DATA lo_ref TYPE (lv_type).
           CATCH cx_sy_create_data_error..
             " no plan c
             EXIT.
         ENDTRY.
     ENDTRY.

     ls_resbind = VALUE abap_trans_resbind(
         name  = <ls_method_param_type>-sconame
         value = lo_ref  ).
     INSERT ls_resbind INTO TABLE lt_resbind.

     " determine kind of parameter for dynamic method call
     CASE <ls_method_param_type>-sconame+0(1).
       WHEN 'E'.
         DATA(lv_kind) = cl_abap_objectdescr=>importing.
       WHEN 'I'.
         lv_kind =  cl_abap_objectdescr=>exporting.
       WHEN OTHERS.
         EXIT.
     ENDCASE.

     CASE <ls_method_param_type>-sconame.
       WHEN 'I_ADSONM'.
         GET REFERENCE OF i_adsonm INTO DATA(lo_adsonmref).
         ls_parameter = VALUE abap_parmbind(
             name  = <ls_method_param_type>-sconame
             kind  = lv_kind
             value = lo_adsonmref ).
         INSERT ls_parameter INTO TABLE lt_parameters.
       WHEN 'I_TEXT'.
         GET REFERENCE OF i_text INTO DATA(lo_text).
         ls_parameter = VALUE abap_parmbind(
             name  = <ls_method_param_type>-sconame
             kind  = lv_kind
             value = lo_text ).
         INSERT ls_parameter INTO TABLE lt_parameters.
         CONTINUE.
       WHEN 'I_INFOAREA'.
         GET REFERENCE OF i_infoarea INTO DATA(lo_infoarea).
         ls_parameter = VALUE abap_parmbind(
             name  = <ls_method_param_type>-sconame
             kind  = lv_kind
             value = lo_infoarea ).
         INSERT ls_parameter INTO TABLE lt_parameters.
         CONTINUE.
       WHEN 'I_S_ADSOFLAGS'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_adsoflags RESULT (lt_resbind).
       WHEN 'I_T_OBJECT'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_object RESULT (lt_resbind).
       WHEN 'I_T_DIMENSION'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_dimension RESULT (lt_resbind).
       WHEN 'I_T_KEY'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_key RESULT (lt_resbind).
       WHEN 'I_T_HASH'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_hash RESULT (lt_resbind).
       WHEN 'I_T_INDEX'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_index RESULT (lt_resbind).
       WHEN 'I_T_PARTITION'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_partition RESULT (lt_resbind).
       WHEN 'I_T_CHA_CONST'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_cha_const RESULT (lt_resbind).
       WHEN 'I_T_VALIDITY'.
         CALL TRANSFORMATION (`ID`) SOURCE XML iv_validity RESULT (lt_resbind).
     ENDCASE.

     " build parameter table for method call
     ls_parameter = VALUE abap_parmbind(
         name  = <ls_method_param_type>-sconame
         kind  = lv_kind
         value = lt_resbind[ 1 ]-value ).
     INSERT ls_parameter INTO TABLE lt_parameters.

   ENDLOOP.

   TRY.
*BEGIN New ADü_20250328
      authority-check object 'S_RS_ADSO'
       id 'RSINFOAREA' field '*'
       id 'RSOADSONM' field '*'
       id 'RSOADSOPAR' field '*'
       id 'ACTVT' field '03'.
      if sy-subrc <> 0.
        raise not_authorized.
      else.
*END New ADü_20250328
       CALL METHOD ('CL_RSO_ADSO_API')=>create PARAMETER-TABLE lt_parameters.
*BEGIN New ADü_20250328
       endif.
*END New ADü_20250328
     CATCH cx_root. " catch all errors and exit
   ENDTRY.

   "check if object is created, active and dequeue it
   DATA: lv_exists TYPE i.
   SELECT COUNT( * )
    FROM rsoadso "#EC CI_BYPASS
      INTO lv_exists
        WHERE adsonm  = i_adsonm
        AND ( objvers   = 'A'
        OR objvers    = 'M' ).

   IF NOT lv_exists >= 1.
     RAISE not_created.
   ENDIF.

   DATA: lo_adso TYPE REF TO cl_rso_adso.

   CALL METHOD cl_rso_adso=>factory
     EXPORTING
       i_adsonm = i_adsonm
     RECEIVING
       r_r_adso = lo_adso.

   "dequeue
   CALL METHOD lo_adso->if_rso_tlogo_maintain~dequeue.

   "is active
   DATA: is_active TYPE rs_bool.

   CALL METHOD lo_adso->if_rso_tlogo_maintain~is_active
     RECEIVING
       r_is_active = is_active.

   IF is_active = rs_c_false.
     RAISE not_active.
   ENDIF.
 ENDFUNCTION.

Z_RFC_FUNCTION_DELETE v1_1

Source Code of Z_RFC_FUNCTION_DELETE
ABAP
FUNCTION Z_RFC_FUNCTION_DELETE
  IMPORTING
    VALUE(FUNCNAME) TYPE FUNCNAME
  EXCEPTIONS
    ERROR_MESSAGE
    RELEASE_1_1
    NOT_AUTHORIZED
    NOT_ALLOWED_TO_DELETE.



*BEGIN New ADü_20250328
  authority-check object 'S_DEVELOP' "#EC AUTFLD_MIS
   id 'DEVCLASS' field '*'
   id 'OBJTYPE' field 'FUNC'
   id 'OBJNAME' field 'Z_RFC_ADSO_CREATE_XML'
   id 'ACTVT' field '06'.
  if sy-subrc <> 0.
    raise not_authorized.
  endif.
  " Check if FM which should be deleted is in the same FUGR as this FM
  data: lv_pnameOfFuncname type pname.
  " get pname of FM which should be delete
  select single pname from tfdir into lv_pnameOfFuncname where funcname = funcname.
 " compare pnames
  if lv_pnameOfFuncname <> sy-repid.
    raise not_allowed_to_delete.
  endif.
*END New ADü_20250328


  call function 'FUNCTION_DELETE'
    exporting
      funcname      = funcname
    exceptions
      error_message = 1
      others        = 2.
  if sy-subrc = 1.
    raise error_message.
  endif.
endfunction.

Z_RFC_CHECK_ACT_TR v1_2

Source Code of Z_RFC_CHECK_ACT_TR
ABAP
FUNCTION Z_RFC_CHECK_ACT_TR
  IMPORTING
    VALUE(IV_MODE) TYPE CHAR1 DEFAULT '1'
    VALUE(IV_XML_OBJECTS) TYPE STRING
    VALUE(IV_TRANSPORT) TYPE TRKORR OPTIONAL
  EXPORTING
    VALUE(EV_XML_STATUS) TYPE STRING
  EXCEPTIONS
    RELEASE_1_2
    NOT_AUTHORIZED.



  types:
    begin of ty_message,
      message_type type sy-msgty,
      message      type string,
    end of ty_message.
  types: tt_messages type standard table of ty_message with default key.

  types:
    begin of ty_status,
      tlogo                 type rstlogo,
      objnm                 type sobj_name,
      actflg                type rsawbn_obj_activflg,
      objstat               type rsobjstat,
      saved                 type rs_bool,
      activflg              type rsawbn_obj_activflg,
      locked                type rs_bool,
      tr_lock               type rs_bool,
      no_handler            type rs_bool,
      written_to_tr         type rs_bool,
      activation_successful type rs_bool,
      messages              type tt_messages,
    end of ty_status.

  data: lt_objects        type rso_t_tlogo.
  data: lt_status         type table of ty_status.
  data: lv_objvers        type rs_objvers.
  data: lo_tlogo          type ref to if_rso_tlogo.
  data: lv_objstat        type rsobjstat.
  data: lo_msg            type ref to cl_rso_msg.
  data: lt_object_details type rso_t_cto_tlogo_prop.
  data: lv_request        type trkorr.
  data: lv_error          type rs_bool.
  data: lt_tr_msg         type bapirettab.
  data: lo_awbn_factory   type ref to cl_rsawbn_obj_factory.
  data: lo_awbn_object    type ref to cl_rsawbn_obj.
  data: lt_enq            type table of seqg3.
  data: lv_garg           type eqegraarg.
  data: lv_logsys         type rsrlogsys.
  data: ls_tlogoprop      type rstlogoprop.
  data: lt_msg            type rs_t_msg.
  data: lv_repaired       type rs_bool.
  data: lv_subrc          type sysubrc.

  field-symbols: <ls_enq>    type seqg3.
  field-symbols: <message>   type ty_message.
  field-symbols: <ls_status> type ty_status.
  field-symbols: <ls_object> type rso_s_tlogo.
  field-symbols: <ls_msg>    type rs_s_msg.
  field-symbols: <ls_tr_obj> type trexreqob.



  call transformation (`ID`) source xml iv_xml_objects result xml_objects = lt_objects.

  " only accept 1 - check / 2 - activate / 3 - transport mode
  assert iv_mode = 1 or iv_mode = 2 or iv_mode = 3.

  if lt_objects is initial.
      return. " no objects -> nothing to do
  endif.

  " create AWBN Factory for later usage
  create object lo_awbn_factory.


  loop at lt_objects assigning <ls_object>.

    " Prepare Status Output
    append initial line to lt_status assigning <ls_status>.

    " Fill general fields
    <ls_status>-tlogo = <ls_object>-tlogo.
    <ls_status>-objnm = <ls_object>-objnm.

*BEGIN New ADü_20250328
    authority-check object 'S_RS_ADMWB'
     id 'RSADMWBOBJ' field '*'
     id 'ACTVT' field '03'.
    if sy-subrc <> 0.
      raise not_authorized.
    else.
*END New ADü_20250328
      " get logsys
      lv_logsys = cl_rso_repository=>get_logical_system_self( ).
*BEGIN New ADü_20250328
    endif.
*END New ADü_20250328
    " get tlogoprops
    cl_rso_repository=>get_tlogoprop( exporting i_tlogo = <ls_object>-tlogo importing  e_s_tlogoprop = ls_tlogoprop ).

    try .
        " Check A Version
        lv_objvers = 'A'.
        call method cl_rso_object_collection_cache=>get_object_properties
          exporting
            i_tlogo            = <ls_object>-tlogo
            i_objnm            = <ls_object>-objnm
            i_objvers          = lv_objvers
            i_objlogsys        = lv_logsys
            i_bypassing_buffer = abap_true
            i_no_message       = abap_true
          importing
            e_objstat          = lv_objstat
          exceptions
            object_not_found   = 1.
      catch cx_root.
        " Check M Version
        lv_objvers = 'M'.
        call method cl_rso_object_collection_cache=>get_object_properties
          exporting
            i_tlogo            = <ls_object>-tlogo
            i_objnm            = <ls_object>-objnm
            i_objvers          = lv_objvers
            i_objlogsys        = lv_logsys
            i_bypassing_buffer = abap_true
            i_no_message       = abap_true
          importing
            e_objstat          = lv_objstat
          exceptions
            object_not_found   = 1.
    endtry.

    " fill Object Status
    <ls_status>-objstat = lv_objstat.

    " Check if tlogo class is available
    if ls_tlogoprop-class is not initial.
      call method (ls_tlogoprop-class)=>if_rso_tlogo~get_instance
        exporting
          i_objnm   = <ls_object>-objnm
        receiving
          r_r_tlogo = lo_tlogo.
    else.
      <ls_status>-no_handler = abap_true.
    endif.

    " saved?
    if lo_tlogo is bound.
      <ls_status>-saved = lo_tlogo->if_rso_tlogo_maintain~is_saved( ).
    endif.

    if iv_mode = '1'. " Check Mode

      " Check for M / A Version
      lo_awbn_factory->get_instance(
        exporting
          i_tlogo              = <ls_object>-tlogo
          i_objnm              = <ls_object>-objnm
        receiving
          re_r_awbobj          = lo_awbn_object ).

      <ls_status>-activflg = lo_awbn_object->get_activflg( ). " U -> M <> A Version / X -> M = A Version / '' no information
      "Special case Analysis Auth.
      if <ls_object>-tlogo = 'ASOB'.
        data: lt_objstat type table of rsobjstat.
        select objstat
          from rsecbiau
          into table lt_objstat
            where auth = <ls_object>-objnm.

        find 'INA' in table lt_objstat.                 "#EC CI_NOORDER

        if sy-subrc = 0.
          <ls_status>-activflg = 'U'.
        endif.
        "special case 7.x InfoSources
      elseif <ls_object>-tlogo = 'TRCS'.
        data: lv_timstmp_a type rstimestmp,
              lv_timstmp_m type rstimestmp.
        select single timestmp
          from rsksnew
            into lv_timstmp_a
              where isource = <ls_object>-objnm
                and objvers = 'A'.

        select single timestmp
          from rsksnew
            into lv_timstmp_m
              where isource = <ls_object>-objnm
                and objvers = 'M'.

        if lv_timstmp_m > lv_timstmp_a.
          <ls_status>-activflg = 'U'.
        endif.
      endif.

      " check for lock
      call function 'ENQUEUE_READ'
        exporting
          gclient = sy-mandt
          guname  = ''
        tables
          enq     = lt_enq.

      concatenate <ls_object>-objnm '*' into lv_garg.

      loop at lt_enq assigning <ls_enq> where garg cp lv_garg. " AND gobj = ls_tlogoprop-enqobject.
      endloop.
      if sy-subrc = 0.
        <ls_status>-locked = abap_true.
      endif.

      " transport locks
      data: ls_e071     type e071.
      data: lv_result   type trpari-s_checked.
      data: ls_tadir    type tadir.
      data: ls_lock_key type tlock_int.
      data: lt_tlock    type table of tlock.
      data: lv_lockflag type trpari-s_lockflag.

      ls_e071-pgmid    = 'R3TR'.
      ls_e071-object   = <ls_object>-tlogo.
      ls_e071-obj_name = <ls_object>-objnm.

      call function 'TR_CHECK_TYPE'
        exporting
          wi_e071     = ls_e071
        importing
          pe_result   = lv_result
          we_lock_key = ls_lock_key
          we_tadir    = ls_tadir.

      " determine lock key for complete object (TADIR)
      if  ls_e071-pgmid    = ls_tadir-pgmid
      and ls_e071-object   = ls_tadir-object
      and ls_e071-obj_name = ls_tadir-obj_name.
        "   object is already complete (TADIR object): lock key is already known
      else.
        move-corresponding ls_tadir to ls_e071.
        call function 'TR_CHECK_TYPE'
          exporting
            wi_e071     = ls_e071
          importing
            pe_result   = lv_result
            we_lock_key = ls_lock_key
            we_tadir    = ls_tadir.
      endif.
      " proceed only for lockable objects
      if lv_result = 'L'.
        " determine locks refering to complete (TADIR) object
        call function 'TRINT_CHECK_LOCKS'
          exporting
            wi_lock_key = ls_lock_key
          importing
            we_lockflag = lv_lockflag
          tables
            wt_tlock    = lt_tlock
          exceptions
            empty_key   = 1
            others      = 2 ##FM_SUBRC_OK.
        if lv_lockflag = abap_true.
          <ls_status>-tr_lock = abap_true.
        else.
          <ls_status>-tr_lock = abap_false.
        endif.

      else.
        <ls_status>-tr_lock = abap_false.
      endif.


      if lo_tlogo is bound.
        lo_tlogo->if_rso_tlogo_maintain~check(
          exporting
            i_objvers            = lv_objvers
          importing
            e_r_msg              = lo_msg
            e_is_repaired        = lv_repaired
            e_subrc              = lv_subrc ).

        if lo_msg is bound.
          lt_msg = lo_msg->get_all_msg( ).

          loop at lt_msg assigning <ls_msg>.
            append initial line to <ls_status>-messages assigning <message>.
            <message>-message_type = <ls_msg>-msgty.
            message id <ls_msg>-msgid type <ls_msg>-msgty number <ls_msg>-msgno
                 with <ls_msg>-msgv1 <ls_msg>-msgv2 <ls_msg>-msgv3 <ls_msg>-msgv4
                 into <message>-message.
          endloop.
        endif.
      endif.

    endif.

    if iv_mode = '2'. " Activation Mode

      if lo_tlogo is not bound.
        exit.
      endif.

      " Run Check before activation.
      if lo_tlogo is bound.
        lo_tlogo->if_rso_tlogo_maintain~check(
      exporting
        i_objvers            = lv_objvers
      importing
        e_r_msg              = lo_msg
        e_is_repaired        = lv_repaired
        e_subrc              = lv_subrc ).
        if lo_msg is bound.
          lt_msg = lo_msg->get_all_msg( ).

          delete lt_msg where not ( msgty eq 'E' or msgty eq 'W' ). " only look for errors and warnings
          if lt_msg is not initial. " Error messages found? return messages - skip activation
            loop at lt_msg assigning <ls_msg>.
              append initial line to <ls_status>-messages assigning <message>.
              <message>-message_type = <ls_msg>-msgty.
              message id <ls_msg>-msgid type <ls_msg>-msgty number <ls_msg>-msgno
                   with <ls_msg>-msgv1 <ls_msg>-msgv2 <ls_msg>-msgv3 <ls_msg>-msgv4
                   into <message>-message.
            endloop.
          endif.
        endif.
      endif.
      try.
          lo_tlogo->if_rso_tlogo_maintain~prepare(
            exporting
              i_with_enqueue       = rs_c_false    " = 'X': with Enqueue Lock
              i_with_cto_check     = rs_c_false    " = 'X': with CTO Check
              i_with_authority     = rs_c_false    " = 'X': with Authorization
              i_with_rebuild       = rs_c_false    " = 'X': Database Must Reread the Object
              i_actvt              = rssb_c_auth_actvt-maintain    " Activity
              i_objvers            = rs_c_objvers-active    " Object version
              i_detlevel           = '3'    " Application Log: Level of Detail
          ).
        catch cx_rs_cancelled.
        catch cx_rs_not_authorized.
        catch cx_rs_display_only.
      endtry.

      lo_tlogo->if_rso_tlogo_maintain~activate(
        exporting
          i_objvers             = lv_objvers   " Object Version (A / M)
          i_force_activation    = rs_c_true    " = 'X': activate in case the object is already active
          i_show_check_protocol = rs_c_false   " = 'X': Display Consistency Log as Popup if Warnings Arise
          i_with_cto            = rs_c_false
        importing
          e_subrc               =  lv_subrc  ).

      if lv_subrc = 0.
        <ls_status>-activation_successful = abap_true.
        append initial line to <ls_status>-messages assigning <message>.
        <message>-message_type = 'S'.
        <message>-message = 'Activation successful' ##NO_TEXT.

      else.
        <ls_status>-activation_successful = abap_false.
        append initial line to <ls_status>-messages assigning <message>.
        <message>-message_type = 'E'.
        <message>-message = 'Activation failed' ##NO_TEXT.
      endif.

    endif.

    if iv_mode = '3'. " Transport Mode
      check iv_transport is not initial.

      data: ls_wi_e071 like e071.
      ls_wi_e071-pgmid = 'R3TR'.
      ls_wi_e071-object   = <ls_object>-tlogo.
      ls_wi_e071-obj_name = <ls_object>-objnm.

      call function 'TR_APPEND_TO_COMM'
        exporting
          pi_korrnum                     = iv_transport
          wi_e071                        = ls_wi_e071
        exceptions
          no_authorization               = 1
          no_systemname                  = 2
          no_systemtype                  = 3
          tr_check_keysyntax_error       = 4
          tr_check_obj_error             = 5
          tr_enqueue_failed              = 6
          tr_ill_korrnum                 = 7
          tr_key_without_header          = 8
          tr_lockmod_failed              = 9
          tr_lock_enqueue_failed         = 10
          tr_modif_only_in_modif_order   = 11
          tr_not_owner                   = 12
          tr_no_append_of_corr_entry     = 13
          tr_no_append_of_c_member       = 14
          tr_no_shared_repairs           = 15
          tr_order_not_exist             = 16
          tr_order_released              = 17
          tr_order_update_error          = 18
          tr_repair_only_in_repair_order = 19
          tr_wrong_order_type            = 20
          wrong_client                   = 21
          others                         = 22.
      if sy-subrc <> 0.
        <ls_status>-written_to_tr = abap_false.
      else.
        <ls_status>-written_to_tr = abap_true.
      endif.
      free: ls_wi_e071.

    endif.

  endloop.

  call transformation (`ID`) source status   = lt_status   result xml ev_xml_status.

endfunction.

Z_RFC_HCPR_CREATE v1_1

Source Code of Z_RFC_HCPR_CREATE
ABAP
FUNCTION Z_RFC_HCPR_CREATE
  IMPORTING
    VALUE(I_HCPRNM) TYPE RSOHCPRNM DEFAULT ''
    VALUE(I_DESCRIPTION) TYPE SSTRING DEFAULT ''
    VALUE(I_INFOAREA) TYPE RSINFOAREA DEFAULT ''
  EXPORTING
    VALUE(E_SUCCESS) TYPE RS_BOOL
  TABLES
    T_PARTPROVIDER LIKE RSD_S_PROV
  EXCEPTIONS
    RELEASE_1_1
    NOT_AUTHORIZED.




  data: lt_partprovider type table of rsinfoprov,
        ls_partprovider type rsinfoprov,
        ls_temp         type rsd_s_prov.

  loop at t_partprovider into ls_temp.
    ls_partprovider = ls_temp-infoprov.
    append ls_partprovider to lt_partprovider.
  endloop.

*BEGIN New ADü_20250328
  authority-check object 'S_RS_HCPR'
   id 'RSINFOAREA' field i_infoarea
   id 'RSHCPR' field i_hcprnm
   id 'ACTVT' field '03'
   id 'RSHCPROBJ' field '*'.
  if sy-subrc <> 0.
    raise not_authorized.
  else.
*END New ADü_20250328
    call method cl_rso_hcpr_metadata_api=>create_union
      exporting
        i_hcprnm          = i_hcprnm
        i_description     = i_description
        i_infoarea        = i_infoarea
        i_t_part_provider = lt_partprovider
      importing
        "e_r_msg           = E_R_MSG
        e_success         = e_success.
*BEGIN New ADü_20250328
  endif.
*END New ADü_20250328
endfunction.

Documentation Function Modules (BW Classic):
20250818_BW_Function_Modules_with_Sourcecode_v251.pdf

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.