Application Development 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: 

Replace '0.00' with Blank

Former Member
0 Kudos

Hi,

In my Smartform Output requirment If amount is Initial I need to Show a Blank .

My variable is XVAR(6) Type P decimals 2.

How do we do that?

Regards

Vara

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Vara,

Can you try this code and let me know your concern, if any.

data : XVAR(6) Type P decimals 2.

constants : c_blank(1) type c value ' '.

if xvar is initial. "or if xvar = '0.00'

write : c_blank.

else.

write : xvar.

endif.

Cheers,

Vikram

18 REPLIES 18

abdul_hakim
Active Contributor
0 Kudos

hi

the initial value of numeric field is 0 and character field is space.

so if you want space then do the below change.

data:xvar(6) type p decimals 2,

char(6) type c.

move xvar to char.

Cheers,

Abdul Hakim

Mark useful answers..

Former Member
0 Kudos

Hi Vara,

Pls have a look at the code :

data : XVAR(6) Type P decimals 2.

constants : c_blank(1) type c value ' '.

if xvar is initial.

write : c_blank.

else.

write : xvar.

endif.

Hope this will give you an idea.

Cheers,

Vikram

pls reward for helpful replies!!

Former Member
0 Kudos

hi vara,

data: v_blank type c value ''.

if xvar is initial.

write v_blank.

endif.

award if helpful.

regards,

keerthi.

0 Kudos

Hi All,

Thank you for your answers.

My Target field (X_VAR) is of TYPE P DECIMALS 2.

I need to repalce with a Blank in to this when value is '0.00'.

Regards

Vara

0 Kudos

hi

you cannot assign a blank value to numeric datatype field so follow the method which i have described above..

Cheers,

Abdul Hakim

0 Kudos

hi Vara,

data v_char value ' '.

do this way ...

<b> if x_var = '0.00'.

x_var = v_char.

endif.</b>

Regards,

Santosh

Former Member
0 Kudos

Hi,

when you define a field of type P decimals 2, it will take an default value of '0.00'.

Why cant you use the code that i have mentioned above?

Cheers,

Vikram

0 Kudos

Hi All,

I worked with all of your recommendations.

Still the default value is '0.00'.

I am unable to replace it.

Kindly If possible send me an example where it replaces.

Regards

Prasad

0 Kudos

<b>data:xvar(6) type p decimals 2,

char(6) type c.

move xvar to char.</b>

and use char for your display..

Cheers,

Abdul Hakim

0 Kudos

Abdul,

It still display 0.00.

data:xvar(6) type p decimals 2,

char(6) type c.

move char to xvar.

write :/10 xvar.

regards

Vara

0 Kudos

you should output the char & not type p..


data:xvar(6) type p decimals 2,
w_char(6) type c.
move xvar to w_char.

write :/10 xvar,w_char.

Regards,

Suresh datti

0 Kudos

Try:


DATA: num(13) TYPE p DECIMALS 2,
      char(16).

WRITE num TO char NO-ZERO.

num = '256.44'.

WRITE num TO char NO-ZERO.

Make sure to pass CHAR to the Smartform.

Rob

Former Member
0 Kudos

Hi Vara,

Can you try this code and let me know your concern, if any.

data : XVAR(6) Type P decimals 2.

constants : c_blank(1) type c value ' '.

if xvar is initial. "or if xvar = '0.00'

write : c_blank.

else.

write : xvar.

endif.

Cheers,

Vikram

0 Kudos

All,

I resolved it my self.

Just I kept a Condition while printing in smartform.

XVAR NE '0.00'.

Thank you all for your quick replies.

Regards

Vara

0 Kudos

Sorry - my mistake.

Rob

Message was edited by: Rob Burbank

0 Kudos

Vara, way to think outside the box. Nice Fix. Can you please mark your post as "Solved on my own". This will provide some visibility to others that this post has a solution. Thanks.

Regards,

Rich Heilman

0 Kudos

duplicate.

Regards,

Rich Heilman

0 Kudos

Please mark this post as "Solved on my own" as I have not contributed to this post. Please make sure to award points to others if their answers will at least helpful. Thanks.

Regards,

Rich Heilman