Q

Converting amount fields

In layout - I need to pass an amount field (type curr) by perform command to do some calculations. The problem is that the field, as input parameter to the ABAP form, is of type c. how should I convert it to decimal for the calculations?

In layout - I need to pass an amount field (type curr) by perform command to do some calculations. The problem is that the field, as input parameter to the ABAP form, is of type c. how should I convert it to decimal for the calculations?


You can directly convert. The following code is perfectly valid, as long c_num is a valid representation of a decimal number. and the destination field is defined large enough to contain the source value, otherwise you will get a runtime error.

Data: c_num(16) value '123.45', f_num type f, p_num type p decimals 2. p_num = c_num. f_num = c_num.

Determining that c_num is a valid representation of a decimal number is not always trivial. For your case, using Perform from a layout set, you probably won't have to worry about this - i.e. the field will always be valid, or initial.


This was first published in June 2001

Dig deeper on SAP ABAP

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close