cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent a text in script from displaying if its value is zero

Former Member
0 Kudos

Dear all,

How to prevent a text in script from displaying if its value is zero

for eg Price = 0.00

if price is 0 it should'nt appear in output.

I tried with if price ne 0.

price = &price&

endif.

but it's not working.

Regards

Raj

<MOVED BY MODERATOR TO THE CORRECT FORUM>

Edited by: Alvaro Tejada Galindo on Jan 20, 2009 8:59 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

you can define one char filed and pass the value.

/: DEFINE lv_char type char13.

lv_char = price.

&lv_char&

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello Nagaraju,

What you were doing is partially right.

The correct format to write in the script is as follows :

/: if &PRICE& ne 0.

  • &PRICE&

/: endif.

This should work. Let me know how it goes.

Nayan

Former Member
0 Kudos

data lv_qty type vbap-zmeng.

data char_qty(10).

lv_qty = '10.000'.

Move lv_qty TO char_qty.

Replace '.000' IN char_qty WITH ''.

CONDENSE char_qty.

write / char_qty. " output 10

lv_qty = '10.100'.

Move lv_qty TO char_qty.

Replace '.000' IN char_qty WITH ''.

CONDENSE char_qty.

write / char_qty. " output 10.100

Sm1tje
Active Contributor
0 Kudos

[suppressing output of initial values|http://help.sap.com/erp2005_ehp_04/helpdata/EN/d1/8034ba454211d189710000e8322d00/content.htm]