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

help needed

Former Member
0 Likes
1,185

hi friends,

i am working on smartform. according to below description could u plz help me code.

Item - Total number of Containers:

Get ANZGEB from QALS where QALS-MBLNR (material document number) = MSEG-MBLNR=LQUA-WENUM. If total number of containers is blank, leave this field (total number of containers) and (Containers to be Sampled) blank.

Item: Containers to be Sampled

Calculated field: “square root of QALS-ANZGEB (round up the value if the decimal point value is > 0.5 else round down the value) plus 1. example: if the square root value is 5.2 then the results will be 5 + 1 = 6 but if the square root value is 5.5 then the results will be 6 + 1 = 7.

regards,

siri.

7 REPLIES 7
Read only

Former Member
0 Likes
1,059

SELECT QALS-ANZGEB into lanzgeb

FROM QALS

WHERE MBLNR = MSEG-MBLNR.

lint = sqrt( lanzgeb ).

lint = lint + 1.

<b>Lint is of type integer and hence would take of the rounding.</b>

Which part..the Rounding off.

lp2 = '3349544.88'.

lint = sqrt( lp2 ).

*answer lint = 1830.

while the correct answer would be 1830.18

Message was edited by: Anurag Bankley

Read only

0 Likes
1,059

Thanx Anurag ,

could u plz explain this a little clearly.

regards,

siri

Read only

0 Likes
1,059

Which part..the Rounding off.

lp2 = '3349544.88'.

lint = sqrt( lp2 ).

*answer lint = 1830.

while the correct answer would be 1830.18

and lets say if lp2 = '248.88'.

lint = sqrt( lp2 ).

*answer lint = 16..and the correct answer is 15.78

Read only

Former Member
0 Likes
1,059

select single ANZGEB from QALS where mblnr = lqua-wenum.

l_val = sqrt( qals-anzgeb ).

l_val = round( qals-anzgeb ).

Regards,

Ravi

Read only

0 Likes
1,059

hi,

data : rslt type i.

select single ANZGEB

from QALS into qals-anzgeb

where mblnr = lqua-wenum.

<b>rslt = sqrt( qals-anzgeb ).

rslt = ciel( qals-anzgeb ).</b>

Regards,

anver

pls mark points for all hlpful answers

Read only

0 Likes
1,059

hi Ravi when i used this round(qals-anzeb) it is showing syntax error for round.

siri.

Read only

0 Likes
1,059

I'm Sorry. There is no function for round as it is.

There is an fm.

CALL FUNCTION 'ROUND'

EXPORTING

INPUT = VALUE_FLOAT

DECIMALS = 0

SIGN = ' '

IMPORTING

OUTPUT = E_VALUE

EXCEPTIONS

OVERFLOW = 01

INPUT_INVALID = 02

TYPE_INVALID = 03.

REgards,

Ravi