Skip to Content
-2

inner join to loop

Jan 06 at 12:19 PM

143

avatar image

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.
10 |10000 characters needed characters left characters exceeded

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

0

This seems to be answered, please close the question.

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Horst Keller
Jan 06 at 06:20 PM
1

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.

Show 11 Share
10 |10000 characters needed characters left characters exceeded

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.

0

Why?

1

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.

0

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

0

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

0

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

3

I give up ...

2

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.

2

Thanks, Sandra

2

thank you Sandra for the clarification.

1

Horst Keller thanks for you patience.

1