用for all entries in 做查询的时候,能够进行自动的distinct,
请看如下的例子:
<!--StartFragment --> <style type="text/css"> SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #AAC2A7; } .L1S33 { color: #4DA619; } .L1S52 { color: #0000FF; } </style>
REPORTZ_LJC222.
types:beginofty_mm,
matnrtypemara-matnr,
endofty_mm.
types:beginofty_makt,
matnrtypemara-matnr,
sprastypemakt-spras,
maktxtypemakt-maktx,
endofty_makt.
datammtypetableofty_mmwithheaderline.
datamakttypetableofty_maktWITHHEADERLINE.
mm-matnr='000000000000034590'.
appendmm.
select
matnr
spras
maktx
frommakt
intoCORRESPONDINGFIELDSOFTABLEmakt
forALLENTRIESINmm
wherematnr=mm-matnr.
loopatmakt.
write:/
makt-matnr
,
makt-spras
,
makt-maktx
.
endloop.
输出:
34590 ZH 小狗
34590 EN little dog
如果代码改成:
<!--StartFragment --> <style type="text/css"> SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #AAC2A7; } .L1S31 { font-style: italic; color: #808080; } .L1S33 { color: #4DA619; } .L1S52 { color: #0000FF; } </style>
REPORTZ_LJC222.
types:beginofty_mm,
matnrtypemara-matnr,
endofty_mm.
types:beginofty_makt,
matnrtypemara-matnr,
sprastypemakt-spras,
maktxtypemakt-maktx,
endofty_makt.
datammtypetableofty_mmwithheaderline.
datamakttypetableofty_maktWITHHEADERLINE.
mm-matnr='000000000000034590'.
appendmm.
select
matnr
*spras
*maktx
frommakt
intoCORRESPONDINGFIELDSOFTABLEmakt
forALLENTRIESINmm
wherematnr=mm-matnr.
loopatmakt.
write:/
makt-matnr
*,
*makt-spras
*,
*makt-maktx
.
endloop.
输出为:
34590
第一段代码中输出两条数据,而第二段代码只输出了一条。因为第二段中查询的时候只查询了 matnr ,二两条数据的matnr是一样的,其中的一条被 distinct 掉了。所以就剩下一条了。