Skip to end of metadata
Go to start of metadata
Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
************************************************************************
* ZBI_ABAP_ROUTINES_TRANSFORM
* BI: Analyze ABAP Routines in Transformations
*
* (c) SAP AG 2008                                    MFB, SAP Labs, LLC
* created:     2008-03-28
* last update: 2012-12-06
************************************************************************
* Selection texts:
* P_ANAL    Highlight ABAP Coding
* P_DISP    Display ABAP Coding
* P_VERS_A  Current Version
* P_VERS_D  Comparison Version
* S_ISOURC  InfoSource
* S_LOGSYS  Source system
* S_OSOURC  DataSource
************************************************************************

REPORT zbi_abap_routines_transform LINE-SIZE 255.

TYPE-POOLS: icon, rsaa.

TABLES:
  rstran, rstransteprout.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS:
  s_tranid FOR rstran-tranid,
  s_stype  FOR rstran-sourcetype,
  s_sname  FOR rstran-sourcename,
  s_ttype  FOR rstran-targettype,
  s_tname  FOR rstran-targetname.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS:
  p_vers_a TYPE rsobjvers DEFAULT 'A',
  p_vers_d TYPE rsobjvers DEFAULT 'D',
  p_disp   AS CHECKBOX    DEFAULT 'X',
  p_anal   AS CHECKBOX    DEFAULT space.
SELECTION-SCREEN END OF BLOCK b2.

TYPES:
  BEGIN OF ys_codes,
    sourcename LIKE rstran-sourcename,
    targetname LIKE rstran-targetname,
    sourcetype LIKE rstran-sourcetype,
    targettype LIKE rstran-targettype,
    codetp     TYPE char2,
    ruleid     TYPE rstran_ruleid,
    codeid     TYPE rssguid25,
  END OF ys_codes,
  yt_codes TYPE SORTED TABLE OF ys_codes WITH UNIQUE DEFAULT KEY.

DATA:
  gs_codes TYPE ys_codes,
  gt_codes TYPE yt_codes.

* F4-help
TYPES:
  BEGIN OF ys_help_value,
    value       TYPE rstran-sourcename,
    icon        TYPE rsicon,
  END OF ys_help_value.

DATA:
  g_count             TYPE i,
  g_value             TYPE dynfieldvalue,
  gs_help_value       TYPE ys_help_value,
  gt_help_value       TYPE TABLE OF ys_help_value,
  gs_retval           TYPE ddshretval,
  gt_retval           TYPE STANDARD TABLE OF ddshretval.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_sname-low.

  PERFORM f4_sname CHANGING s_sname-low.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_sname-high.

  PERFORM f4_sname CHANGING s_sname-high.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_tname-low.

  PERFORM f4_tname CHANGING s_tname-low.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_tname-high.

  PERFORM f4_tname CHANGING s_tname-high.

START-OF-SELECTION.

* Read transformations with ABAP routines
  SELECT * FROM rstran
    WHERE tranid     IN s_tranid
      AND sourcetype IN s_stype
      AND sourcename IN s_sname
      AND targettype IN s_ttype
      AND targetname IN s_tname
      AND objvers    =  p_vers_a.

    CLEAR gs_codes.
    MOVE-CORRESPONDING rstran TO gs_codes.

    IF NOT rstran-glbcode IS INITIAL.
      gs_codes-codetp   = '01'.
      gs_codes-codeid   = rstran-glbcode.
      COLLECT gs_codes INTO gt_codes.
    ENDIF.
    IF NOT rstran-glbcode2 IS INITIAL.
      gs_codes-codetp   = '02'.
      gs_codes-codeid   = rstran-glbcode2.
      COLLECT gs_codes INTO gt_codes.
    ENDIF.
    IF NOT rstran-startroutine IS INITIAL.
      gs_codes-codetp   = '03'.
      gs_codes-codeid   = rstran-startroutine.
      COLLECT gs_codes INTO gt_codes.
    ENDIF.
    IF NOT rstran-endroutine IS INITIAL.
      gs_codes-codetp   = '04'.
      gs_codes-codeid   = rstran-endroutine.
      COLLECT gs_codes INTO gt_codes.
    ENDIF.
    IF NOT rstran-expert IS INITIAL.
      gs_codes-codetp   = '99'.
      gs_codes-codeid   = rstran-expert.
      COLLECT gs_codes INTO gt_codes.
    ENDIF.

    SELECT * FROM rstransteprout
      WHERE tranid =  rstran-tranid
        AND objvers = rstran-objvers
      ORDER BY PRIMARY KEY.

      IF NOT rstransteprout-codeid IS INITIAL.
        gs_codes-codetp   = '00'.
        gs_codes-ruleid   = rstransteprout-ruleid.
        gs_codes-codeid   = rstransteprout-codeid.
        COLLECT gs_codes INTO gt_codes.
      ENDIF.

    ENDSELECT.

  ENDSELECT.

