08-30-2018 5:28 AM
guys i have written a program to evaluate the string but while writing exception it is giving an error so i have tried an exception handling method i.e try and catch .
following is my code
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
DATA: value TYPE p DECIMALS 3 ,
str TYPE string.
DATA: ocx_root TYPE REF TO cx_root.
START-OF-SELECTION.
str = '( ( 1830 * 1000 ) / 31104 ) / 0 ' .
try.
value = cl_java_script=>create( )->evaluate( str ).
catch CX_SY_CONVERSION_NO_NUMBER into ERROR_REF.
ERR_TEXT = ERROR_REF->GET_TEXT( ).
write ERR_TEXT.
endtry.
08-30-2018 12:53 PM
Your syntax (implicit conversion expected?) triggered a non-handleable exception in the call of the class, you could use an intermediate string field to get a handleable exception.
numfield = cl_java_script=>create( )->evaluate( str ). " not handleable
numfield = stringfield = cl_java_script=>create( )->evaluate( str ). " handleable
08-31-2018 6:42 AM
first of all thanks for precious reply brother
but this code is not working as i have use this code before u send me i was thinking i have written it wrong way.
will send me complete code so i can added it in my program .
08-31-2018 9:13 AM
For compatibiliy (readibility) I would write
my_java = cl_java_script=>create( ).
result_string = my_java->evaluate( input_string ).
result_num = result_string.
09-01-2018 3:43 AM
thank you 'ray' brother yesterday only done that report using this method thank you once again