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

Print deimal number when value is present in scripts

Former Member
0 Likes
640

Hi I am Veerendra.

I am having Quatity fields to be printed in scripts. I need to print value like 12.43 when there value afoter '.' is there.

If it is like 12.00 then I should print 12.

Please provide the solution,

Thanks

Veerendra

Hi I am Veerendra.

I am having Quatity fields to be printed in scripts. I need to print value like 12.43 when there value afoter '.' is there.

If it is like 12.00 then I should print 12.

Please provide the solution,

Thanks

Veerendra

5 REPLIES 5
Read only

naimesh_patel
Active Contributor
0 Likes
615

Hello,

/: if &itab-menge(.1)& eq space.

AS &itab-menge(.0)&

/: else.

AS &itab-menge(.2)

/: endif.

Regards,

Naimesh

Read only

Former Member
0 Likes
615

Hello,

You can try like this.

Number of Decimal Places

A program symbol of one of the data types DEC, QUAN, and FLTP can contain decimal place data. Use the option below to override the Dictionary definition for the number of decimal places for the formatting of this symbol value.

Syntax

&symbol(.N)&

The EKPO-MENGE field contains the value 1234.56. The Dictionary definition specifies 3 decimal places and an output length of 17.

&EKPO-MENGE& -> 1,234.560

&EKPO-MENGE(.1) -> 1,234.6

&EKPO-MENGE&(.4) -> 1,234.5600

&EKPO-MENGE&(.0) -> 1,235

IF useful reward points.

Regards,

Vasanth

Read only

Former Member
0 Likes
615

&X_EKPO-TXZ01(10.2)&

or simply say &X_EKPO-TXZ01(.2)&

Regards,

Srikanth.

Read only

andreas_mann3
Active Contributor
0 Likes
615

Hi Veerendra,

try tht sample:

REPORT zforum97 .

PARAMETERS val TYPE bseg-wrbtr DEFAULT 12.
DATA cnt type p decimals 2.
DATA vchar(16).

<b>cnt = frac( val ).</b>
IF cnt = 0.
  WRITE val TO vchar DECIMALS 0.
ELSE.
  WRITE val TO vchar .
  TRANSLATE vchar USING  ',.'. "for germans
ENDIF.

WRITE vchar.

regards Andreas

Read only

Former Member
0 Likes
615

Hi Virendra,

Below info should be useful to u.

The EKPO-MENGE field contains the value 1234.56. The Dictionary definition specifies 3 decimal places and an output length of 17.

&EKPO-MENGE& -> 1,234.560

&EKPO-MENGE(.1) -> 1,234.6

&EKPO-MENGE&(.4) -> 1,234.5600

&EKPO-MENGE&(.0) -> 1,235

Plz reward with points if found helpful.

Thanks and regards,

Nagendranatha Reddy