‎2010 Jan 08 12:15 PM
data : it_tabdescr type abap_compdescr_tab,
wa_tabdescr type abap_compdescr.
data : ref_table_descr type ref to cl_abap_structdescr.
Return structure of the table.
ref_table_descr ?= cl_abap_typedescr=>describe_by_name( 'MARA' ).
it_tabdescr[] = ref_table_descr->components[].
it_tabdescr[] contains following fields..
length TYPE i,
decimals TYPE i,
type_kind TYPE abap_typekind,
name TYPE abap_compname,
The code is working fine in 4.7..
But in ecc 6 length wise it is reading twice from table mara.
in 4.7 mandt length 3
ecc6 mandt length 6.
‎2010 Jan 08 12:52 PM
But in ecc 6 length wise it is reading twice from table mara.
This is because 4.7 is non-unicode system, while ECC 6.0 is unicode system.
In in non-Unicode 1char = 1byte, in Unicode 1 char = 2bytes. That's why you get the length doubled.
Regards
Marcin
‎2010 Jan 08 12:52 PM
But in ecc 6 length wise it is reading twice from table mara.
This is because 4.7 is non-unicode system, while ECC 6.0 is unicode system.
In in non-Unicode 1char = 1byte, in Unicode 1 char = 2bytes. That's why you get the length doubled.
Regards
Marcin
‎2010 Jan 08 1:39 PM
How to over come with this problem.
i need the all fields name with their length and type by using the table name.
‎2010 Jan 08 1:50 PM
DATA: DDFIELDS TYPE DDFIELDS ,
WA_DDFIELDS LIKE LINE OF DDFIELDS.
CALL FUNCTION 'TR_NAMETAB_GET'
EXPORTING
IV_TABNAME = 'MARA'
IV_GET_LENGTHS_IN_CHARMODE = 'X'
IMPORTING
ET_DFIES = DDFIELDS
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
ELSE.
LOOP AT DDFIELDS INTO WA_DDFIELDS.
WRITE: / WA_DDFIELDS-FIELDNAME, WA_DDFIELDS-LENG, WA_DDFIELDS-DATATYPE.
ENDLOOP.
ENDIF.
‎2010 Jan 08 1:55 PM
The approach you took is correct one. in ECC just loop through the it_tabdescr[] and divide the length by 2.
Regards
Marcin
‎2010 Jan 08 1:58 PM
By using this Fm TR_NAMETAB_GET.. its of no use. the length is twice the actual length. please help me out with another solution
‎2010 Jan 08 2:01 PM
In my table currency field length is 13.. it shows only 7.. Then how to over come this problem
‎2010 Jan 08 2:01 PM
Hi Marcin,
When divide by 2, it will give wrong value for Type 'P', etc ie. VOLUM. Correct me if I am wrong.
Kanagaraja L
‎2010 Jan 08 1:01 PM