Application Development and Automation 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: 
Read only

Solve Runtime errors 'CX_SY_CONVERSION_NO_NUMBER'

Former Member
0 Likes
12,687

When I test a subroutine that included in SAPScript,a runtime error occured.Below is the error message.

-


Unable to interpret " XXXX.XX " as a number.

-


Error Analysis:

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_CONVERSION_NO_NUMBER', was not

caught in

procedure "SUB_DETAILS" "(FORM)", nor was it propagated by a RAISING clause. Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.The reason for the exception is:

The program attempted to interpret the value " XXXX.XX " as a number, but

since the value contravenes the rules for correct number formats,

this was not possible.

DATA: GV_AMOUNT TYPE KWBTR.

READ TABLE IN_PAR WITH KEY NAME = 'FEBSCA-KWBTR'.

PACK IN_PAR-VALUE TO GV_AMOUNT.

>>>>> GV_AMOUNT = IN_PAR-VALUE.

How can i solve this ? Big help needed. Appreciated. Thanks,

Shehryar

1 ACCEPTED SOLUTION
Read only

former_member186741
Active Contributor
0 Likes
2,444

I am guessing this is because the string is coming in with '.' as the decinal point but you have ',' or something else set as your personal decinal point.

5 REPLIES 5
Read only

former_member186741
Active Contributor
0 Likes
2,445

I am guessing this is because the string is coming in with '.' as the decinal point but you have ',' or something else set as your personal decinal point.

Read only

former_member186741
Active Contributor
0 Likes
2,444

I am guessing this is because the string is coming in with '.' as the decinal point but you have ',' or something else set as your personal decinal point.

You can either change your setting to accept '.' as the dp or you can edit the string to change ',' to '.'.

eg,

replace all occurences of '.' in l_string with ',' .

Read only

former_member784222
Active Participant
0 Likes
2,444

Hi,

In your sap script, before calling the routine

/: SET COUNTRY <YOUR COUNTRY>

send the value as &WRBTR(T)&. This takes away the grouping.

In the subroutine:

SET COUNTRY <YOUR COUNTRY>.

Then rest step as it is.

Thanks and regards,

S. Chandra Mouli.

Read only

Clemenss
Active Contributor
0 Likes
2,444

Hi shehryar,

if you do a test output in SAPscript forms development in SE71, output fields are filled with X characters regardless if they are numeric.

If you call a subroutine in SAPScript, the values are passed and the CX_SY_CONVERSION_NO_NUMBER is raised.

In your subroutine you should be aware that all Sapscript symbols are character-like data and must be converted to numeric representation.

Try to integrate this subroutine (derived from Padmam's contribution yesterday):


*&---------------------------------------------------------------------*
*&      Form  conv
*&---------------------------------------------------------------------*
*       Try conversion to numeric value
*----------------------------------------------------------------------*
FORM conv  USING    pv_clike TYPE c
           CHANGING pv_number
                    pv_error TYPE sy-subrc.

  TRY.
      CLEAR pv_error.
      pv_number = pv_clike. "Convert string to number.
    CATCH cx_sy_conversion_no_number.
      pv_error = 1.
    CATCH cx_sy_conversion_overflow.
      pv_error = 2.
  ENDTRY.

ENDFORM.                    " conv

Now you can test your form as well as use it.

Regards,

Clemens

Read only

Former Member
0 Likes
2,444

Thanks guys..!