Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table Memory

Former Member
0 Likes
2,230

Can anyone tell me how do I calculate the internal database memory required per record of a given table? A rough estimate would do. I am thinking that adding up the memory required by each field can be construed as memory required by a single record. Going further, the memory of each field can be determined by it's data type. But how do I calculate how many bytes of memory is taken by a given data type? Please help. I will assign the points to helpful posts. Thanks!

1 ACCEPTED SOLUTION
Read only

Laxmana_Appana_
Active Contributor
0 Likes
1,450

Hi,

Programetically also you can find the size of the record of a table :

Check this code :

TABLES: sflight.
DATA: isflight TYPE TABLE OF sflight.
DATA: wa_sflight LIKE LINE OF isflight.


DESCRIBE TABLE isflight LINES size1.
WRITE: / 'Number of Lines:', size1.
DESCRIBE FIELD wa_sflight LENGTH size2 IN BYTE MODE.
WRITE: / 'Size of one Line:', size2.
size3 = size1 * size2.
WRITE: / 'Total Size:', size3.

Regards

Appana

8 REPLIES 8
Read only

Manohar2u
Active Contributor
0 Likes
1,450

From SE11, you can able to know the size in bytes for a record.

Regds

Manohar

Read only

Laxmana_Appana_
Active Contributor
0 Likes
1,451

Hi,

Programetically also you can find the size of the record of a table :

Check this code :

TABLES: sflight.
DATA: isflight TYPE TABLE OF sflight.
DATA: wa_sflight LIKE LINE OF isflight.


DESCRIBE TABLE isflight LINES size1.
WRITE: / 'Number of Lines:', size1.
DESCRIBE FIELD wa_sflight LENGTH size2 IN BYTE MODE.
WRITE: / 'Size of one Line:', size2.
size3 = size1 * size2.
WRITE: / 'Total Size:', size3.

Regards

Appana

Read only

baskaran00
Active Participant
0 Likes
1,450

Hi,

You can go to SE11, there you will find the Technical Settings Toolbar, press it.

It will lead you to the Technical settings screen there you can specify the Data class and Size catagory depending upon your table.

Regards,

Baskaran M

Read only

Former Member
0 Likes
1,450

Sameer,

Memory Occupied in the database repository and database server depends largely on the number of records you are likely populate in the corresponding table.

Further more, table space allocated by your basis consultant in the database server makes a large difference. Your table size settings are maintained in the technical settings in tcode SE11.

Hope this would give you some clarification.

Regards

Read only

dani_mn
Active Contributor
0 Likes
1,450

HI,

GOTO transaction 'SE11'

open your table in display mode.

Now go to menu.

'Extras-->Table length'.

to find the length of the table in bytes.

Regards,

Wasim Ahmed

Read only

Former Member
0 Likes
1,450

Wasim, when I use the path SE11->Extras->Table Width, I see 3 rows and 2 columns as follows:

Rows:

Structure Width

Key Length

Length of Data Division

Columns:

Dictionary Length

ABAP Length

I am not familiar with the above terminology. If you could elaborate that would be great. All I need is the bite size information of one single record for a given table. I am assuming that it is easy to find this information even without any kind of programming. Let me know. Also, is it not possible to know the memory required for a given data element?

Read only

Former Member
0 Likes
1,450

Hi Sameer,

Consider this sample code it gives approx single record length and table size based on the no of records.

Just copy the code and execute it , give any table name in the selection screen it will return you the details.


REPORT zes_sample.


*--Give any Table Name
PARAMETERS : tabname TYPE dd02l-tabname.

DATA:  prc_line_len TYPE i VALUE 0,
       lv_tablename TYPE string,
       lv_dref TYPE REF TO data,
       tlen   TYPE i VALUE 0,
       rsize(50),
       tsize(50).

lv_tablename = tabname.

*--Dynamically creating the Internal table
CREATE DATA lv_dref TYPE TABLE OF (lv_tablename).

FIELD-SYMBOLS: <fs> TYPE STANDARD TABLE,
               <f> TYPE ANY.

*--Assigning the dynamically created Internal table to Field Symbol
ASSIGN lv_dref->* TO <fs>.


*--Selecting single row for calculating the reord length
SELECT *
  FROM (tabname)
  INTO TABLE <fs> UP TO 1 ROWS.

*--Calculating the record length
READ TABLE <fs> ASSIGNING <f> INDEX 1.
DESCRIBE FIELD <f> LENGTH prc_line_len IN BYTE MODE.

*--Getting the No of records in the Table
SELECT COUNT( * ) FROM (tabname).


*--Calculating the Approx Table size
IF sy-subrc EQ 0.
  tlen =   prc_line_len * sy-dbcnt.
ENDIF.

tsize = tlen.
rsize =   prc_line_len .

WRITE : / 'Single Record Size : ' , rsize, 'Bytes'.
SKIP 2.

WRITE : / 'Approxiamte  size of table ' , tabname, 'with', sy-dbcnt, 'records is :',
       /  tsize, 'Bytes'.

Regards,

<b>AS</b>

Read only

Former Member
0 Likes
1,450

Hi,

Another approach using <b>RFC_GET_NAMETAB</b> gets the table details from database.


  REPORT zes_sample.
  PARAMETERS : tabname TYPE x030l-tabname.

  DATA : it_x030l TYPE STANDARD TABLE OF x030l WITH HEADER LINE,
         it_x031l TYPE STANDARD TABLE OF x031l WITH HEADER LINE.

  CALL FUNCTION 'RFC_GET_NAMETAB'
    EXPORTING
      tabname          = tabname
    IMPORTING
      header           = it_x030l
    TABLES
      nametab          = it_x031l
    EXCEPTIONS
      table_not_active = 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.


  WRITE : / 'Table length in bytes', it_x030l-tablen.

Regards,

<b>AS</b>