Application Development 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: 

Parameter cannot be converted to anumber

8it8
Explorer
0 Kudos

Hey,

I've created in include SEL this sum parameter:

PARAMETERS: p_sum type i.

In the CLI include I WROTE THIS select:

CLASS lcl_main_sfp IMPLEMENTATION.

METHOD select_data.

SELECT mara~matnr, mara~mtart, makt~maktx, mara~ersda
UP TO p_sum ROWS
FROM mara
INNER JOIN makt
ON makt~matnr = mara~matnr
INTO CORRESPONDING FIELDS OF TABLE @mt_table.

ENDMETHOD.

and I get the following error:

What can be the problem? is't this from the same type?

1 ACCEPTED SOLUTION

DominikTylczyn
Active Contributor

Hello 8it8

Your SELECT statement would be syntactically correct if:

  • P_NUM is indeed of I type,
  • P_NUM is escaped with @ as you have already escaped MT_TABLE with @ thus using the new Open SQL syntax.

You have declared P_NUM as a parameter with I type, still you get the error about P_NUM not being a number. That is strange and I suspect that you have also defined P_NUM as a parameter of the SELECT_DATA method.

Would you be able to share the declaration of the method?

Best regards

Dominik Tylczynski

7 REPLIES 7

Eduardo-CE
Active Participant

Hi,

Try like this:

  SELECT
*
UP TO @p_num ROWS
INTO TABLE @DATA(it_tmp)
FROM mara INNER JOIN makt
on mara~matnr = makt~matnr.

raymond_giuseppi
Active Contributor

You activated the strict mode for ABAP SQL statement as soon as you used the @ in the resulting internal table. So use also @p_sum for the host variable.

thilakan_t
Participant
0 Kudos

It works in S/4HANA 1909(ABAP Platform 1909). what is the version of your system?

8it8
Explorer
0 Kudos

so how to deal with this?

8it8
Explorer
0 Kudos

Thanks.

I really had to get rid of the @ from the table and actually there was another issue (very simple...)

the SEL INCLUDE was below the the CLI include.....

Sandra_Rossi
Active Contributor
0 Kudos

8it8

To answer your quote "how to deal with this", did you realize what Raymond and Eduardo have said before you ask? (@p_sum instead of p_sum)

DominikTylczyn
Active Contributor

Hello 8it8

Your SELECT statement would be syntactically correct if:

  • P_NUM is indeed of I type,
  • P_NUM is escaped with @ as you have already escaped MT_TABLE with @ thus using the new Open SQL syntax.

You have declared P_NUM as a parameter with I type, still you get the error about P_NUM not being a number. That is strange and I suspect that you have also defined P_NUM as a parameter of the SELECT_DATA method.

Would you be able to share the declaration of the method?

Best regards

Dominik Tylczynski