Application Development 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: 

Purchase Requisition(ME51n)-Amount field in custom screen in item

Former Member
0 Kudos
1,001

Hi,

I have created an new tab in PR(ME51n) item and I have one field lw_amount with the type of domain WERT7.

This field lw_amount will have total amount of all the PR line item.

Ex. I am created a PR with single line item Currency key USD with the value 110,000.00 and the same value is coming to my custom screen fine. The problem is if I change the currency key VND then the total is coming in PR line item but displaying the amount in custom screen is wrong its showing as 110,000.00 but it should be like 11,000,000(which is displayed in PR line item.

Below is my logic

lw_amount       = lw_amount + ( ( <fs_reqitem>-menge * <fs_reqitem>-preis / <fs_reqitem>-peinh ) * lw_exchange_rate ).

actual problem is the currency key as my understand.

.

Could you please someone help me to resolve.

Regards,

A Vadamalai.

5 REPLIES 5

Former Member
0 Kudos
280

Hi Team,

Can you please advise.

Regards,

A Vadamalai.

0 Kudos
280

If this field is available in the table, please make sure that the reference field in the currency/quantity tab of the table is EBAN-WAERS.

If the field is only available in the screen then please maintain the same reference field in the attributes section under Dictionary tab.

You may perform the multiplication and formatting of field if none of the above works.

Shortest way to achieve this would be to get the number of decimal places for the currency and multiply divide by 10 to the power of it. The currencies like Japanes Yen or Korean Won does not have any decimal places and they will need multiplication by a factor of 100. One of the TCUR* tables has the exact number of decimal places for each currency. You will also need to adjust the field definition and make sure the amount notation is as per the user parameter. (1,234,567.90 or 1.234.567,89)

Regards,

Hashim

kumar_sp
Explorer
0 Kudos
280

Hi,

After getting the amount field pass that field to below mention function module you will get your required value. hope your problem will be rectified.

CALL FUNCTION 'CURRENCY_AMOUNT_SAP_TO_DISPLAY'

        EXPORTING

          CURRENCY        = 'INR'

          AMOUNT_INTERNAL = V_AMOUNT_INTERVAL

        IMPORTING

          AMOUNT_DISPLAY  = V_AMOUNT_INTERVAL

        EXCEPTIONS

          INTERNAL_ERROR  = 1

          OTHERS          = 2

Regards,

Kumar

raymond_giuseppi
Active Contributor
0 Kudos
280

First look in ABAP Keyword Documentation for Currency Fields, look for Handling in Screens.


  • When displaying a screen field of type CURR, the reference field for the currency key is searched for in the global data of the current ABAP program. The content of this field must be a valid currency code from the TCURC database table. If the reference field is not found or there is no entry in the TCURX database with the content of the field, the currency field is displayed by default with two decimal places.

The reference field is either defined in the relevant structure in ABAP Dictionary or was determined using the Screen Painter for the attributes of the screen field. It does not have to be present on the screen itself.

So either use a ddic reference when defining field in the top (global data) include or definet it in the field attributes (reference field) in dynpro definition.

Also, try to not calculate currency conversion, but use a FM as CONVERT_TO_LOCAL_CURRENCY.

Regards,

Raymond

0 Kudos
280

Hi,

the actual problem is with currency reference only, check the reference field given in the screen , if it is not correct give your exact screen name of currency. then also if it is not working, please convert your final output before displaying to internal amount format and try.