兔宝学习ABAP整理笔记

每天记录一点点,充实博客,回放记忆,分享他人。有坚持就有光明

Select语句中Where语句动态实现的小例子

REPORT  Z_WUWEI_0016.

TABLES: TSTC.
DATA:WHERE_TAB(80) OCCURS 10 WITH HEADER LINE,
     COUNT_REC TYPE I.

SELECT-OPTIONS: S_TRX FOR TSTC-TCODE NO INTERVALS OBLIGATORY DEFAULT 'VA01'.


MOVE 'TCODE IN S_TRX' TO WHERE_TAB.
APPEND WHERE_TAB.

CONCATENATE 'AND TCODE LIKE' '''V%''' INTO WHERE_TAB SEPARATED BY SPACE.  // V% 外面加3个单引号
APPEND WHERE_TAB.

CLEAR WHERE_TAB.

SELECT COUNT( * ) INTO COUNT_REC FROM TSTC
WHERE (WHERE_TAB).

WRITE: COUNT_REC.



阅读更多
个人分类: ABAP
博主设置当前文章不允许评论。

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