您的位置:首页 > 编程语言 > PHP开发

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会自己解析我们的代码,然后加在选择条件中。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  2010