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

Converting data

Former Member
0 Likes
729

Hi Gurus,

I have a problem in data conversion..

IF ls_zixtsvcreq-zixfempnb EQ '|'.

MOVE ' ' TO ls_zixtsvcreq-zixfempnb.

ENDIF.

This code produces dump as ls_zixtsvcreq-zixfempnb is a numeric value which cant interpret Pipe(|) sign.

Is there any method to convert the pipe into numc value or the solution for the desired results.

Please reply.

Regards,

Rahul

7 REPLIES 7
Read only

Former Member
0 Likes
701

First move the value (ltest) into the character value (ltest1)then compare .

move ltest to ltest1.

IF ltest1 EQ '|'.

MOVE ' ' TO ltest.

ENDIF.

Read only

0 Likes
701

Hi Shilpi,

Its not working..

Suggest other solution

Regards,

Rahul

Read only

Former Member
0 Likes
701

hiii

you are getting dump because you are having type of ls_zixtsvcreq-zixfempnb as numeric.it will not take '|' as numeric value...but then also you want to do the same then convert that field in type C field once...then after moving value again convert it in numeric field.

data: ltest type C.

 ltest = ls_zixtsvcreq-zixfempnb 

IF ltest EQ '|'.
MOVE '  ' TO ltest.
ENDIF.

 ls_zixtsvcreq-zixfempnb = ltest.

regards

twinkal

Edited by: twinkal patel on Jul 17, 2008 3:26 PM

Read only

0 Likes
701

Twinkal,

i think you should know shilpi already has given same reply as you gave.you suppose to provide some other not just post same by simply modify them.

Amit.

Read only

0 Likes
701

Please give the solution

Read only

Subhankar
Active Contributor
0 Likes
701

Hi,

Please check it

here the numeric field is L_OUT

data: l_str1 TYPE string,

l_out TYPE n LENGTH 2 VALUE 12.

l_str1 = '|'.

IF l_str1 = '|' .

MOVE '' to l_out.

ENDIF.

WRITE: l_out.

You can not make l_out as blank because it a numeric field.

Read only

Former Member
0 Likes
701

Hi,

i wrote the below code and executed it is working fine.

but one thing i observed is in the parameter num value we can give only numbers as it is of type n.

but it is working fine for the else part. it did not go to dump.

data: cha type c.

parameter num type n.

cha = num.

if cha eq 'l'.

write: 'hi'.

else.

write: 'wrong'.

endif.