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

Create data type T error

Former Member
0 Likes
672

HI All,

I am trying to create data type time and I have error,

the value is ls_abap_field_desc-type = T

How can i overcome this issue,and what I doing wrong ?

CREATE DATA lv_field_type TYPE (ls_abap_field_desc-type) LENGTH  ls_prop-length.

Regards

Joy

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
636

Hello Joy,

You're getting this error because of the 'T' data type. You cannot use LENGTH addition with 'T' ABAP type, it can be used for C,N,P & X types only.

BR,

Suhas

4 REPLIES 4
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
637

Hello Joy,

You're getting this error because of the 'T' data type. You cannot use LENGTH addition with 'T' ABAP type, it can be used for C,N,P & X types only.

BR,

Suhas

Read only

Former Member
0 Likes
636

HI Suhas,

Thanks,

Assume that i have <lv_field_type> that is type any and are getting every time different type ,and i want to use the STRLEN ,

how can analyze in order to prevent dump.

Best regards

Joy

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
636

Hello,

A small code snippet to help you out:

PARAMETERS: p_type TYPE typename OBLIGATORY,
            p_len  TYPE i DEFAULT 8.

DATA: go_typedescr TYPE REF TO cl_abap_typedescr,
      gv_dref      TYPE REF TO data.

* Get the type reference of the i/p type
go_typedescr = cl_abap_typedescr=>describe_by_name( p_type ).

CASE go_typedescr->type_kind.
  WHEN
    cl_abap_typedescr=>typekind_num     OR  "Numeric
    cl_abap_typedescr=>typekind_packed  OR  "Packed
    cl_abap_typedescr=>typekind_char    OR  "Character
    cl_abap_typedescr=>typekind_hex.        "Hex
    CREATE DATA gv_dref TYPE (go_typedescr->type_kind) LENGTH p_len.
  WHEN OTHERS.
    CREATE DATA gv_dref TYPE (go_typedescr->type_kind).
ENDCASE.

Hope this helps.

BR,

Suhas

Read only

Former Member
0 Likes
636

HI Suhas,

Thanks you very much its help ,

I had another question assume i have field with name phone and i want to ask that if phone = phone1

this will work with abap true .

the phone is variable and can be any name the only difference is the number after it and i guess that

Regax will help like the following but i am not sure how to use it with varibale that can be phone address

e.g. if address = address99 etc

FIND REGEX '^([[:digit:]]+)$'

Warm Regards

Joy