Hi Experts,
I want to convert string to numeric for some calculation and want to pass the calculated amount back to string. I am using the below given code:
METHOD get_percent_inc_amt.
data: lv_percent TYpe numc3,
lv_base_sal TYPE i,
lv_cal_amt TYPE i.
*WRITE iv_base_salary to lv_base_sal.
*WRITE iv_percent to lv_percent.
CALL FUNCTION 'CONVERT_STRING_TO_INTEGER'
EXPORTING
p_string = iv_base_salary
IMPORTING
P_INT = lv_base_sal
* EXCEPTIONS
* OVERFLOW = 1
* INVALID_CHARS = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERT_STRING_TO_INTEGER'
EXPORTING
p_string = iv_percent
IMPORTING
P_INT = lv_percent
* EXCEPTIONS
* OVERFLOW = 1
* INVALID_CHARS = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
lv_cal_amt = ( lv_base_sal * lv_percent ) / 100.
ev_calculated_amt = lv_cal_amt.
ENDMETHOD.
I am getting dump in my application. Can anyone suggest me on how should I do the conversion.
Thanks,
Shilpa