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

Select statement cannot be done due to UNICODE flag error message

Raxph
Participant
0 Likes
1,281

Hi all,

I am trying to do a selection statement that select two fields from the table KNVV. The selection is as below:

  SELECT SINGLE podtg, podkz
      FROM knvv
      INTO (lv_podtg, lv_podkz)
       WHERE kunnr = vkdfs-kunnr
       AND vkorg = vkdfs-vkorg
       AND vtweg = vkdfs-vtweg
       AND spart = vkdfs-spart.

I get this error message as below:

This SELECT statement uses additions that can only be used with Unicode flag enabled.

I believe that the issue is happening due to the field podkz, as when I did the selection without it, it worked perfectly and this is also a field which the values are 'X' or empty.

Can you please give me a suggestion on how to fix this issue?

Thank you all in advance!

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
1,067

There is the old ABAP SQL syntax, and the new "strict" ABAP SQL syntax. The syntaxes cannot be mixed.

And the error messages are often not very clear.

Your 1st line is in new syntax because of the comma.

Your 5 last lines are in old syntax because ABAP variables are not preceded with arobase (see Host variables in ABAP documentation).

Either old syntax:

SELECT SINGLE podtg podkz
      FROM knvv
      INTO (lv_podtg, lv_podkz)
       WHERE kunnr = vkdfs-kunnr
       AND vkorg = vkdfs-vkorg
       AND vtweg = vkdfs-vtweg
       AND spart = vkdfs-spart.

Or new syntax:

SELECT SINGLE podtg, podkz
      FROM knvv
      INTO (@lv_podtg, @lv_podkz)
       WHERE kunnr = @vkdfs-kunnr
       AND vkorg = @vkdfs-vkorg
       AND vtweg = @vkdfs-vtweg
       AND spart = @vkdfs-spart.
1 REPLY 1
Read only

Sandra_Rossi
Active Contributor
1,068

There is the old ABAP SQL syntax, and the new "strict" ABAP SQL syntax. The syntaxes cannot be mixed.

And the error messages are often not very clear.

Your 1st line is in new syntax because of the comma.

Your 5 last lines are in old syntax because ABAP variables are not preceded with arobase (see Host variables in ABAP documentation).

Either old syntax:

SELECT SINGLE podtg podkz
      FROM knvv
      INTO (lv_podtg, lv_podkz)
       WHERE kunnr = vkdfs-kunnr
       AND vkorg = vkdfs-vkorg
       AND vtweg = vkdfs-vtweg
       AND spart = vkdfs-spart.

Or new syntax:

SELECT SINGLE podtg, podkz
      FROM knvv
      INTO (@lv_podtg, @lv_podkz)
       WHERE kunnr = @vkdfs-kunnr
       AND vkorg = @vkdfs-vkorg
       AND vtweg = @vkdfs-vtweg
       AND spart = @vkdfs-spart.