Code: Alles auswählen.
DATA: gl_count TYPE i.
SELECT COUNT( * ) FROM bseg INTO gl_count.
WRITE: / 'Anzahl Datensätze in BSEG:', gl_count.
Code: Alles auswählen.
REPORT zzcheckcluster MESSAGE-ID zs LINE-SIZE 255.
TABLES : dd02l,
dd03l,
ttxob.
* P A R A M E T E R --------------------------------------
* PM_RAD1 = 'X' -> Zu den angegebener Tabelle das Cluster
PARAMETERS pm_rad1 RADIOBUTTON GROUP rad1 DEFAULT 'X'..
SELECT-OPTIONS so_tab FOR dd02l-tabname DEFAULT 'BSE*'
SIGN i OPTION cp.
SELECTION-SCREEN SKIP.
* PM_RAD2 = 'X'-> Alle Tabellen, die in diesem Cluster sind
PARAMETERS pm_rad2 RADIOBUTTON GROUP rad1.
SELECT-OPTIONS so_clu FOR dd02l-sqltab DEFAULT 'RFBL*'
SIGN i OPTION cp.
SELECTION-SCREEN SKIP.
* Clustered Tabelle (wie ZB. INDX)
PARAMETERS pm_rad3 RADIOBUTTON GROUP rad1.
SELECT-OPTIONS so_dcl FOR dd02l-tabname DEFAULT 'INDX*'
SIGN i OPTION cp.
SELECTION-SCREEN SKIP.
* Datensatzuzähler Achtung lange Laufzeit falls = 'X'.
PARAMETERS : pm_cou AS CHECKBOX DEFAULT ' '.
* P A R A M E T E R --------------------------------------
CONSTANTS : co_cluster TYPE dd02l-tabclass VALUE 'CLUSTER',
co_transp TYPE dd02l-tabclass VALUE 'TRANSP',
co_pool TYPE dd02l-tabclass VALUE 'POOL',
co_lraw TYPE dd03l-datatype VALUE 'LRAW'.
* D A T A *
DATA rcount TYPE i. "Saetze gelesen
DATA r1count TYPE i. "Saetze gelesen
DATA ucount TYPE i. "Saetze geändert
DATA wcount TYPE i. "Saetze geändert
DATA dcount TYPE i. "Saetze gelöscht
DATA icount TYPE i. "Saetze eingefügt
DATA retc TYPE sy-subrc. "Returncode
DATA akt TYPE i.
DATA pool_cluster TYPE dd02l-tabclass.
TYPES : BEGIN OF t_clus,
sqltab TYPE sqlappdtab,
tabname TYPE tabname,
tabclass TYPE tabclass.
TYPES : END OF t_clus.
DATA dummyf1 TYPE f.
FIELD-SYMBOLS <idref> TYPE ANY.
DATA : dref TYPE REF TO data.
DATA idd02l TYPE t_clus OCCURS 0.
FIELD-SYMBOLS <fdd02l> TYPE t_clus.
* Tabellen mit Clusterstrukturen (LRAW-Felder)
DATA idd03l TYPE dd03l OCCURS 0.
FIELD-SYMBOLS <fdd03l> TYPE dd03l.
DATA icdd02l TYPE dd02l OCCURS 0 WITH HEADER LINE.
FIELD-SYMBOLS <fcdd02l> TYPE dd02l.
DATA wa_dd09l TYPE dd09l.
DATA icdir TYPE cdir OCCURS 0.
FIELD-SYMBOLS <fcdir> TYPE cdir.
DATA flip_normal.
DATA flip_key.
* M A C R O S *
* Zaehler (inc)rementieren, da zu faul : x = x + 1. inc x. kürzer :-)
DEFINE inc.
&1 = &1 + 1.
END-OF-DEFINITION.
* Zaehler (dec)rementieren
DEFINE dec.
&1 = &1 - 1.
END-OF-DEFINITION.
* Zaehler (dec)rementieren
DEFINE mset_range.
clear &1.
&1-low = &2.
&1-high = &3.
&1-sign = &4.
&1-option = &5.
append &1.
END-OF-DEFINITION.
DEFINE mflip_key.
format color col_positive intensified on.
&1 = 'X'.
* endif.
END-OF-DEFINITION.
DEFINE mflip_normal.
if &1 = 'X'.
format color col_normal intensified off.
&1 = ' '.
else.
format color col_normal intensified on.
&1 = 'X'.
endif.
END-OF-DEFINITION.
* S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
* Tabellen die in Clustern/Pools abgelegt sind auswählen
IF pm_rad1 = 'X'.
PERFORM get_cluster_tables.
ENDIF.
IF pm_rad2 = 'X'.
* Cluster/Pool auswählen und Tabellen dazu bestimmen
PERFORM get_cluster.
ENDIF.
* Datenclustertabellen ermitteln.
IF pm_rad3 = 'X'.
PERFORM search_lraw_fields.
ENDIF.
END-OF-SELECTION.
* E N D - O F - S E L E C T I O N *
*&---------------------------------------------------------------------*
*& Form get_cluster_tables
*&---------------------------------------------------------------------*
* Tabelle, die in Clustern/Pools abgelegt sind betimmen
*----------------------------------------------------------------------*
FORM get_cluster_tables.
* Hole alle Tabellen die in Clustern abgelgt sind
SELECT tabname
tabclass
sqltab FROM dd02l INTO CORRESPONDING FIELDS OF TABLE idd02l
WHERE tabname IN so_tab AND
as4local = 'A' AND
( tabclass = 'POOL' OR
tabclass = 'CLUSTER' )
ORDER BY sqltab tabname.
LOOP AT idd02l ASSIGNING <fdd02l>.
SELECT SINGLE
tabkat
tabart
pufferung
schfeldanz
speichpuff FROM dd09l
INTO CORRESPONDING FIELDS OF wa_dd09l
WHERE tabname = <fdd02l>-tabname and
as4local = 'A'.
AT NEW sqltab.
IF NOT <fdd02l>-sqltab IS INITIAL.
SELECT COUNT( * ) FROM (<fdd02l>-sqltab) INTO r1count.
ELSE.
r1count = 0.
ENDIF.
ENDAT.
* !!! Dieser Count kann sehr lange dauern, da
* ein full table scan durchgeführt wird
IF pm_cou = 'X'.
SELECT COUNT( * ) FROM (<fdd02l>-tabname) INTO rcount.
ENDIF.
mflip_normal flip_normal.
WRITE : / ' TABLE:',
<fdd02l>-tabname,
'Rows:', rcount,
'in',<fdd02l>-tabclass,
<fdd02l>-sqltab COLOR 3,
'Cat:',
wa_dd09l-tabkat,
'Type:',
wa_dd09l-tabart,
'Buf:',
wa_dd09l-pufferung,
'Key:',
wa_dd09l-schfeldanz.
ENDLOOP.
ENDFORM. " get_cluster_tables
*
*&---------------------------------------------------------------------*
*& Form get_cluster
*&---------------------------------------------------------------------*
* Cluster/Pool und die zugehörigen Tabellen bestimmen
*----------------------------------------------------------------------*
FORM get_cluster.
* Hole alle Cluster/Pool
SELECT sqltab
tabclass
tabname FROM dd02l INTO CORRESPONDING FIELDS OF TABLE idd02l
WHERE sqltab IN so_clu AND
as4local = 'A' AND
( tabclass = 'POOL' OR
tabclass = 'CLUSTER' )
ORDER BY sqltab.
LOOP AT idd02l ASSIGNING <fdd02l>.
SELECT SINGLE
tabkat
tabart
pufferung
schfeldanz
speichpuff FROM dd09l
INTO CORRESPONDING FIELDS OF wa_dd09l
WHERE tabname = <fdd02l>-tabname AND
as4local = 'A'.
AT NEW sqltab.
IF NOT <fdd02l>-sqltab IS INITIAL.
SELECT COUNT( * ) FROM (<fdd02l>-sqltab) INTO r1count.
ELSE.
r1count = 0.
ENDIF.
mflip_key flip_key.
WRITE :/ <fdd02l>-tabclass,':', <fdd02l>-sqltab,'Rows:',r1count.
ENDAT.
IF pm_cou = 'X'.
SELECT COUNT( * ) FROM (<fdd02l>-tabname) INTO rcount.
ENDIF.
mflip_normal flip_normal.
IF <fdd02l>-tabclass = 'TRANSP'.
WRITE : / ' TABLE:',
<fdd02l>-tabname,
'Rows:', rcount,
<fdd02l>-tabclass NO-GAP COLOR 2,
'not in pool/cluster' COLOR 2,
'Cat:',
wa_dd09l-tabkat,
'Type:',
wa_dd09l-tabart,
'Buf:',
wa_dd09l-pufferung,
'Key:',
wa_dd09l-schfeldanz.
ELSE.
WRITE : / ' TABLE:',
<fdd02l>-tabname,
'Rows:', rcount,
'in',<fdd02l>-tabclass,
<fdd02l>-sqltab COLOR 3,
'Cat:',
wa_dd09l-tabkat,
'Type:',
wa_dd09l-tabart,
'Buf:',
wa_dd09l-pufferung,
'Key:',
wa_dd09l-schfeldanz.
ENDIF.
ENDLOOP.
ENDFORM. " get_cluster
*&---------------------------------------------------------------------*
*& Form search_lraw_fields
*&---------------------------------------------------------------------*
* Ermittle alle Tabellen in denen LRAW-Feld existiert
* (DATENCLUSTER)
*----------------------------------------------------------------------*
FORM search_lraw_fields.
* suche in DDIC Tabellen mit LRAW Feldern
SELECT * FROM dd03l INTO TABLE idd03l
WHERE tabname IN so_dcl AND
datatype = co_lraw.
* Prüfe ob Tranparente Tabelle
LOOP AT idd03l ASSIGNING <fdd03l>.
SELECT SINGLE * FROM dd02l INTO icdd02l
WHERE tabname = <fdd03l>-tabname AND
tabclass = co_transp.
IF sy-subrc EQ 0.
APPEND icdd02l.
ENDIF.
ENDLOOP.
* Gebe Anzahl Zeilen in Tabelle aus
LOOP AT icdd02l ASSIGNING <fcdd02l>.
IF pm_cou = 'X'.
SELECT COUNT( * ) FROM (<fcdd02l>-tabname) INTO rcount.
ENDIF.
WRITE : / 'TABLE(clustered) :', <fcdd02l>-tabname,'Rows:',rcount.
ENDLOOP.
ENDFORM. " search_lraw_fields