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

Replace '0.00' with Blank

Former Member
0 Likes
5,102

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
Read only

Former Member
0 Likes
3,322

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

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

18 REPLIES 18
Read only

abdul_hakim
Active Contributor
0 Likes
3,322

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..

Read only

Former Member
0 Likes
3,322

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!!

Read only

Former Member
0 Likes
3,322

hi vara,

data: v_blank type c value ''.

if xvar is initial.

write v_blank.

endif.

award if helpful.

regards,

keerthi.

Read only

0 Likes
3,322

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

Read only

0 Likes
3,322

hi

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

Cheers,

Abdul Hakim

Read only

0 Likes
3,322

hi Vara,

data v_char value ' '.

do this way ...

<b> if x_var = '0.00'.

x_var = v_char.

endif.</b>

Regards,

Santosh

Read only

Former Member
0 Likes
3,322

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

Read only

0 Likes
3,322

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

Read only

0 Likes
3,322

<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

Read only

0 Likes
3,322

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

Read only

0 Likes
3,322

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

Read only

0 Likes
3,322

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

Read only

Former Member
0 Likes
3,323

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

Read only

0 Likes
3,322

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

Read only

0 Likes
3,322

Sorry - my mistake.

Rob

Message was edited by: Rob Burbank

Read only

0 Likes
3,322

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

Read only

0 Likes
3,322

duplicate.

Regards,

Rich Heilman

Read only

0 Likes
3,322

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