关于abap中的range的用法(类似于范围复选输入框)

  DATA:lt_USER LIKE TABLE OF ZMM_YLRY .
  DATA:lt_matnr LIKE TABLE OF zmara_zsgl WITH HEADER LINE.
  DATA:l_matnr TYPE RANGE OF zmara_zsgl-matnr WITH HEADER LINE.

  SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_USER FROM ZMM_YLRY WHERE ZRYBH = SY-UNAME.
  IF SY-SUBRC = 0.
    SELECT  MATNR INTO CORRESPONDING FIELDS OF TABLE lt_matnr FROM ZMARA_ZSGL WHERE ZYLSYB = 'X'.
    IF lt_matnr IS NOT INITIAL .
        LOOP AT lt_matnr.
          l_matnr-sign = 'I'.
          l_matnr-option = 'EQ'.
          l_matnr-low = lt_matnr-matnr.
          append l_matnr.
        ENDLOOP.

        IF l_matnr[] is NOT INITIAL.
          delete gt_data WHERE matnr NOT IN l_matnr.
        ELSE.
          delete gt_data.
        ENDIF.
	ENDIF.
ENDIF.

以下为第二个案例:
DATA ra_bwart TYPE RANGE OF mseg-bwart."移动类型
DATA ls_bwart LIKE LINE OF ra_bwart.
 
DATA ra_date TYPE RANGE OF sy-datum."日期期间
DATA ls_date LIKE LINE OF ra_date.
 
  ls_bwart-low = '201'.
  ls_bwart-sign = 'I'.
  ls_bwart-option = 'EQ'.
  APPEND ls_bwart TO ra_bwart.
 
  ls_bwart-low = '202'.
  ls_bwart-sign = 'I'.
  ls_bwart-option = 'EQ'.
  APPEND ls_bwart TO ra_bwart.
 
CONCATENATE p_lfgja p_lfmon '01' INTO ls_date-low."该月第一天
  CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
    EXPORTING
      i_date = ls_date-low
    IMPORTING
      e_date = ls_date-high."该月最后一天
  ls_date-sign = 'I'.
  ls_date-option = 'BT'.
  APPEND ls_date TO ra_date."ra_date为当月期间
 
SELECT SUM( a~erfmg ) AS erfmg SUM( a~dmbtr ) AS dmbtr
      INTO CORRESPONDING FIELDS OF wa_data
      FROM mseg AS a
      INNER JOIN mkpf AS b
              ON a~mblnr = b~mblnr
             AND a~mjahr = b~mjahr
      WHERE a~matnr = wa_data-matnr
        AND a~werks = wa_data-werks
        AND a~bwart IN ra_bwart
        AND a~sobkz IN ra_sobkz
        AND b~budat IN ra_date.

其中option:EQ(等于)、NE(不等于)、GT(大于)、LT(小于)、GE(大于等于)、LE(小于等于)、NOT(非)

BT(区间内)、NB(区间外)

你可能感兴趣的:(关于abap中的range的用法(类似于范围复选输入框))