ABAP常用小技巧-SQL语句

1.1 尽量少的使用INTO CORRESPONDING FIELDS语句

尽量避免

DATA : TD_MARA TYPE TABLE OF MARA.

SELECT MATNR MTART
INTO CORRESPONDING FIELDS OF TABLE TD_MARA
FROM MARA
WHERE MATNR IN S_MATNR.

 

推荐用法

TYPES : BEGIN OF TYP_MARA,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
END OF TYP_MARA.
DATA : TD_MARA TYPE TABLE OF TYP_MARA.

SELECT MATNR MTART
INTO TABLE TD_MARA
FROM MARA
WHERE MATNR IN S_MATNR.

1.2 尽量减少使用SELECT * 、SELECT SINGLE *等,建议使用已知的列进行查询

尽量避免

SELECT *
INTO CORRESPONDING FIELDS OF TABLE TD_MARA
FROM MARA
WHERE MATNR IN S_MATNR.

 

推荐用法

SELECT MATNR MTART
INTO TABLE TD_MARA
FROM MARA
WHERE MATNR IN S_MATNR.

 

相关新闻

联系我们

联系我们

130-0752-1773

在线咨询:点击这里给我发消息

邮件:info@sapzx.com

工作时间:周一至周五9:00-18:00,节假日正常休息

关注微信
关注微信
分享本页
返回顶部