Skip to Content
author's profile photo Former Member
Former Member

Size of Internal Table

Hi ,

How can i know the size of the internal table in kilobytes.



Add comment
10|10000 characters needed characters exceeded

3 Answers

  • Best Answer
    Posted on Aug 09, 2004 at 08:03 AM

    If you are on release 620, have a look at class CL_ABAP_MEMORY_UTILITES method GET_MEMORY_SIZE_OF_OBJECT. It will tell you how much memory is allocated and how much is actually used. Here is some sample code:

    TABLES: sflight.
    DATA: isflight TYPE TABLE OF sflight.
    SELECT-OPTIONS: carrid FOR sflight-carrid.
    SELECT * FROM sflight INTO TABLE isflight
            WHERE carrid IN carrid.
    DATA: size1 TYPE abap_msize,
          size2 TYPE abap_msize,
          size3 TYPE abap_msize,
          size4 TYPE abap_msize,
          flag1 TYPE char128,
          size5 TYPE abap_msize,
          size6 TYPE abap_msize,
          flag2 TYPE char128,
          flag3 TYPE char128.
      CALL METHOD cl_abap_memory_utilities=>get_memory_size_of_object
          object                     = isflight
          bound_size_alloc           = size1
          bound_size_used            = size2
          referenced_size_alloc      = size3
          referenced_size_used       = size4
          is_part_of_non_trivial_szk = flag1
          szk_size_alloc             = size5
          szk_size_used              = size6
          low_mem                    = flag2
          is_in_shared_memory        = flag3.
    WRITE: / 'Size of Bound and Allocated Memory:', size1.
    WRITE: / 'Size of Bound and Used Memory:', size2.
    WRITE: / 'Size of Referenced and Allocated Memory:', size3.
    WRITE: / 'Size of Referenced and Used Memory:', size4.
    WRITE: / 'Strongly Connected Component of Object:', flag1.
    WRITE: / 'Size of Allocated Memory of SCC:', size5.
    WRITE: / 'Size of Used Memory of SCC:', size6.
    WRITE: / 'Flag, whether only bound_size_* are filled due to mem.short.:', flag2.
    WRITE: / 'Flag, whether ONJECT is in the shared memory:', flag3.

    If you aren't on 620 or don't need to be that precise, you might try the following:

    DESCRIBE TABLE isflight LINES size1.
    WRITE: / 'Number of Lines:', size1.
    DATA: wa_sflight LIKE LINE OF isflight.
    WRITE: / 'Size of one Line:', size2.
    size3 = size1 * size2.
    WRITE: / 'Total Size:', size3.

    Please note that the addition <i>IN BYTE MODE</i> only works in 610 and higher. It isn't neccesary before that release. However it is important to get accurate resuls in an Unicode System.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 07, 2004 at 07:08 AM

    Hello Ravi

    I haven't tried this but maybe it works:

    w_length = strlen(ITAB[]).

    best regards

    Thomas Madsen Nielsen

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 09, 2004 at 04:35 PM

    Hello Ravi,

    Release 640 and actual 620 Servive Packages contain some extensisions to the debugger and a new tool called Memory Inspector.

    This enables you create a memory dump of your running application from the debugger and to inspect the memory consumption later.

    Kind Regards


    Add comment
    10|10000 characters needed characters exceeded