Code: Alles auswählen.
data: LT_EKPO type table of EKPO with header line,
LS_EKPO type EKPO,
LT_EKKO type table of EKKO with header line,
LS_EKKO type EKKO,
LS_ALV_EKPO type TY_ALV_OUT,
LS_ALV_EKKO type TY_ALV_OUT.
field-symbols:
<EKPO> type EKPO,
<EKKO> type EKKO,
<LFM1> type LFM1.
select * from EKPO
into corresponding fields of table LT_EKPO
where BUKRS = '0300'
and WERKS = '0060'.
check LT_EKPO[] is not initial.
select * from EKKO
into corresponding fields of table LT_EKKO
for all entries in LT_EKPO
where LIFNR = LT_EKPO-KUNNR.
sort LT_EKKO by LIFNR.
delete adjacent duplicates from LT_EKKO comparing LIFNR.
loop at LT_EKKO into LS_EKKO.
move-corresponding LS_EKKO to LS_ALV_EKKO.
append LS_ALV_EKKO to GT_ALV_OUT.
endloop.
kann mit diesem Select-Statement1. Ich brauche alle Positionen mit ekpo-bukrs = '1111' + ekpo-werks = '2222' + Lieferant aus Tabelle ekko (ekko-lifnr)
nicht funktionieren.where BUKRS = '0020'
and WERKS = '0010'.
Code: Alles auswählen.
* data: LS_ALV_OUT type TY_ALV_OUT.
*
* data: begin of LS_LIEF,
* BUKRS type EKPO-BUKRS,
* WERKS type EKPO-WERKS,
* KUNNR type EKPO-KUNNR,
* LIFNR type EKKO-LIFNR,
* end of LS_LIEF,
* LT_LIEF like sorted table of LS_LIEF
* with unique key BUKRS WERKS KUNNR LIFNR.
*
* select P~BUKRS P~WERKS P~KUNNR K~LIFNR
* from EKPO as P inner join EKKO as K on P~KUNNR = K~LIFNR
* into corresponding fields of table LT_LIEF
* where P~BUKRS = '0020'
* and P~WERKS = '0010'.
*
* check LT_LIEF[] is not initial.
* delete adjacent duplicates from LT_LIEF comparing LIFNR.
*
* loop at LT_LIEF into LS_LIEF.
* move-CORRESPONDING LS_LIEF to LS_ALV_OUT.
* append LS_ALV_OUT to GT_ALV_OUT.
* endloop.
Code: Alles auswählen.
IF LT_LIEF is not initial.
Weitere Verarbeitung.
ELSE.
Message 'Table LT_LIEF is LEER' type 'I'.
ENDIF.
Code: Alles auswählen.
data:
LS_ALV_OUT type TY_ALV_OUT.
data: begin of LS_LIEF,
BUKRS type EKPO-BUKRS,
WERKS type EKPO-WERKS,
KUNNR type EKPO-KUNNR,
LIFNR type EKKO-LIFNR,
end of LS_LIEF,
LT_LIEF like standard table of LS_LIEF.
select P~BUKRS P~WERKS P~KUNNR K~LIFNR
from EKPO as P inner join EKKO as K on P~KUNNR = K~LIFNR
into corresponding fields of table LT_LIEF
where P~BUKRS = '0020'
and P~WERKS = '0010'.
* check LT_LIEF[] is not initial.
if LT_LIEF is not initial.
* MESSAGE 'Weitere verarbeitung!' type 'I'.
select lifnr from lfm1 into TABLE lt_lief
where bukrs = '0020'.
else.
message 'Table LT_LIEF is LEER' type 'I'.
endif.
delete adjacent duplicates from LT_LIEF comparing LIFNR.
loop at LT_LIEF into LS_LIEF.
move-corresponding LS_LIEF to LS_ALV_OUT.
append LS_ALV_OUT to GT_ALV_OUT.
endloop.
Folgende Benutzer bedankten sich beim Autor ereuss für den Beitrag:
Nadine_2706
Code: Alles auswählen.
select P~BUKRS P~WERKS P~KUNNR K~LIFNR
from EKPO as P inner join EKKO as K on P~EBELN = K~EBELN
into corresponding fields of table LT_LIEF
where P~BUKRS = '0020'
and P~WERKS = '0010'.
delete adjacent duplicates from LT_LIEF comparing LIFNR.
select LIFNR EKORG from LFM1 into table LT_LFM1
where EKORG = '0020'
and LIFNR ne LT_LIEF-LIFNR.
loop at LT_LFM1 into LS_LFM1.
move-corresponding LS_LFM1 to LS_ALV_OUT.
append LS_ALV_OUT to GT_ALV_OUT.
endloop.
Komischer Satz.....Nadine_2706 hat geschrieben:ch möchte alle lifnr, die in der tabelle lt_lief vorkommen aus der tabelle lt_lfm1 ausselektieren. Die eintrage sind aber da!
Code: Alles auswählen.
SELECT LIFNR EKORG FROM LFM1 INTO TABLE LT_LFM1
WHERE EKORG = '0020'
AND LIFNR NE LT_LIEF-LIFNR. FALSCH!!!
Code: Alles auswählen.
select LIFNR EKORG into table LT_LFM1 from LFM1
for all entries in LT_LIEF
where LIFNR ne LT_LIEF-LIFNR
and EKORG = '0020'.
Code: Alles auswählen.
for all entries in LT_LIEF
where LIFNR ne LT_LIEF-LIFNR
Code: Alles auswählen.
where LIFNR in RT_LIEFNR