cancel
Showing results for 
Search instead for 
Did you mean: 

inner join to loop

0 Kudos

can this be done through without using joins.

In the below code I am taking input as werks from the user and putting in a800, based on output again taking knumh from A800 and putting in KONH to get results.

*SELECT  KONH~mandt as MANDT,

*        KONH~KNUMH as KNUMH,

*        KONH~ERNAM as ERNAM,

*        KONH~ERDAT as ERDAT,

*        KONH~VADAT as VADAT
*           INTO table @DATA(gt_final)

*      FROM A800

*  inner JOIN KONH

*      ON KONH~Knumh = A800~Knumh

* WHERE A800~WERKS IN @S_WERKS.
Sandra_Rossi
Active Contributor
0 Kudos

Why do you want to change it? A join is always to be preferred.

Jelena
Active Contributor
0 Kudos

This seems to be answered, please close the question.

Accepted Solutions (0)

Answers (1)

Answers (1)

horst_keller
Product and Topic Expert
Product and Topic Expert

What do you want to achieve? What's not working with the join? What do you mean with loop? From a short look, a subquery in the WHERE condition might be more appropriate.

0 Kudos

I want to code using other than join, if we could do it this way below, but I am not getting all the data in second internal table,
Select *
from A800
into TABLE @it_werks1
where a800~werks in @S_WERKS.
IF sy-subrc EQ 0.


if it_werks1 is not initial.
SELECT mandt, knumh, ernam, erdat,
VADAT
from konh
into CORRESPONDING FIELDS OF table @it_final
FOR ALL ENTRIES IN @it_final
where knumh eq @it_final-knumh.


IF sy-subrc = 0 and it_final is NOT INITIAL.
APPEND lines of it_werks1 to it_werks2.
ENDIF.
endif.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

if i go to abap cockpit with the above there is a buffered table check that I am not able to remove using the bypass buffer statement hence trying to execute using the select queries without the joins.

Please help abap experts.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

There is a pseudocomment to suppress the CI warning. Read the long text of the warning.

0 Kudos

yes Horst but can you suggest some changes in code because I don't want to supress the warning using the cI suppress warning.

matt
Active Contributor

So you want to write bad code in order to not get a message about bypassing the buffer. I'm not entirely convinced this is the correct approach...

horst_keller
Product and Topic Expert
Product and Topic Expert

I give up ...

Sandra_Rossi
Active Contributor

There is a belief that pseudocomments and pragmas should never be used because developers use them to allow bad programming (this belief exists in consulting companies ; those developers often refer to the CAST software which counts by default the quantity of pseudocomments/pragma used as being a possible indicator of bad programming).

Of course, this is not bad programming, but there are "bad developers" who don't understand what the pseudocomments/pragmas mean (not able to understand their exact meaning, and what to do). They should be understood as being fully part of ABAP. They are not evil. If the code is right, then use the pragma to tell it to the static checker.

So, the good question here, what is the best, use the buffer and no join, or use the join and no buffer? There can be many rows, so a join sounds to be preferrable. You have to make a quick performance comparison by using a database with a volume like in production.

horst_keller
Product and Topic Expert
Product and Topic Expert

Thanks, Sandra

thank you Sandra for the clarification.

Horst Keller thanks for you patience.