sap中inner join怎么用
展开全部
和数据库的差不多
TABLES: mara.
TYPES: BEGIN OF ty_material,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
maktx TYPE makt-maktx,
END OF ty_material.
DATA: lt_material TYPE STANDARD TABLE OF ty_material,
lw_material TYPE ty_material.
SELECTION-SCREEN BEGIN OF BLOCK blk1.
SELECT-OPTIONS: so_matnr FOR mara-matnr.
SELECTION-SCREEN END OF BLOCK blk1.
START-OF-SELECTION.
SELECT mara~matnr
mara~mtart
makt~maktx
INTO TABLE lt_material
FROM mara INNER JOIN makt
ON mara~matnr = makt~matnr
WHERE mara~matnr in so_matnr
and spras = 'EN'.
LOOP AT lt_material INTO lw_material.
WRITE: / lw_material-matnr, lw_material-mtart, lw_material-maktx.
ENDLOOP.
TABLES: mara.
TYPES: BEGIN OF ty_material,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
maktx TYPE makt-maktx,
END OF ty_material.
DATA: lt_material TYPE STANDARD TABLE OF ty_material,
lw_material TYPE ty_material.
SELECTION-SCREEN BEGIN OF BLOCK blk1.
SELECT-OPTIONS: so_matnr FOR mara-matnr.
SELECTION-SCREEN END OF BLOCK blk1.
START-OF-SELECTION.
SELECT mara~matnr
mara~mtart
makt~maktx
INTO TABLE lt_material
FROM mara INNER JOIN makt
ON mara~matnr = makt~matnr
WHERE mara~matnr in so_matnr
and spras = 'EN'.
LOOP AT lt_material INTO lw_material.
WRITE: / lw_material-matnr, lw_material-mtart, lw_material-maktx.
ENDLOOP.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询