on 01-06-2018 12:19 PM
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
Why?
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...
I give up ...
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.
Thanks, Sandra
thank you Sandra for the clarification.
Horst Keller thanks for you patience.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.