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

Field symbol type casting

Former Member
0 Likes
1,060

Hi

how can i change the data type of a field symbol at run time..(say Packed to char)

may be it can have a field data or structure data..

please help me ..........

Regards

albert

4 REPLIES 4
Read only

Former Member
0 Likes
836

Hi Albert,

Can't you just make an untyped field symbol and then assign it dynamically (using unsassign/assign) to the variable of the correct data type?

Best Regards,

Martin

Read only

0 Likes
836

hi

thank you for your reply

i am trying to do as follows but i am not getting the expected output

where do i go wrong.............


*"*"Local Interface:
*"  TABLES
*"      IT_OUT STRUCTURE  THENV OPTIONAL
DATA: v_date type sy-datum,
           mytype type C.
FIELD-SYMBOLS: <fs>,
               <fs1>.

v_date = sy-datum.

ASSIGN v_date TO <fs>.
  append <fs> to it_out.
WRITE / <fs>.      " ---------------->20.09.2011

ASSIGN v_date TO <fs1> casting TYPE C.
  append <fs1> to it_out.
WRITE / <fs1>.       " --------------->20110920

LT_OUT is having the data as 20110920

20110920

but i expect in date format 20.09.2011

20.09.2011

Read only

0 Likes
836

Hi

data:V_DATE2 TYPE STRING.

CONCATENATE V_DATE6(2) '.' V_DATE4(2) '.' V_DATE+0(4) INTO V_DATE2.

ASSIGN v_date2 TO <fs>.

append <fs> to it_out.

WRITE / <fs>. " -


>20.09.2011

ASSIGN v_date2 TO <fs1> casting TYPE C.

append <fs1> to it_out.

WRITE / <fs1>. " -


>20110920

Regards,

muralii

Read only

0 Likes
836

hi,

Thats good idea....

now the challenge how to handle DEC(float values).. at runtime

i need your help....

Regards

albert