‎2006 Aug 04 11:24 PM
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!
‎2006 Aug 04 11:50 PM
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
‎2006 Aug 04 11:30 PM
From SE11, you can able to know the size in bytes for a record.
Regds
Manohar
‎2006 Aug 04 11:50 PM
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
‎2006 Aug 05 6:19 AM
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
‎2006 Aug 05 6:50 AM
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
‎2006 Aug 05 7:10 AM
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
‎2006 Aug 08 10:16 PM
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?
‎2006 Aug 05 7:19 AM
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>
‎2006 Aug 05 8:02 AM
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>