DATA: BEGIN OF it_mara OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF it_mara.
第一种写法:
SELECT matnr
INTO it_mara
FROM mara.
APPEND it_mara.
ENDSELECT.
第二种写法(high performace):
SELECT matnr
INTO TABLE it_mara
FROM mara.
==========================================
DATA: BEGIN OF it_mara OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF it_mara.
DATA: BEGIN OF it_makt OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF it_makt.
第一种写法:
LOOP AT it_mara.
SELECT SINGLE maktx
INTO it_mara-maktx
FROM makt
WHERE matnr = it_mara-matnr AND
spras = sy-langu.
MODIFY it_mara TRANSPORTING maktx.
ENDLOOP.
第二种写法(high performace)
SELECT matnr maktx
INTO TABLE it_makt
FROM makt
FOR ALL ENTRIES IN it_mara
WHERE matnr = it_mara-matnr and
spras = sy-langu.
=================================================================================
1 数据——>工作区,工作区——>内表,
2 数据——>内表
很明显少了一个过程 效率自然高了 如果数据量越大,效果是可想而知的
=========================================
1 每遍历内表一下 都要select一下 select 本身就是循环 循环套循环 时间消耗度是n*n
2select出已经存在内表中的所有满足条件的值 不敢说时间消耗度是n*n 但至少时间上大大地打了一下折
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF it_mara.
第一种写法:
SELECT matnr
INTO it_mara
FROM mara.
APPEND it_mara.
ENDSELECT.
第二种写法(high performace):
SELECT matnr
INTO TABLE it_mara
FROM mara.
==========================================
DATA: BEGIN OF it_mara OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF it_mara.
DATA: BEGIN OF it_makt OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF it_makt.
第一种写法:
LOOP AT it_mara.
SELECT SINGLE maktx
INTO it_mara-maktx
FROM makt
WHERE matnr = it_mara-matnr AND
spras = sy-langu.
MODIFY it_mara TRANSPORTING maktx.
ENDLOOP.
第二种写法(high performace)
SELECT matnr maktx
INTO TABLE it_makt
FROM makt
FOR ALL ENTRIES IN it_mara
WHERE matnr = it_mara-matnr and
spras = sy-langu.
=================================================================================
1 数据——>工作区,工作区——>内表,
2 数据——>内表
很明显少了一个过程 效率自然高了 如果数据量越大,效果是可想而知的
=========================================
1 每遍历内表一下 都要select一下 select 本身就是循环 循环套循环 时间消耗度是n*n
2select出已经存在内表中的所有满足条件的值 不敢说时间消耗度是n*n 但至少时间上大大地打了一下折