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

data type change

Former Member
0 Likes
630

Hi,

I have condition like this

data: ab type i,

ab = 5.

now i wanted to move the value of ab to info having type c.

but it is not taking the value of c.

clear mlin.

mlin-type = 'S'.

mlin-info = ???

what i have to write in place of ??? so that it will display the value of ab in mlin-info.

5 REPLIES 5
Read only

Former Member
0 Likes
590

Hi,

Try MOVE AB to MLIN-INFO.

Best regards,

Prashant

Read only

Former Member
0 Likes
590

1st check the lenght of <b>mlin-info = ???</b>it is more than 16 bit.

before conversion remember . char type take 1 byte and integer type take 2 byte

Read only

Former Member
0 Likes
590

Please check this,it worked.

data:ab type i.

data:c type c.

ab = 5.

c = ab.

write:/ c.

regards

Read only

Former Member
0 Likes
590

Hi Salil,

check the coding for your test case as below:

REPORT Z_TEST .

data: ab type i value 5.

data: begin of mlin occurs 0,

typ type c,

info type c,

end of mlin.

clear mlin.

mlin-typ = 'S'.

mlin-info = ab.

append mlin.

loop at mlin.

write: / mlin-typ, mlin-info.

endloop.

Execute this, you will get your answer.

P.S. mark all helpful asnwers for points.

JLN

Read only

Former Member
0 Likes
590

Below code works for me, kindly check the same on your

system.

data: l_num type i value 5.

data: l_char(1) type c.
data: begin of l_struc,
        num type c,
      end of l_struc.

l_char = l_num.
l_struc-num = l_num.

write:/ l_char.

write:/ l_struc-num.

Kind Regards

Eswar