分类:
2010-03-01 16:58:28
ABAP动态查询的实现:可以完全实现动态查询,每个字段都可以动态。
(1) 利用宏
(2) 利用abap指针
(3) 利用FIELD-SYMBOL
具体实现:
1.结构的动态查询
DEFINE SELECT_DATA_TO_WA.
SELECT &1
FROM &2
INTO CORRESPONDING FIELDS OF &3
WHERE (&4).
EXIT.
ENDSELECT.
END-OF-DEFINITION.
2.变量的动态查询
DEFINE SELECT_DATA_TO_VARIANT.
SELECT &1
FROM &2
INTO &3
WHERE (&4).
EXIT.
ENDSELECT.
END-OF-DEFINITION.
3.内表的动态查询
DEFINE SELECT_DATA_TO_VARIANT.
SELECT &1
FROM &2
INTO CORRESPONDING FIELDS OF TABLE &3
WHERE (&4).
EXIT.
ENDSELECT.
END-OF-DEFINITION.