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

Need help in clearing data

Former Member
0 Likes
556

Hi All,

Im facing a peculiar problem.

Im getting some data from one Function module into one variable.

Sometimes the variable is having values such as 0, 0.0, 0.00 like that.(system is still considering 0.0 as a value)

If such is a case I dont want to print that value(say 0.0) on output.

Pls help me how to initialize the variable with space, if it has the values like 0, 0.0, 0.00 etc..

Pls help me with ur valuable suggestions.

Thanks,

Priya

4 REPLIES 4
Read only

Former Member
0 Likes
511

Hello Priya,

What is the data type of the variable? If it an integer/num, its initial value will be 0. Before printing, you may include a condion check like:

if var > 0.

<codes>

Endif.

Read only

former_member194797
Active Contributor
0 Likes
511

Hi Priya,

see the NO-ZERO option of the WRITE statement:

Option

... NO-ZERO

Effect If the contents of f are equal to zero, only blanks are output; if f is of type C or N, leading zeros are replaced by blanks.

Read only

Subhankar
Active Contributor
0 Likes
511

Hi Priya,

Just check the sample code. Here need to pass the variable in to another pack (p) type variable. Then check the initial. based on that you can write it.

data: l_val_c TYPE char20 VALUE ' 0.00',

l_val_p TYPE p LENGTH 15 DECIMALS 3.

l_val_p = l_val_c.

IF l_val_p IS INITIAL.

BREAK-POINT.

ENDIF.

Thanks

Subhankar

Read only

Former Member
0 Likes
511

Hi priya

If u use classical/ ALV report then use :

No-ZERO with WRITE statement.

field-cat = NO-ZERO.

and if u use smart-forms then use :

&symbol(Z)& "Omit Leading Zeros"

Regards,

Abhilash