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

Quantity in smartforms

Former Member
0 Likes
2,392

Hi, in sales order the quantity is 11.5 but when printed out, it turned out 12. how can I change this?

thanks a lot! kitty

13 REPLIES 13
Read only

Former Member
0 Likes
1,527

Hi Kitty,

Use a variable of type char. It's length should be equal to output length of the (Quantity + Decimal Places).

Pass the value of quantity in this variable and display this variable on the screen.

Regards,

Neeraj Gupta

Read only

0 Likes
1,527

Hi thanks for u quickly reply, could you pls explain more clear?

b.r susan

Read only

0 Likes
1,527

hi kitty,

1. write the number field INTO the charcter field,

and display this character field (instead of number field) in the smartform.

2. For Eg :

REPORT abc.

data : num type p decimals 2.

data : s(10) type c.

num = '25.15'.

write num to s.

write 😕 s.

regards,

amit m.

Read only

Former Member
0 Likes
1,527

Hi Kitty,

Move the value in quantity to a char field of same size.

and use this variable for printing.

eg:

declare hte variable in global.

data v_menge(13).

v_menge = 'ur_quantity_field'.

while printing in smarform use this variable as &v_menge'.

Please let us know if its working for you/

Best Regards,

Anjali

Read only

0 Likes
1,527

I think there is a conversation in the data type.

kwmeng is p, decimal 3, and the vairable is p, with demcimal o. after the step variable = kwmeng, the figure is rounded. so where can I change in this case?

thanks for all help. b.r kitty

Read only

0 Likes
1,527

Since you are using data type p with decimals 0 it is rounded off.

Instead try using a variable with decimals 3 or a character data type.

Ps: Reward points if helpful.

Read only

FredericGirod
Active Contributor
0 Likes
1,527

Hi,

Is there something after the name of your data ? like &data(.0)& ?

if yes just remove the (.0)

Rgd

Frédéric

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,527

Hi,

In Global Definition->Global Data,declare the character variable whose output lenght is equal to that of that field.

In Program logic,use the field as input parameter and the variable you declared as output parameter.

In the coding,assign the value to the variable.

Then instead of printing the field,print the variable.

Kindly reward points by clicking the star on the left of reply,if it helps.

Read only

Former Member
0 Likes
1,527

Hi,

Why dont u try

&field(.<n>)&

syntax which limits output of decimal places to <n>

regards

austin

Read only

Former Member
0 Likes
1,527

Hi kitty,

Here is the sample code:

Suppose KWMENG is your quantity field. Declare variable quan as follows.

Data: quan(19) type c.

kwmeng = '11.5'.

quan = kwmeng.

Now, display quan instead of KWMENG.

Regards,

Neeraj Gupta

Read only

Former Member
0 Likes
1,527

Hi Kitty,

May be u use integer type for that field. So, u get round up value. U can take the variable type p with decimals 2.

eg. menge type p decimals 2

Regards,

Digesh Panchal

Read only

Former Member
0 Likes
1,527

Use &QUANTITY(.1)&

Read only

santosh_patil6
Explorer
0 Likes
1,527

Use &QUANTITY(C.2)&

and declare quantity like any database quantity field.

if helpful, reward the points and close the question.