10-08-2009 10:21 AM
Hello ABAPers,
Could you please tell me how to do it?
I have a currency field on a selection screen of type 'DMBTR'.
When i input and press the enter key ,i want the value to be displayed in the following style.
1. CURRENCY EQ 'JPY'
EX:
Value before pressing EnterKey = 123456
Value after pressing EnterKey = 123,456
i.c the value should be displayed without decimal point
2. CURRENCY NE 'JPY'
EX:
Value before pressing EnterKey = 123456
Value after pressing EnterKey = 123,456.00
i.c the value should be displayed with decimal point
Note:The above trick has already been done on a standard dynpro screen of Tr.Code FB60 and Field 'Amount'.
<removed_by_moderator>
Thanks and Regards,
Mohan
Edited by: Govindasamy Mohan on Oct 8, 2009 6:22 PM
Edited by: Julius Bussche on Oct 9, 2009 1:36 PM
10-08-2009 10:25 AM
Hi Mohan,
For the 1st requirment Use:-
1 screen field as P decimals 0.
2 screen field as P decimals 2.
do not use DMBTR.
Hope this will solve ur problem.
Regards,
ABAPlover
10-08-2009 10:24 AM
Firstly dont use ALL CAPS in the subject line
For japanese currency you dont have to do any conversion. The system will internally remove the decimals by multiplying it by a factor of 100.
10-08-2009 10:25 AM
Hi Mohan,
For the 1st requirment Use:-
1 screen field as P decimals 0.
2 screen field as P decimals 2.
do not use DMBTR.
Hope this will solve ur problem.
Regards,
ABAPlover
10-09-2009 2:32 AM
Hi ABAP Lover,
Thanks a lot for your reply.
I had the same idea as yours like using data type 'P'.
But, the problem is that there is only one currency field on the screen .There is also a field of 'Company Code'.
Both fields are mandatory .
Hence,the requirement is to convert the currency value to the currency of the company code which is input .
The conversion should yield the following output on the screen after pressing the enter button.
1. When currency EQ 'JPY' , the value should be displayed without decimal point
2.When currency NE 'JPY' , the value should be displayed with decimal point
I am very sorry for not explaining you clearly in my first posting.
Thanks and Regards,
Mohan
10-09-2009 6:38 AM
Hi Mohan,
I am not too sure if this option would solve your problem.
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS: PO_AMT TYPE C AS CHECKBOX,
PO_AMT1 TYPE C AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN.
IF PO_AMT = 'X'.
DATA: ZAMT TYPE P.
ELSEIF PO_AMT1 = 'X'.
DATA: ZAMT1 TYPE P DECIMALS 2.
ENDIF.
Please let me know if it is of any help.
Thanks.
10-09-2009 11:57 AM
HI Mohan.
Try Like This
USE
PARAMETERS currency type c.
PARAMETERS cur(15) TYPE p DECIMALS 2.
PARAMETERS cur1(15) TYPE c no-DISPLAY .
at SELECTION-SCREEN OUTPUT.
IF currency = 'J'.
cur = cur1.
ENDIF.
this will solve ur problem.
Regards,
ABAPLover
10-09-2009 7:17 AM
Just try this small sample.
REPORT zrgstst.
TABLES: t001,
bseg.
PARAMETERS: bukrs LIKE t001-bukrs,
dmbtr LIKE bseg-dmbtr.
AT SELECTION-SCREEN ON bukrs.
SELECT SINGLE * FROM t001
WHERE bukrs = bukrs.
IF sy-subrc NE 0.
ENDIF.
START-OF-SELECTION.
WRITE: dmbtr CURRENCY t001-waers, t001-waers.
NB 1. The key concept is the link between the CURR currency amount field and its associated CUKY currency code field, here BSEG-DMBTR is linked to T001-WAERS via DDIC definition.
NB 2. There are other currency codes with 0 decimals ans some have 3 decimals
Regards,
Raymond
09-23-2014 3:06 PM
Check the approach from 9574 - Currency fields on selection screens
Test program:
REPORT zpi_curr_formatting.
TABLES sflight.
PARAMETERS:
p_price TYPE sflight-price,
p_cur TYPE sflight-currency.
AT SELECTION-SCREEN ON p_cur.
MOVE p_cur TO sflight-currency.