BW DTP過濾器的例程

BW DTP過濾器的例程                                                          
有時BW抽取的數據時會對數據限制做一些特殊處理,好比上月的數據,能夠考慮在DTP進行過濾
form compute_/BIC/ZBEGDA  「fieldname = '/BIC/ZBEGDA'.
   tables l_t_range structure  rssdlrange
  
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 = 
'/BIC/ZBEGDA' .
          l_idx = sy-tabix.
*....
          
if l_idx <> 0 .
            
modify l_t_range index  l_idx.
          
else .
            l_t_range-fieldname = 
'/BIC/ZBEGDA' .
            l_t_range-
sign = 'E' .
            l_t_range-option = 
'EQ' .
            l_t_range-low = 
'2011.01.03' .
            
append  l_t_range.
          
endif .
          p_subrc = 
0 .
*$*$ end of routine - insert your code only before this line         *-*
endform.
解釋:在這裏,設置一下sign(E)xcluding,這樣排除單一值,而後appendl_t_range中,OK! 如下是咱們要寫的程序代碼:
l_t_range-fieldname =  '/BIC/ZBEGDA' .
l_t_range- sign  =  'E' .
l_t_range-option =  'EQ'.
l_t_range-low =  '2011.01.03'.
************************************
2.數據源進行例程控制
 
data: l_idx like sy-tabix.
DATABEGIN OF WA_O07,
        EMPLOYEE TYPE /BI0/OIEMPLOYEE,
      END OF WA_O07,
      IT_O07 LIKE TABLE OF WA_O07,
      V_DATE TYPE SY-DATUM.
      V_DATE = SY-DATUM - 1 .
          read table l_t_range with key
               fieldname = 'PERNR'.
          l_idx = sy-tabix.
*....
            select EMPLOYEE INTO TABLE IT_O07 from /BIC/AZHR_O0700 WHERE
            CALDAY = V_DATE.
            if l_t_range[] is not INITIAL.
              clear:l_t_range[].
              LOOP AT IT_O07 INTO WA_O07.
                l_t_range-fieldname = 'PERNR'.
                l_t_range-SIGN = 'I'.
                l_t_range-OPTION = 'EQ'.
                l_t_range-LOW = WA_O07-EMPLOYEE.
                append l_t_range.
                CLEAR:WA_O07,l_t_range.
              ENDLOOP.
            else.
              if l_idx <> 0.
                modify l_t_range index l_idx.
              endif.
            endif.

          p_subrc = 0.
相關文章
相關標籤/搜索