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

Calculating Record Size

Former Member
0 Likes
1,293

Is there a way to programmatically calculate the record size of a given table? Better yet, is this information stored in some table that an ABAP program can read and not even have to calculate it.

For example given tables, VBAK, BSEG, VBRK, etc., I need to know the record lengths of these tables. (I need this information for about 200 tables... so a manual calculation would be rather labor intensive).

1 ACCEPTED SOLUTION
Read only

rainer_hbenthal
Active Contributor
0 Likes
932

What is a record size?

6 REPLIES 6
Read only

Former Member
0 Likes
932

Hi,

use system variable SY-DBCNT

Regards,

V.Balaji

Reward if Usefull...

Read only

0 Likes
932

no no

the field LENGTH is in SY-TLENG

or you can use the DESCRIBE FIELD ... LENGTH ... statement

Read only

rainer_hbenthal
Active Contributor
0 Likes
933

What is a record size?

Read only

0 Likes
932

By record size I mean the following:

Suppose we have a table with this definition

MANDT

VBELN

NETWR

....

...

...

I want to know how wide this record definition is, i.e. 4(MANDT) + 10(VBELN) + .... etc

Read only

0 Likes
932

I guess there are lots of ways to do it. Here is one way.

REPORT zjc_temp.

DATA:  BEGIN OF g_s_ddic,
  tabname TYPE dd02l-tabname,
  intlen  TYPE dd03l-intlen.
DATA:  END OF g_s_ddic.

DATA:
   g_t_ddic LIKE TABLE OF  g_s_ddic,
   g_v_len  TYPE i.



SELECT t~tabname f~intlen
INTO CORRESPONDING FIELDS OF TABLE g_t_ddic
FROM dd02l AS t
  INNER JOIN dd03l AS f
     ON  f~tabname = t~tabname
     AND f~as4local = t~as4local
     AND f~as4vers = t~as4vers
WHERE t~tabclass = 'TRANSP'
AND t~tabname in ('BSEG')'
  ORDER BY t~tabname.


LOOP AT g_t_ddic INTO g_s_ddic.
  g_v_len = g_v_len + g_s_ddic-intlen.
  AT END OF tabname.
    WRITE:/ g_s_ddic-tabname, g_v_len.
    g_v_len = 0.
  ENDAT.
ENDLOOP.

Read only

Former Member
0 Likes
932

hi check this ...

tables:pa0000.

data: begin of itab occurs 0.

include structure pa0000.

data: end of itab.

data: i type i.

data:string type string.

select * from pa0000 into table itab .

i = strlen( itab ).

loop at itab.

write:/ i.

endloop.

regards,

venkat.