Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

Invalid Database Object List and Activation

$
0
0

Below program Generate Invalid Database Object List.

 

REPORT  zinvalid_obj.

TYPE-POOLS : slis.

DATA : fieldcatalog          TYPE slis_t_fieldcat_alv WITH HEADER LINE,    " For Field Catalog
        gd_layout             TYPE slis_layout_alv,                         " For Alv Layout
        gt_sort               TYPE slis_t_sortinfo_alv,                     " For Sorting
        gt_events             TYPE slis_t_event,                            " For Events
        gt_list_top_of_page   TYPE slis_t_listheader,                       " For Top of Page
        heading               TYPE slis_t_listheader,                       " For headings in Top of Page
        g_save(1)             TYPE c,                                       " For displaying variants
        g_exit(1)             TYPE c,
        g_variant             TYPE disvariant,
        gx_variant            TYPE disvariant,
        it_sort               TYPE slis_t_sortinfo_alv,
        x_sort                TYPE slis_sortinfo_alv,
        print                 TYPE slis_print_alv,                          " For Printing
        m_title               TYPE lvc_title VALUE 'Invalid Database Object List'.

DATA: BEGIN OF wa,
         owner(20) TYPE  c ,
         objname(20) TYPE  c ,
         objtype(20) TYPE  c ,
         status(15)   TYPE  c ,
        END OF wa.

TYPES : BEGIN OF ty_wa,
         owner(20) TYPE  c ,
         objname(20) TYPE  c ,
         objtype(20) TYPE  c ,
         status(15)   TYPE  c ,
        END OF ty_wa.

DATA : it_wa TYPE STANDARD TABLE OF ty_wa WITH HEADER LINE.

START-OF-SELECTION.

   IF g_save EQ space.
     PERFORM initialise_variant.
   ENDIF.


   PERFORM get_data.

   IF it_wa IS INITIAL.

     MESSAGE 'No Data Found!!!' TYPE 'S'.
     LEAVE TO CURRENT TRANSACTION.

   ENDIF.

   PERFORM f_layout.
   PERFORM display.

*&---------------------------------------------------------------------*
*&      Form  loop_output
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM loop_output.
   it_wa-owner  = wa-owner.
   it_wa-objname = wa-objname.
   it_wa-objtype = wa-objtype.
   it_wa-status  = wa-status.
   APPEND it_wa.
ENDFORM.                    "loop_output
*&---------------------------------------------------------------------*
*&      Form  INITIALISE_VARIANT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM initialise_variant .
   g_save = 'A'.
   CLEAR g_variant.

   g_variant-report = sy-repid.
   gx_variant = g_variant.

   CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
     EXPORTING
       i_save     = g_save
     CHANGING
       cs_variant = gx_variant
     EXCEPTIONS
       not_found  = 2.
ENDFORM.                    " INITIALISE_VARIANT

*&---------------------------------------------------------------------*
*&      Form  GET_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_data .

   EXEC SQL PERFORMING loop_output .
     select owner,object_name,object_type,status into :wa
     from dba_objects where status='INVALID'
   ENDEXEC.
   SORT it_wa BY objname.
ENDFORM.                    " GET_DATA

*&---------------------------------------------------------------------*
*&      Form  F_LAYOUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_layout .
   CLEAR gd_layout.
   gd_layout-detail_popup         = 'X'.
   gd_layout-zebra                = 'X'.
   gd_layout-no_vline             = ' '.
   gd_layout-colwidth_optimize    = 'X'.
ENDFORM.                    " F_LAYOUT

*&---------------------------------------------------------------------*
*&      Form  DISPLAY
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM display .
   fieldcatalog-fieldname   = 'OWNER'.
   fieldcatalog-tabname     = 'IT_WA'.
   fieldcatalog-seltext_m   = 'Owner'.
   fieldcatalog-key         = 'X'.
   fieldcatalog-just        = 'L'.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.

   fieldcatalog-fieldname   = 'OBJNAME'.
   fieldcatalog-tabname     = 'IT_WA'.
   fieldcatalog-seltext_m   = 'Object Name'.
   fieldcatalog-key         = 'X'.
   fieldcatalog-just        = 'L'.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.

   fieldcatalog-fieldname   = 'OBJTYPE'.
   fieldcatalog-tabname     = 'IT_WA'.
   fieldcatalog-seltext_m   = 'Object Type'.
   fieldcatalog-key         = 'X'.
   fieldcatalog-just        = 'L'.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.

   fieldcatalog-fieldname   = 'STATUS'.
   fieldcatalog-tabname     = 'IT_WA'.
   fieldcatalog-seltext_m   = 'Status'.
   fieldcatalog-key         = 'X'.
   fieldcatalog-just        = 'L'.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
       i_callback_program      = sy-repid
       i_grid_title            = m_title
       is_layout               = gd_layout
       it_fieldcat             = fieldcatalog[]
       i_default               = 'X'
       i_save                  = g_save
     TABLES
       t_outtab                = it_wa
     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.                    " DISPLAY


Output :

  Copy Invalid Object Name

inv.pg.jpg

Open Tcode : SE14

Paste Object : /BEV1/CADD03VTV and Press Edit

ed.jpg

   Press

   Activate and Adjust Database


    Request: "Adjust"   'Yes'

   act.jpg



Viewing all articles
Browse latest Browse all 943

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>