2009 Apr 15 7:12 PM
Hi All,
I need to assign/convert one char value say 19000000.85 to a varible defined as char type,length 14 with decimal 0 value, for which below code i wrote:
data: item_value like zstruct-value. (here zstruct is structure and field "value" is of type c lenth 14 dec 0)
data:p_float type f,
p_packed type p decimals 2,
w_char(18) type c.
move item_value to p_float.
p_packed = p_float.
w_char = p_packed.
move w_char to item_value .
The value i am getting in debugg is w_char = 19000000.85(correctly coming) but while executing last move statement value of "item_value" is coming as 19000000 (no decimal val).I want the value of "item_value " should be 19000000.85 .How to convert this value?
Thanks
2009 Apr 15 7:33 PM
Simply use
condense w_char no-gaps. " <<<< Use this statement
move w_char to item_value
a®
Simply use
condense w_char no-gaps. " <<<< Use this statement
move w_char to item_value
a®
2009 Apr 15 7:23 PM
Hi,
check this function module
Amount to string:
CALL FUNCTION 'HRCM_AMOUNT_TO_STRING_CONVERT'
EXPORTING
betrg = 3000
WAERS = 'DKK'
NEW_DECIMAL_SEPARATOR =
NEW_THOUSANDS_SEPARATOR =
IMPORTING
STRING = slam
.
OR
DATA: L_AMOUNT LIKE BSEG-DMBTR,
L_AMOUNT_STRING(15) TYPE C.
Find 1000 seperator. If decimal seperator = . then
1000 seperator = , else 1000 seperator = .
L_AMOUNT = '1.00'.
WRITE L_AMOUNT TO L_AMOUNT_STRING.
IF L_AMOUNT_STRING CS ','.
P_SEP = '.'.
ELSE.
P_SEP = ','.
ENDIF.
Regards
Krishna
2009 Apr 15 7:33 PM
Simply use
condense w_char no-gaps. " <<<< Use this statement
move w_char to item_value
a®
2009 Apr 15 8:00 PM
Hi Debabrata ,
Amount to string:
CALL FUNCTION 'HRCM_AMOUNT_TO_STRING_CONVERT'
EXPORTING
betrg = 3000
WAERS = 'DKK'
* NEW_DECIMAL_SEPARATOR =
* NEW_THOUSANDS_SEPARATOR =
IMPORTING
STRING = slam
.
String to amount:
CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'
EXPORTING
string = slam2
DECIMAL_SEPARATOR = '.'
* THOUSANDS_SEPARATOR =
WAERS = 'HUF'
IMPORTING
BETRG = b2
* EXCEPTIONS
* CONVERT_ERROR = 1
* OTHERS = 2
or
L_AMOUNT = '1.00'.
WRITE L_AMOUNT TO L_AMOUNT_STRING.
write my_amount to l_stramount using edit mask l_edit_mask_amount.
write my_quant to l_strquant using edit mask l_edit_mask_quant.
WRITE P_AMOUNT_STRING TO P_AMOUNT_STRING RIGHT-JUSTIFIED.
Regards,
Prabhudas
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |