ABAP中如何创建ranges table type?
2个回答
展开全部
如果会debug,其实range table就是所谓的屏幕字段变量,当你定义select-option的时候,你去debug,你会看见range table的
TYPES : BEGIN OF TY_DATA,
SIGN(1) TYPE C,
OPTION(2) TYPE C,
LOW TYPE MATNR,
HIGH TYPE MATNR,
END OF TY_DATA.
DATA : WA_DATA TYPE TY_DATA,
S_DATA TYPE TABLE OF TY_DATA,
IT_MARA TYPE TABLE OF MARA.
"这里相当于屏幕low的位置放了一个值
WA_DATA-SIGN = 'I'.
WA_DATA-OPTION = 'EQ'.
WA_DATA-LOW = '1000'.
APPEND WA_DATA TO S_DATA.
"这里相当于屏幕low和high都放值
WA_DATA-SIGN = 'I'.
WA_DATA-OPTION = 'BT'.
WA_DATA-LOW = '1000'.
WA_DATA-HIGH = '1010'.
APPEND WA_DATA TO S_DATA.
SELECT *
FROM MARA
INTO TABLE IT_MARA
WHERE MATNR IN S_DATA.
追问
已经解决,谢谢!
展开全部
TABLES : vbak,vbuk,vbkd.
DATA: lt_vbak LIKE TABLE OF vbak,
lw_vbak LIKE LINE OF lt_vbak,
i_line TYPE i.
RANGES: i_customer_id FOR vbak-kunnr.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: p_kunnr FOR vbak-kunnr.
SELECTION-SCREEN END OF BLOCK b1.
start-of-selection.
LOOP AT p_kunnr.
CLEAR i_customer_id.
IF p_kunnr-high = space.
MOVE-CORRESPONDING p_kunnr TO i_customer_id.
MOVE 'EQ' TO i_customer_id-option.
ELSE.
MOVE-CORRESPONDING p_kunnr TO i_customer_id.
MOVE 'BT' TO i_customer_id-option.
ENDIF.
APPEND i_customer_id.
ENDLOOP.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询