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: 

Difficulties with table output

former_member797394
Participant
0 Kudos

Hi everyone.

I am having some problems with a program. I know that the problem is that I am using two Selects. Could someone please help me with this issue? The problem is in locnr value. The table shows dublicated values. Screenshot will be attached.

SELECT-OPTIONS : 
filia FOR wint_carrh-asort DEFAULT ' '
MATCHCODE OBJECT wsor,
p_locnr FOR wrsz-locnr,
p_artnr FOR wlk1-artnr.
LOOP AT i_werks.
FREE i_wlk1.
SELECT wlk1~* INTO TABLE @i_wlk1 FROM wlk1
JOIN wrsz ON wrsz~asort EQ wlk1~filia
WHERE filia EQ @wlk1-filia
AND wlk1~datbi GE @datum_rc
AND wlk1~datbi LE @max_datum
AND quell EQ '3'
AND locnr IN @p_locnr
AND wlk1~artnr IN @p_artnr.
.........
ENDLOOP.
LOOP AT lt_output ASSIGNING <fs_output>.
PERFORM material_read_mara(saplwso1)
USING <fs_output>-artnr sy-datum mara makt.
<fs_output>-maktx = makt-maktx.


SELECT SINGLE locnr INTO <fs_output>-locnr FROM wrsz WHERE asort EQ <fs_output>-filia AND datbi GE sy-datum AND locnr IN p_locnr.
SELECT SINGLE name1 INTO <fs_output>-name1 FROM t001w WHERE werks EQ <fs_output>-locnr.

ENDLOOP.

Result:

If any other piece of code is needed, I will provide it.

Thank you in advance!

7 REPLIES 7

Sandra_Rossi
Active Contributor

Please edit your question, select your code and press the button [CODE], which makes the code appear colored/indented, it will be easier for people to look at it. Thank you!

Sandra_Rossi
Active Contributor

Your question is not more clear than your previous one (https://answers.sap.com/questions/13634681/selection-screen-problems-1.html).

If you don't post the whole code, then please explain the details which are needed for us to understand.

former_member797394
Participant
0 Kudos

The code itself works well, however it duplicates the values after I made some additions to my code. Shall I share whole code for better understanding?

Sandra_Rossi
Active Contributor

I prefer that you don't post the whole code, I prefer that you investigate and locate approximately your error so that to ask a more precise question. But if you don't know what details to give so that people can understand, then it's better that you post the whole code (please attach txt file).

Example about missing info: you didn't post any code about LT_OUTPUT, which is the most important information. I guess that it's the ALV internal table, but nobody can know how you fill it...

former_member797394
Participant

yeah, sorry that I could not fully explain the problem, I am not that good in this. I would rather post the source code. If anything else is needed, I am here to provide. Thank you! source-code.txt

Sandra_Rossi
Active Contributor
0 Kudos

Your program is too complex for anyone in the forum, and most importantly we can't play it with your data.

If I understand your question, you say that you have duplicate values for LOCNR.

If that's the question, I don't see any code in your program where you remove the duplicates.

former_member797394
Participant
0 Kudos

sandrarossi thank you for your time and effort!