* Process routines
  LOOP AT gt_codes INTO gs_codes.

    AT NEW sourcename.
      FORMAT COLOR COL_HEADING INTENSIFIED ON.
      WRITE: AT /  icon_biw_rules_act AS ICON, 'Source:',
             AT 40 gs_codes-sourcename,
             AT 99 space.
      SKIP.
    ENDAT.

    AT NEW targetname.
      FORMAT COLOR COL_KEY INTENSIFIED ON.
      WRITE: AT /4 icon_biw_rules_act AS ICON, 'Target:',
             AT 40 gs_codes-targetname,
             AT 99 space.
      SKIP.
    ENDAT.

    AT NEW codetp.
      FORMAT COLOR COL_NORMAL INTENSIFIED ON.
      CASE gs_codes-codetp.
        WHEN '00'.
          WRITE: AT /8 icon_abap AS ICON, 'Field Routine:'.
        WHEN '01'.
          WRITE: AT /8 icon_abap AS ICON, '1st Global Data:'.
        WHEN '02'.
          WRITE: AT /8 icon_abap AS ICON, '2nd Global Data:'.
        WHEN '03'.
          WRITE: AT /8 icon_abap AS ICON, 'Start Routine:'.
        WHEN '04'.
          WRITE: AT /8 icon_abap AS ICON, 'End Routine:'.
        WHEN '99'.
          WRITE: AT /8 icon_abap AS ICON, 'Expert Routine:'.
      ENDCASE.
      WRITE: AT 99 space.
      SKIP.
    ENDAT.

    PERFORM analyze_routine IN PROGRAM zbi_abap_routines_analyze
      USING gs_codes-codeid p_vers_a p_vers_d p_disp p_anal 8 space.

    AT END OF sourcename.
      ULINE.
    ENDAT.

  ENDLOOP.

*&---------------------------------------------------------------------*
*&      Form  f4_help
*&---------------------------------------------------------------------*
FORM f4_help CHANGING c_value TYPE any.

* Check if only one object is selected
  SORT gt_help_value BY icon value.
  DESCRIBE TABLE gt_help_value LINES g_count.
  IF g_count = 0.
*   No values for this selection
    MESSAGE i802(dh).
    EXIT.
  ELSEIF g_count = 1.
    READ TABLE gt_help_value INTO gs_help_value INDEX 1.
    c_value = gs_help_value-value.
  ELSE.
*   Call F4 help
    g_value = c_value.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        retfield        = 'VALUE'
        window_title    = 'Selection'
        value           = g_value
        value_org       = 'S'
      TABLES
        value_tab       = gt_help_value
        return_tab      = gt_retval
      EXCEPTIONS
        parameter_error = 1
        no_values_found = 2.
    CHECK sy-subrc = 0.

    READ TABLE gt_retval INTO gs_retval INDEX 1.
    IF sy-subrc = 0.
      c_value = gs_retval-fieldval.
    ENDIF.
  ENDIF.

ENDFORM.                                                    "f4_help

*&---------------------------------------------------------------------*
*&      Form  f4_sname
*&---------------------------------------------------------------------*
FORM f4_sname CHANGING c_name LIKE rstran-sourcename.

* Fill help table
  REFRESH gt_help_value.
  SELECT * FROM rstran WHERE sourcetype IN s_stype.
    CLEAR gs_help_value.
    gs_help_value-value = rstran-sourcename.

    CALL METHOD cl_rso_repository=>get_tlogo_icon
      EXPORTING
        i_tlogo = rstran-sourcetype
      RECEIVING
        r_icon  = gs_help_value-icon.

    COLLECT gs_help_value INTO gt_help_value.
  ENDSELECT.

  PERFORM f4_help CHANGING c_name.

ENDFORM.                                                    "f4_sname

*&---------------------------------------------------------------------*
*&      Form  f4_sname
*&---------------------------------------------------------------------*
FORM f4_tname CHANGING c_name LIKE rstran-sourcename.

* Fill help table
  REFRESH gt_help_value.
  SELECT * FROM rstran WHERE targettype IN s_ttype.
    CLEAR gs_help_value.
    gs_help_value-value = rstran-targetname.

    CALL METHOD cl_rso_repository=>get_tlogo_icon
      EXPORTING
        i_tlogo = rstran-targettype
      RECEIVING
        r_icon  = gs_help_value-icon.

    COLLECT gs_help_value INTO gt_help_value.
  ENDSELECT.

  PERFORM f4_help CHANGING c_name.

ENDFORM.                                                    "f4_tname