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 last published in June 2001

Dig Deeper on SAP ABAP

PRO+

Content

Find more PRO+ content and other member only offers, here.

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.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close