版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
版权
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(区间外)
收藏
一键三连
扫一扫,分享海报
02-07
1万+
SAP 中SELECTION-OPTION 是个很强大的功能,在程序中也经常需要类似SELECTION-OPTION的功能,如果不画屏幕的话,SAP提供了RANGE来实现该功能,下面是一段简单例子代码。 RANGES:s_belnr FOR bseg-belnr. DATA: lw LIKE LINE OF s_belnr. "单值 CLEAR lw. lw-sign = 'I'. lw-o