BW:DTP过滤器的例程
2010-11-25 12:42
176 查看
*&---------------------------------------------------------------------*
*& Include RSBC_SEL_ROUTINE_TPL
*&---------------------------------------------------------------------*
program conversion_routine.
* Type pools used by conversion program
type-pools: rsarc, rsarr, rssm.
tables: rssdlrange.
* Global code used by conversion rules
*$*$ begin of global - insert your declaration only below this line *-*
* TABLES: ...
* DATA: ...
*$*$ end of global - insert your declaration only before this line *-*
* -------------------------------------------------------------------
* Fieldname = COORDER
* data type = CHAR
* length = 000012
* -------------------------------------------------------------------
form compute_COORDER
tables l_t_range structure rssdlrange
using i_r_request type ref to IF_RSBK_REQUEST_ADMINTAB_VIEW
i_fieldnm type RSFIELDNM
changing p_subrc like sy-subrc.
* Insert source code to current selection field
*$*$ begin of routine - insert your code only below this line *-*
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'COORDER'.
l_idx = sy-tabix.
*....过滤掉三个订单号:z03312010002,f03922010002,Z99922009002
if l_idx <> 0.
modify l_t_range index l_idx.
else.
l_t_range-fieldname = 'COORDER'.
l_t_range-sign = 'E'.
l_t_range-option = 'EQ'.
l_t_range-low = 'z03312010002'.
append l_t_range.
l_t_range-fieldname = 'COORDER'.
l_t_range-sign = 'E'.
l_t_range-option = 'EQ'.
l_t_range-low = 'f03922010002'.
append l_t_range.
l_t_range-fieldname = 'COORDER'.
l_t_range-sign = 'E'.
l_t_range-option = 'EQ'.
l_t_range-low = 'Z99922009002'.
append l_t_range.
endif.
p_subrc = 0.
*$*$ end of routine - insert your code only before this line *-*
endform.
首先,DTP的过滤器,我们如果想拍出1条以上的数据,只有一个办法:写Routine。
为啥呢,因为这样:
排除单一值的tab页没有了。
排除两个值可导致不正确的选择
消息号 DB095
Diagnosis
In your selection, you chose more than one value with the option 'UNEQUAL'. This can, under certain circumstances, lead to all entries being read from the database.
Procedure
Use 'EXCLUDE FROM SELECTION' and the '=' option to exclude individual values from the result.
Example:
Selecting all suppliers except CHARLIE and BILLY:
Option 1: I NE CHARLIE
I NE BILLY
Option 2: E EQ CHARIE
E EQ BILLY
Only option 2 produces the corresct result, since in option 1, the combination of 'all except CHARLIE' and 'all except BILLY' results in ALL entries being selected.
这是个并集,从集合里排除A,并上集合里排除B,结果等于整个集合。
所以呢,我们写例程,这个例程比较类似于出口变量。
l_t_range-fieldname = 'COORDER'.
l_t_range-sign = 'E'.
l_t_range-option = 'EQ'.
l_t_range-low = 'z03312010002'.
在这里,设置一下sign为(E)xcluding,这样排除单一值,然后append到l_t_range中,OK!
效果出来了,DTP会自己解析我们的代码,然后加在选择条件中。
*& Include RSBC_SEL_ROUTINE_TPL
*&---------------------------------------------------------------------*
program conversion_routine.
* Type pools used by conversion program
type-pools: rsarc, rsarr, rssm.
tables: rssdlrange.
* Global code used by conversion rules
*$*$ begin of global - insert your declaration only below this line *-*
* TABLES: ...
* DATA: ...
*$*$ end of global - insert your declaration only before this line *-*
* -------------------------------------------------------------------
* Fieldname = COORDER
* data type = CHAR
* length = 000012
* -------------------------------------------------------------------
form compute_COORDER
tables l_t_range structure rssdlrange
using i_r_request type ref to IF_RSBK_REQUEST_ADMINTAB_VIEW
i_fieldnm type RSFIELDNM
changing p_subrc like sy-subrc.
* Insert source code to current selection field
*$*$ begin of routine - insert your code only below this line *-*
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'COORDER'.
l_idx = sy-tabix.
*....过滤掉三个订单号:z03312010002,f03922010002,Z99922009002
if l_idx <> 0.
modify l_t_range index l_idx.
else.
l_t_range-fieldname = 'COORDER'.
l_t_range-sign = 'E'.
l_t_range-option = 'EQ'.
l_t_range-low = 'z03312010002'.
append l_t_range.
l_t_range-fieldname = 'COORDER'.
l_t_range-sign = 'E'.
l_t_range-option = 'EQ'.
l_t_range-low = 'f03922010002'.
append l_t_range.
l_t_range-fieldname = 'COORDER'.
l_t_range-sign = 'E'.
l_t_range-option = 'EQ'.
l_t_range-low = 'Z99922009002'.
append l_t_range.
endif.
p_subrc = 0.
*$*$ end of routine - insert your code only before this line *-*
endform.
首先,DTP的过滤器,我们如果想拍出1条以上的数据,只有一个办法:写Routine。
为啥呢,因为这样:
排除单一值的tab页没有了。
排除两个值可导致不正确的选择
消息号 DB095
Diagnosis
In your selection, you chose more than one value with the option 'UNEQUAL'. This can, under certain circumstances, lead to all entries being read from the database.
Procedure
Use 'EXCLUDE FROM SELECTION' and the '=' option to exclude individual values from the result.
Example:
Selecting all suppliers except CHARLIE and BILLY:
Option 1: I NE CHARLIE
I NE BILLY
Option 2: E EQ CHARIE
E EQ BILLY
Only option 2 produces the corresct result, since in option 1, the combination of 'all except CHARLIE' and 'all except BILLY' results in ALL entries being selected.
这是个并集,从集合里排除A,并上集合里排除B,结果等于整个集合。
所以呢,我们写例程,这个例程比较类似于出口变量。
l_t_range-fieldname = 'COORDER'.
l_t_range-sign = 'E'.
l_t_range-option = 'EQ'.
l_t_range-low = 'z03312010002'.
在这里,设置一下sign为(E)xcluding,这样排除单一值,然后append到l_t_range中,OK!
效果出来了,DTP会自己解析我们的代码,然后加在选择条件中。
相关文章推荐
- BW DTP过滤器的例程
- BW DTP过滤器中的程序使用
- sap bw dtp 过滤例程 实现了有key值的增量处理
- SAP_BW建模第五步之创建数据传输进程(DTP)
- BW:Start Routine:写个开始例程还能碰上Select的BUG,这次真是没白做
- BW:专家例程
- BW十日谈之IP&TR&DTP(转载)
- DTP中过滤写例程 取今天
- BW:SAP 批量填写过滤器
- ABAP 例程程序在SAP BW TRANFORMATION中的应用,去除非法字符
- BW:传输到Open Hub的DTP,怎么删除?
- BW--一些关于DTP的一些链接
- Writing a FilterUnloadCallback Routine for a Minifilter Driver 为一个微过滤驱动写一个过滤器卸载回调例程
- DTP中写例程 取前7日和前1日
- BW--一些关于DTP的一些链接
- BW转换例程中去掉非法字符
- BW:传输到Open Hub的DTP,怎么删除?
- BW--一些关于DTP的一些链接
- BW--一些关于DTP的一些链接
- BW--一些关于DTP的一些链接