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

Parameter cannot be converted to anumber

8it8
Explorer
0 Likes
2,250

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
Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
2,108

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
Read only

Eduardo-CE
Active Participant
2,108

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.
Read only

RaymondGiuseppi
Active Contributor
2,108

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.

Read only

thilakan_t
Participant
0 Likes
2,108

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

Read only

8it8
Explorer
0 Likes
2,108

so how to deal with this?

Read only

8it8
Explorer
0 Likes
2,108

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.....

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,108

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)

Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
2,109

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