‎2006 Oct 12 2:14 PM
Hi
my problem is that i am getting data element or data type like 'CHAR_10' at run time AND I want to create a run time data type sometihng like the below but it does not execute.
create data dataref type 'CHAR_10'.
waht i do if at run time i am getting the data type in character string.
‎2006 Oct 12 2:19 PM
‎2006 Oct 12 2:50 PM
sir
my problem is that i am getting data element or data type like 'CHAR_10' at run time AND I want to create a run time data type sometihng like the below but it does not execute.
create data dataref type 'CHAR_10'.
waht i do if at run time i am getting the data type in character string.
predefined data types ok but i am getting even length at run time and i am also expecting data elements as character string.
‎2006 Oct 12 2:25 PM
Hi,
Try using Dynamic creation of data object, like this:
DATA: dref TYPE REF TO DATA,
tdata TYPE string.
FIELD-SYMBOLS: <f> TYPE any.
tdata = 'CHAR_10'.
CREATE DATA dref TYPE (tdata).
ASSIGN dref->* TO <f>.
Then you can use <f> like data object of type 'CHAR_10'
regards,
Alejandro.
‎2006 Oct 12 2:52 PM
it dumps me
Runtime Errors CREATE_DATA_UNKNOWN_TYPE
Except. CX_SY_CREATE_DATA_ERROR
Date and Time 10/12/2006 09:50:49
CREATE DATA: Der angegebene Typ "CHAR_10" ist kein gültiger Datentyp.
‎2006 Oct 12 3:05 PM
‎2006 Oct 12 3:23 PM
CHAR_10 is neither a domain nor a data element in my system. So where is it coming from. If it does not exist in the system, I guess the incoming string would have to be a certain format, meaning tha the data type would always be on the left of the _ and the length would be on the right. If that is the case, you can simply do something like this.
report zrich_0001.
data: xchar_type(1) type c.
data: xlength(3) type c.
data: xstring(20) type c value 'CHAR_10'.
data: dataref type ref to data.
split xstring at '_' into xchar_type xlength.
create data dataref type (xchar_type) length xlength.
check sy-subrc = 0.
Regards,
Rich Heilman