07-01-2008 2:40 PM
Hi
I have the following table
say YYTAB...it has 2 fields of size 3 and 4.
How to find its total size?
I mean i shud get the output as 7.(Sum of the sizes of its fields)
is there any function module?
07-01-2008 2:44 PM
Check for table DD03L contains the output length . Make select in this table with table name as YYTAB and sum it up
a®
10-24-2014 4:36 PM
07-01-2008 2:46 PM
data : v_field1 like YYTAB-field1.
data : v_field2 like YYTAB-field2.
data : v_i type i,
v_i1 type i,
v_i2 type i.
describe field v_field1 length v_i1 in character mode .
describe field v_field2 length v_i2 in character mode .
v_i = v_i1 + v_i2.
write 😕 v_i.
07-01-2008 2:46 PM
07-01-2008 2:50 PM
@Srinivas.
Dude yu are really smart.. I hv jus given 2 fields to explain to everyOne. I have 40 fields in my table dude...which is of types c , n ,i etc...
I cannot keep on declaring the variables right?
07-01-2008 2:59 PM
Hi,
another way:
TYPES: BEGIN OF lty_xyz,
...
END OF lty_xyz.
DATA: ls_xyz TYPE lty_xyz.
DATA: lv_length TYPE I.
DATA: lv_length_comp TYPE I.
FIELD-SYMBOLS <comp> TYPE ANY.
...
CLEAR lv_length.
DO.
ASSIGN COMPONENT sy-index OF ls_xyz TO <comp>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
lv_length = lv_length + lv_length_comp.
ENDD0.
Kind regards,
HP
07-01-2008 3:33 PM
The "describe field" command works also with the structure name. There is no need for a loop.
describe field YYTAB length v_i1 in character mode
07-02-2008 5:53 AM
@Henry,
In Character mode isn t working. The table has both c and i fields... Its not unicode compatable rite?
07-02-2008 3:09 PM
In this case ask it in byte mode:
describe field YYTAB length v_i1 in byte mode
07-03-2008 7:26 AM
@Henry.
But iam getting the length as twice...
say 14 instead of 7(taking above example) , if u use byte mode.