Application Development 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: 

How to get size of internal table in bytes

former_member434229
Active Participant
0 Kudos

Hi,

I am sending an e-mail using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'. However, it requires a parameter as size of the file.

So, my requirement is to get the size of the file based on the records from the internal table.

Is there any way to get it??

TIA,

Nitin

1 ACCEPTED SOLUTION

Former Member
0 Kudos

YOu can know how much space each record occupies by the declaration of the itab.

for eg:

data: begin of itab,

field1(60),

field2(40),

end of itab.

this makes 100 chars or 100 bytes of data per record.

use describe statemnet to know how many records are there in a table.

describe itab lines v_lines.

total_size - v_lines * 100. "In this example.

total_size will get the value in bytes.

if you want it in KB, divide it with 1024.

Please check it you have the class CL_ABAP_MEMORY_UTILITIES in SE24

If you do have it check out for the method GET_MEMORY_SIZE_OF_OBJECT

this would give you the size of your internal table

Please check out this thread

https://forums.sdn.sap.com/click.jspa?searchID=1006391&messageID=86317

5 REPLIES 5

Former Member
0 Kudos

former_member624107
Contributor
0 Kudos

Hi

go thru this link

Message was edited by:

Sheeba Bhaskaran

Former Member
0 Kudos

YOu can know how much space each record occupies by the declaration of the itab.

for eg:

data: begin of itab,

field1(60),

field2(40),

end of itab.

this makes 100 chars or 100 bytes of data per record.

use describe statemnet to know how many records are there in a table.

describe itab lines v_lines.

total_size - v_lines * 100. "In this example.

total_size will get the value in bytes.

if you want it in KB, divide it with 1024.

Please check it you have the class CL_ABAP_MEMORY_UTILITIES in SE24

If you do have it check out for the method GET_MEMORY_SIZE_OF_OBJECT

this would give you the size of your internal table

Please check out this thread

https://forums.sdn.sap.com/click.jspa?searchID=1006391&messageID=86317

Former Member
0 Kudos

hi Nitin

<b>sy-toccu:</b>

it give info about how much memory is allocated for the itabs.

sy-toccu gives tye momory occupied by the itabs.

The size of the internal tables are set using the 'occurs n' clause. Here n refers to a integer number that specifies the size. Usually its given as 'occurs 0' which creates an itab <b>with the memmory space of 8kb.</b>

former_member434229
Active Participant
0 Kudos

ANSWERED.