Skip to Content
Author's profile photo Former Member

Table Rows

Usage


  • This tool can be used to get the cardinality (number of rows) of Table
  • Can be used to quickly check row count of Cube tables after a dimension table cleanup
  • Cardinality of table in DB02 & SAP_INFOCUBE_DESIGNS is reflected only after a runstat.

User Interface

Find the Dim Tables for a Cube by using wild cards

01_Cubestar.jpg

Copy the Tables from F4

02_F4.jpg

Paste

03_Copy_Paste.jpg

Execute

04_Execute.jpg

Output:

Cardinality of each table

05_OP.jpg

Code

Copy paste this code in an executable program.

Code

*&———————————————————————*

*& Report  Z_BW_TABLE_RECORDS

*&

*&———————————————————————*

*&

*&

*&——————————————————————–&*

*& ABAP Name   : Z_BW_TABLE_RECORDS                                   &*

*& Changed By  : Rahul R Nair                                         &*

*& Created On  : 11/03/2011                                           &*

*& Version     : 1.0                                                  &*

*& Description : This program can be used to generate the number of   &*

*&               records in a table.                                  &*

*&                                                                    &*

*&               Use :                                                &*

*&               The cube dimension table size will be reflected      &*

*&               in program SAP_INFOCUBE_DESIGNS after a run stat.    &*

*&                                                                    &*

*&               Reduction in cube dimension table size can be        &*

*&               checked immediately using this program.              &*

*&———————————————————————*

REPORT  Z_BW_TABLE_RECORDS.

*$***********************************************************************

*$*$  TABLES

*$*$*********************************************************************

TABLES :

   DD02L.

TYPE-POOLS :

   SLIS, ICON.

*$***********************************************************************

*$*$  DATA DECLARATION

*$*$*********************************************************************

DATA :

   IT_TABS     TYPE STANDARD TABLE OF  DDCDIM,

   WA_TABS     TYPE                    DDCDIM.

DATA :

   IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

   WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.    “FIELD CATALOG

DATA :

   LV_ERR_MSG  TYPE STRING.

*$***********************************************************************

*$*$  SELECTION SCREENS

*$*$*********************************************************************

SELECTION-SCREEN BEGIN OF BLOCK SB1 WITH FRAME TITLE TEXTT01.

SELECT-OPTIONS :

   SO_TABS     FOR     DD02LTABNAME NO INTERVALS.

SELECTION-SCREEN END   OF BLOCK SB1.

*$***********************************************************************

*$*$  SELECTION SCREEN HOW TO

*$*$*********************************************************************

SELECTION-SCREEN : BEGIN OF BLOCK SB2 WITH FRAME TITLE TEXTT40.

   SELECTION-SCREEN COMMENT /1(79) TEXTT41.

   SELECTION-SCREEN COMMENT /1(79) TEXTT42.

   SELECTION-SCREEN COMMENT /1(79) TEXTT43.

   SELECTION-SCREEN COMMENT /1(79) TEXTT44.

   SELECTION-SCREEN COMMENT /1(79) TEXTT45.

   SELECTION-SCREEN COMMENT /1(79) TEXTT46.

   SELECTION-SCREEN COMMENT /1(79) TEXTT47.

   SELECTION-SCREEN COMMENT /1(79) TEXTT48.

   SELECTION-SCREEN COMMENT /1(79) TEXTT49.

SELECTION-SCREEN END OF BLOCK SB2 .

*$***********************************************************************

*$*$  DATA PROCESSING

*$*$*********************************************************************

LOOP AT SO_TABS.

   CONDENSE SO_TABSLOW.

   CLEAR WA_TABS.

   WA_TABSTABNAME  = SO_TABSLOW.

   APPEND WA_TABS

     TO   IT_TABS.

ENDLOOP.

IF IT_TABS[] IS NOT INITIAL.

   CALL FUNCTION ‘EM_GET_NUMBER_OF_ENTRIES’

     TABLES

       IT_TABLES       = IT_TABS

             .

   IF SYSUBRC = 0.

     “**********************************************************

     “DISPLAY

     WA_FIELDCATCOL_POS = 1.

     WA_FIELDCATKEY = ‘X’.

     WA_FIELDCATFIELDNAME = ‘TABNAME’.

     WA_FIELDCATREPTEXT_DDIC = ‘Table’.

     WA_FIELDCATOUTPUTLEN = 15.

     WA_FIELDCATTABNAME = ‘IT_TABS’.

     APPEND WA_FIELDCAT TO IT_FIELDCAT.

     CLEAR WA_FIELDCAT.

     WA_FIELDCATCOL_POS = 2.

     WA_FIELDCATFIELDNAME = ‘TABROWS’.

     WA_FIELDCATREPTEXT_DDIC = ‘Rows’.

     WA_FIELDCATOUTPUTLEN = 15.

     WA_FIELDCATTABNAME = ‘IT_TABS’.

     APPEND WA_FIELDCAT TO IT_FIELDCAT.

     CLEAR WA_FIELDCAT.

     CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’

       EXPORTING

         I_CALLBACK_PROGRAM                = SYREPID

         I_GRID_TITLE                      = ‘Number of Records in a Table’

         IT_FIELDCAT                       = IT_FIELDCAT

       TABLES

         T_OUTTAB                          = IT_TABS

       EXCEPTIONS

         PROGRAM_ERROR                     = 1

         OTHERS                            = 2

               .

     IF SYSUBRC <> 0.

       CASE SYSUBRC.

         WHEN 1.

           LV_ERR_MSG = ‘Program error during list generation.’.

         WHEN 2.

           LV_ERR_MSG = ‘Unknown error during list generation.’.

       ENDCASE.

       MESSAGE LV_ERR_MSG TYPE ‘E’.

     ENDIF.

     “DISPLAY

     “**********************************************************

   ENDIF.

ENDIF.

Text Elements

Selection Text

SO_TABS Table

Text Elements

T01 Table
T40 Help
T41 This program can be used to generate the number of
T42 records in a table.                              
T43                                                  
T44 Use :                                            
T45 The cube dimension table size will be reflected  
T46 in program SAP_INFOCUBE_DESIGNS after a run stat.
T47                                                  
T48 Reduction in cube dimension table size can be    
T49 checked immediately using this program.          

Acknowledgments

I would like to thank my team mates at Infosys Ravi, Anuj, Tilak, Twinkle, Priya & Karthik .

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Francisco Milán Campos
      Francisco Milán Campos

      Hi Rahul:

          In the screenshot that has the Title "Number of Records in a Table" there are several entries that display a negative value (-1). How can we interpret this number? Obviously, there can't be -1 records in the Tables /BI0/D0TCT_C011, /BI0/D0TCT_C012, /BI0/D0TCT_C014, /BI0/D0TCT_C16 and /BI0/D0TCT_C17.

      Thanks a lot for sharing this valuable info.

      Best regards,

      Francisco Milan.

      Author's profile photo Former Member
      Former Member

      If you need help while activating remote desktop service windows 10 so the text file we are going to share with you setup remote desktop windows 10 will help you at every step with images.