cancel
Showing results for 
Search instead for 
Did you mean: 

How to round the fractional values in Abap webdynpro?

Former Member
0 Kudos

Hi Experts,

I have designed a screen in which I have a field called ANZHL(which is numberic field of infotype14) It is a fractional digits which needs to be rounded when it comes to display in my webdynpro application?

Here is my code .........

How to round the ANZHL field ?

**if start and end dates are changed then delete the old and insert the new else just mmodify the record

if ws_0014_temp-begda ne ws_edit-begda or ws_0014_temp-endda ne ws_edit-endda.

call function 'HR_INFOTYPE_OPERATION'

exporting

infty = '0014'

number = wd_this->w_pernr

subtype = ws_0014_temp-subty

objectid = ws_0014_temp-objps

lockindicator = ws_0014_temp-sprps

validityend = ws_0014_temp-endda

validitybegin = ws_0014_temp-begda

recordnumber = ws_0014_temp-seqnr

record = ws_0014_temp

operation = 'DEL'

nocommit = 'X'

importing

return = w_bapireturn.

" key = w_bapireturn.

if w_bapireturn-type ca 'EA'.

r_bapireturn = w_bapireturn.

return.

endif.

ws_0014 = ws_0014_temp.

ws_0014-endda = ws_edit-endda.

ws_0014-begda = ws_edit-begda.

ws_0014-anzhl = ws_edit-anzhl.

call function 'HR_INFOTYPE_OPERATION'

exporting

infty = '0014'

number = wd_this->w_pernr

subtype = ws_0014-subty

objectid = ws_0014-objps

lockindicator = ws_0014-sprps

validityend = ws_0014-endda

validitybegin = ws_0014-begda

recordnumber = ws_0014-seqnr

record = ws_0014

operation = 'INSS'

nocommit = 'X'

importing

return = w_bapireturn.

" key = w_bapireturn.

if w_bapireturn-type ca 'EA'.

r_bapireturn = w_bapireturn.

return.

endif.

else.

ws_0014 = ws_0014_temp.

ws_0014-anzhl = ws_edit-anzhl.

Edited by: Dharani us on Oct 8, 2009 10:15 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

For that attribute, you want to display the decimal values or what.

Regards,

Lekha.

Former Member
0 Kudos

Hi Lekha,

Basically it is no of days field with the value of 1.00,2.00 .....etc.........in the SAP HR system infotype14

But i want this field value should be display as 1,2,.....etc in my webdynpro application...........

Thanks in Advance,

Dharani

Former Member
0 Kudos

Hi,

As i think u can not obtain value in integer only if u are using the field ANZHL.

U can take some other variable of type integer. then copy the value of ANZHL to the variable of type integer.

Former Member
0 Kudos

hi,

You can put decimal values into an integer type and it will be rounded off automatically.

data int type I.

int = 10.80 int will have 11.

int = 10.01 int will have 10.

Former Member
0 Kudos

Hi Pankaj,

Can you please give me the code for the same.

Thanks in Advance,

Dharani

Former Member
0 Kudos

hi ,

u can do like this :


 DATA : field type  ws_edit-anzhl ,
             int type I .
int = field

rgds,

amit

Former Member
0 Kudos

Hi,

data a type anzhl.
data b type I.
a = 10.45
b = a.

u can directly use = operator to assign the value to integer type variable.