Tuesday, November 26, 2013

alv_field_catlog

*&---------------------------------------------------------------------*
*& Report  ZUPGRADE_ACCEL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZUPGRADE_ACCEL NO STANDARD PAGE HEADING.
*Data type declaration
TYPE-POOLS : slis.
*Tables
tables: TADIR.

types: begin of ty_tadir,
       DEVCLASS type tadir-DEVCLASS,  "packeg
       OBJECT   type tadir-OBJECT,    "object type
       OBJ_NAME type tadir-OBJ_NAME, "Object name
       end of ty_tadir.

data : wa_tadir type ty_tadir,
       t_tadir  type table of ty_tadir.
data: gv_z type string,
      gv_y type string.

DATA : IT_FCAT TYPE  SLIS_T_FIELDCAT_ALV,
       WA_FCAT TYPE SLIS_FIELDCAT_ALV,
       i_layout TYPE  slis_layout_alv ,
       i_event  TYPE slis_t_event,
       w_event  type slis_alv_event.

START-OF-SELECTION.
  PERFORM READ_DATA.
  perform field_catalog.
  PERFORM DISPLAY_ALV.

form read_data.
  gv_z = 'Z%'.
  gv_y = 'Y%'.

  SELECT  DEVCLASS
          OBJECT
          OBJ_NAME FROM tadir INTO table t_tadir
                    WHERE ( obj_name LIKE gv_z
                       OR obj_name LIKE gv_y ).
endform.                    "read_data

*&---------------------------------------------------------------------*
*&      Form  FIELD_CATALOG
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <-- br="" nbsp="" p2="" text="">*----------------------------------------------------------------------*
FORM FIELD_CATALOG .


  wa_fcat-fieldname = 'DEVCLASS'.
  wa_fcat-tabname   = 'T_TADIR'.
  wa_fcat-seltext_l = 'Package'.
  wa_fcat-col_pos = 1.
*  i_fcat-key  = 'X'.
*  i_fcat-no_out = 'X'.
  APPEND wa_fcat to it_fcat.
  CLEAR wa_fcat.

  wa_fcat-fieldname = 'OBJECT'.
  wa_fcat-tabname   = 'T_TADIR'.
  wa_fcat-seltext_l = 'Object Type'.
  wa_fcat-col_pos = 2.
*  i_fcat-key  = 'X'.
*  i_fcat-no_out = 'X'.
  APPEND wa_fcat to it_fcat.
  CLEAR wa_fcat.

  wa_fcat-fieldname = 'OBJ_NAME'.
  wa_fcat-tabname   = 'T_TADIR'.
  wa_fcat-seltext_l = 'Object Name'.
  wa_fcat-col_pos = 3.
*  i_fcat-key  = 'X'.
*  i_fcat-no_out = 'X'.
  APPEND wa_fcat to it_fcat.
  CLEAR wa_fcat.

*  i_layout-zebra = 'X'.
**  I_LAYOUT-WINDOW_TITLEBAR = ' '.
*  i_layout-no_scrolling = '1'.
*  i_layout-colwidth_optimize = 'X'.
*  i_layout-no_min_linesize = ' '.
**  i_layout-max_linesize = 450.
**  APPEND i_layout.


  w_event-name = 'TOP_OF_PAGE'.
  w_event-form = 'HEADER'.
  APPEND w_event to i_event.
  CLEAR w_event.

ENDFORM.                    " FIELD_CATALOG


*&---------------------------------------------------------------------*
*&      Form  ALV_REPORT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM DISPLAY_ALV .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
     I_CALLBACK_PROGRAM                = 'ZUPGRADE_ACCEL'
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
   I_CALLBACK_TOP_OF_PAGE            = 'HEADER'
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
   IS_LAYOUT                           = i_layout
     IT_FIELDCAT                       = IT_FCAT[]
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
    TABLES
      T_OUTTAB                          = T_TADIR[]
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ENDFORM.                    " ALV_REPORT

*&---------------------------------------------------------------------*
*&      Form  HEADER
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM HEADER.
  data: T_header type slis_t_listheader,
      wa_HEADER type slis_listheader.

*Title
  wa_header-typ = 'H'.
  wa_header-info = 'EXXOVA Upgrade Tool'.
  append wa_header to t_header.
  clear wa_header.


  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary       = t_header[]
      I_LOGO                   = 'EXXOVA'
*     I_END_OF_LIST_GRID       =
*     I_ALV_FORM               =
.
  ENDFORM.

No comments: