‎2013 Jul 11 12:31 PM
Hi Experts,
Am practing one RTTS example but am getting dump for the below example when we execute.
when i use describe_by_data( value ) am getiing output
when i use describe_by_name( value ) am getting runtime error.
Please explain what is the excat diff between describe_by_data( ) and describe_by_name( ) methods ?
data: value type i.
data: obj_ref type REF TO cl_abap_typedescr.
START-OF-SELECTION.
*obj_ref = cl_abap_typedescr=>describe_by_data( value ).
obj_ref = cl_abap_typedescr=>describe_by_name( value ).
WRITE: / 'Typename:', obj_ref->absolute_name.
WRITE: / 'Kind :', obj_ref->type_kind.
WRITE: / 'Length :', obj_ref->length.
WRITE: / 'Decimals:', obj_ref->decimals.
‎2013 Jul 12 7:42 AM
‎2013 Jul 12 9:46 AM
Hi Raymond,
data: value type i.
obj_ref = cl_abap_typedescr=>describe_by_data( value ).
when we use above statement am getting correct output.(BELOW OUTPUT)
WRITE: / 'Typename:', obj_ref->absolute_name. ---->\TYPE=I
WRITE: / 'Kind :', obj_ref->type_kind. ------> I
WRITE: / 'Length :', obj_ref->length. ------->4
WRITE: / 'Decimals:', obj_ref->decimals. -------->0
obj_ref = cl_abap_typedescr=>describe_by_name ( value ).
when i use above stmt am getting runtime dump.
obj_ref = cl_abap_typedescr=>describe_by_name ( 'VALUE' ).
when i use above stmt am not getting exact output.(BELOW OUTPUT).it is supposed to display interger type as per my guess
WRITE: / 'Typename:', obj_ref->absolute_name. ---->\TYPE=C
WRITE: / 'Kind :', obj_ref->type_kind. ------> C
WRITE: / 'Length :', obj_ref->length. ------->32
WRITE: / 'Decimals:', obj_ref->decimals. -------->0
Please correct my code any one..i will reward
Moderator Message - Asking/offering points is against the forums' Rules of Engagement.
Message was edited by: Suhas Saha
‎2013 Jul 12 11:16 AM
Hi All,
data: value type i.
obj_ref = cl_abap_typedescr=>describe_by_data( value ).
when we use above statement am getting correct output.(BELOW OUTPUT)
WRITE: / 'Typename:', obj_ref->absolute_name. ---->\TYPE=I
WRITE: / 'Kind :', obj_ref->type_kind. ------> I
WRITE: / 'Length :', obj_ref->length. ------->4
WRITE: / 'Decimals:', obj_ref->decimals. -------->0
obj_ref = cl_abap_typedescr=>describe_by_name ( value ).
when i use above stmt am getting runtime dump.
obj_ref = cl_abap_typedescr=>describe_by_name ( 'VALUE' ).
when i use above stmt am not getting exact output.(BELOW OUTPUT).it is supposed to display interger type as per my guess
WRITE: / 'Typename:', obj_ref->absolute_name. ---->\TYPE=C
WRITE: / 'Kind :', obj_ref->type_kind. ------> C
WRITE: / 'Length :', obj_ref->length. ------->32
WRITE: / 'Decimals:', obj_ref->decimals. -------->0
I dont know the reason why it is displaying like that?
‎2013 Jul 12 1:04 PM
Run below statement and usage would be clear.
obj_ref = cl_abap_typedescr=>describe_by_name( 'SFLIGHT' ).
You have to pass a type name, either from dictionary or one defined in program using TYPES statement.
‎2014 Jan 15 9:32 PM
Hi Srinad,
this describe_by_name will describe types which are in the datadictionary (SE11). The data element 'VALUE'. So in your last example the data element VALUE will be described, instead of the instance variable 'value'.
Best,
Sander