cancel
Showing results for 
Search instead for 
Did you mean: 

DTP - Filter Routine Result not appearing in Monitor under Selections

Former Member
0 Kudos

Hi Folks,

I got a routine on a cal week field in a DTP with bellow code.

However, the CALWEEK filter is not appearing in the DTP monitor under selections along with the "fix" filters of the DTP. Also the test case showed that the filter is not used.

What I am doing wrong? Can I debug the DTP routine somehow? Must the filter be listed in the selection section of the DTP monitor header?

I have the same code on an infopackage filter -> only difference is that it does a modify l_t_range right away. There it is working as expected.

Thanks for all replies in advance.

Best regards,

Axel

-



* -------------------------------------------------------------------
*     Fieldname       = CALWEEK
*     data type       = NUMC
*     length          = 000006
* -------------------------------------------------------------------
form compute_CALWEEK
  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,
      i_offset type int2,
      l_from_calweek type /BI0/OICALWEEK,
      l_to_calweek type /BI0/OICALWEEK.

read table l_t_range with key
               fieldname = 'CALWEEK'.
          l_idx = sy-tabix.

tables: ztvarv.
* Read the horizon from the parameter table
SELECT SINGLE *
            FROM ztvarv
          WHERE name = 'OFFSET'.

i_offset = ztvarv.
CALL FUNCTION 'Z_ADD_SUBTRACT_TO_CALWEEK'
  EXPORTING
    I_DATE_FOR            = sy-datum
    REPUBLISH             = 00
    ZOFFSET               = i_offset
 IMPORTING
   I_FROM_WEEK           = l_from_calweek
   I_TO_WEEK             = l_to_calweek
 EXCEPTIONS
   DATE_INVALID          = 1
   WEEK_INVALID          = 2
   VERSION_INVALID       = 3
   OTHERS                = 4
          .
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

l_t_range-sign   = 'I'.
l_t_range-option = 'BT'.
* Need to be this way as the to week is the calculated one
l_t_range-low    = l_to_calweek.
l_t_range-high   = l_from_calweek.


          if l_idx <> 0.
            modify l_t_range index l_idx.
          else.
            append l_t_range.
          endif.
          p_subrc = 0.

-


Accepted Solutions (1)

Accepted Solutions (1)

former_member199691
Active Contributor
0 Kudos

try adding following two lines into your code

l_t_range-iobjne = '0CALWEEK'. //check the info object name for Calendar Year/Week

l_t_range-fieldname = 'CALWEEK'.

*add it before your following piece of code

l_t_range-sign = 'I'.

l_t_range-option = 'BT'.

  • Need to be this way as the to week is the calculated one

l_t_range-low = l_to_calweek.

l_t_range-high = l_from_calweek.

another thing to check is

if l_dx <> 0 (not equal sign is missing in the code you have pasted)

Regards,

Gaurav

Former Member
0 Kudos

Hi Gaurav,

setting the fieldname solved it.

Debugging showed that the range was empty therfore the field name was not set.

After changing all looks good now.

THANKS

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

i reckon your if statement should be if l_idx = 1 then modify.

Thanks

Krishnan.

Former Member
0 Kudos

Hi,

On the Execute tab of DTP you have a dropdown from which you can select the option of execution of DTP for Debugging. Once you select this option on the lower screen you can set required breakpoint.

Regards,

Durgesh.