‎2022 Apr 08 7:12 AM
HI ALL!
I struggling at the moment with the following issue.
There is one material that has two different data on a line. TABLE wlk1. It is easier to explain with screenshots.
If you can see in Screenshot 1, one material 1000001 (WLK1-ARTNR) has three different data in Module column (WLK1-URSAC). I need to show all of the Module codes in my report. So, I wrote the following code:
SELECT SINGLE ursac INTO <fs_output>-ursac FROM wlk1 WHERE ( quell EQ 3 AND sstat EQ ' ' AND artnr EQ <fs_output>-artnr ).
With this code, I am only getting the same module code for all 1000001 material entry. However, I need all three data. See Screenshot 2, to see my report result.
If any other information or part of the code is needed, I will provide it to you.
THANX IN ADVANCE!


‎2022 Apr 08 7:28 AM
SELECT SINGLE ursac INTO <fs_output>-ursac FROM wlk1 WHERE ( quell EQ 3 AND sstat EQ ' ' AND artnr EQ <fs_output>-artnr ).SINGLE means: I only want one result.
SELECT ursac
INTO table @data(my_results)
FROM wlk1
WHERE quell EQ 3
AND sstat EQ ' '
AND artnr EQ @<fs_output>-artnr .
‎2022 Apr 08 7:31 AM
Hello khasanyusupkhujaev
You are using SELECT SINGLE statement, that by definition returns only one record. Get rid of SINGLE and the SELECT will return all suitable records.
In my opinion SELECT SINGLE must not be used unless you specify the full key in the WERE clause. Otherwise if you need just one record use SELECT UP TO 1 ROWS.
Best regards
Dominik Tylczynski