Skip to Content
author's profile photo Former Member
Former Member

How to reset/refresh previously set DTP Filter

Hi Gurus,

My requirement is to set *DTP filter values via * Code*. I am able to set the filter value , but I am not able to refreshed or reset the previously set filter values.

In the bleow mentioned code,

I am setting the value of DTP filter field 'Business Area' to 100 and filtered records are getting transfered to data target. Now, if I set the value of 'Business Area' to 200, it still shows the results of 'Business Area' = 100 . i.e. old DTP filter values are not deleted/refreshed.

Can you please suggest, how to refresh/delete the old values...


data: LCL_DTP TYPE REF TO CL_RSBK_DTP,
      LCL_REQUEST  TYPE REF TO CL_RSBK_REQUEST,
      W_LOC_DTP TYPE RSBKDTPNM ,
      LCL_FILTER TYPE REF TO CL_RSBC_FILTER,
      ws_SELTAB TYPE RSBK_S_SELECT,
      g_t_seltab type table of rsbk_s_select,
      g_t_dtprule type mch_t_sourcecode, 
      g_s_varseltab type mch_var_select,
      g_t_varseltab type mch_t_var_select, 
      g_s_seltab type rsbk_s_select,
     g_s_selfields type mch_s_field,
     g_t_selfields type mch_t_field,
     g_r_filter type ref to cl_rsbc_filter.


*Get DTP Reference 

 W_LOC_DTP = 'DTP_F0FQ2CCPA25RFLIMGD2APDK16'.         " DTP id
     LCL_DTP = CL_RSBK_DTP=>FACTORY( W_LOC_DTP ).

   * Get Filter  Reference.

      CALL METHOD  LCL_DTP->IF_RSBK_DTP_DISPLAY~GET_OBJ_REF_FILTER
      RECEIVING
      R_R_FILTER = LCL_FILTER.

  CLEAR:
g_t_seltab, ws_seltab.

* set value of DTP filter field business area to 100

             ws_SELTAB-FIELD  = 'BUS_AREA'  .
             ws_SELTAB-sign   =  'I' .
             ws_SELTAB-option =  'EQ' .
             ws_SELTAB-low   =  '100' .

              APPEND WS_SELTAB TO g_t_seltab.
              clear ws_seltab.

 CALL METHOD LCL_FILTER->SET_SELTAB
      EXPORTING
      I_T_SELTAB = g_t_seltab.

LCL_DTP->activate( ).


Regards

Mohit

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 26, 2009 at 11:20 AM

    Hi,

    try to use the Refresh G_T_SELTAB before using the append.

    LaxmiN

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi, you should deactivate your DTP at first and then change the selections and activate DTP. For example:

      <pre class="jive-pre"><code class="jive-code jive-java">

      data: lcl_dtp type ref to cl_rsbk_dtp,

      lcl_filter type ref to cl_rsbc_filter,

      rx type ref to cx_root,

      l_dtp_name type rsbkdtpnm,

      ls_rsbkdtp type rsbkdtp,

      et_message type uc0_t_message,

      ls_msg type uc0_s_message.

      data: ls_seltab type rsbk_s_select.

      data: lt_varseltab type mch_t_var_select,

      lt_seltab type table of rsbk_s_select,

      lt_selfields type mch_t_field,

      lt_dtprule type mch_t_sourcecode.

      *----


      |

      • determine the technical name of the DTP |

      *----


      |

      select * from RSBKDTP into ls_rsbkdtp where objvers = 'A'

      and tgt = <font color="red">'Z_TEST'.</font>

      if ls_rsbkdtp-src(9) = <font color="red">'Z_BW_TEST'</font>.

      l_dtp_name = ls_rsbkdtp-dtp.

      exit.

      endif.

      endselect.

      try.

      lcl_dtp = cl_rsbk_dtp=>factory( l_dtp_name ).

      <font color="red">lcl_dtp->if_rso_tlogo_maintain~deactivate( ).</font>

      lcl_filter = lcl_dtp->if_rsbk_dtp_display~get_obj_ref_filter( ).

      catch cx_root into rx.

      clear ls_msg.

      ls_msg-msgid = <font color="red">'Z_TEST'.</font>

      ls_msg-msgty = <font color="red">'E'.</font>

      ls_msg-msgno = <font color="red">'001'.</font>

      ls_msg-msgv1 = rx->get_longtext( ).

      ls_msg-msgv2 = l_dtp_name.

      insert ls_msg into table et_message.

      exit.

      endtry.

      *----


      |

      • get the table with selections |

      *----


      |

      try.

      call method lcl_filter->get_all

      importing

      e_t_varseltab = lt_varseltab

      e_t_seltab = lt_seltab

      e_t_dtprule = lt_dtprule

      e_t_selfields = lt_selfields.

      clear: lt_varseltab, lt_dtprule, lt_selfields.

      catch cx_root into rx.

      clear ls_msg.

      ls_msg-msgid = <font color="red">'Z_TEST'.</font>

      ls_msg-msgty = <font color="red">'E'.</font>

      ls_msg-msgno = <font color="red">'001'.</font>

      ls_msg-msgv1 = rx->get_longtext( ).

      insert ls_msg into table et_message.

      exit.

      endtry.

      *----


      |

      • delete the selections to be changed: year and company |

      *----


      |

      loop at lt_seltab into ls_seltab where field = <font color="red">'RYEAR'</font>

      or field = <font color="red">'RZZCOMP'.</font>

      delete table lt_seltab from ls_seltab.

      endloop.

      *----


      |

      • insert year into table with selections |

      *----


      |

      clear: ls_seltab.

      ls_seltab-sign = 'I'.

      ls_seltab-option = 'EQ'.

      ls_seltab-field = <font color="red">'RYEAR'.</font>

      ls_seltab-low = <font color="red">'2009'.</font>

      append ls_seltab to lt_seltab.

      *----


      |

      • insert company into table with selections |

      *----


      |

      ls_seltab-field = <font color="red">'RZZCOMP'.</font>

      ls_seltab-low = <font color="red">'GHR'.</font>

      append ls_seltab to lt_seltab.

      *----


      |

      • save and activate DTP |

      *----


      |

      try.

      lcl_filter->set_seltab( lt_seltab ).

      lcl_dtp->save( ).

      <font color="red">call method lcl_dtp->activate

      exporting

      i_objvers = 'A'

      i_force_activation = 'X'.</font>

      catch cx_root into rx.

      clear ls_msg.

      ls_msg-msgid = <font color="red">'Z_TEST'.</font>

      ls_msg-msgty = <font color="red">'E'.</font>

      ls_msg-msgno = <font color="red">'001'.</font>

      ls_msg-msgv1 = rx->get_longtext( ).

      insert ls_msg into table et_message.

      exit.

      endtry.

  • author's profile photo Former Member
    Former Member
    Posted on Aug 04, 2020 at 06:00 AM

    Hi, you should deactivate your DTP at first and then change the selections and activate DTP. For example:

    <pre class="jive-pre"><code class="jive-code jive-java">

    data: lcl_dtp type ref to cl_rsbk_dtp,

    lcl_filter type ref to cl_rsbc_filter,

    rx type ref to cx_root,

    l_dtp_name type rsbkdtpnm,

    ls_rsbkdtp type rsbkdtp,

    et_message type uc0_t_message,

    ls_msg type uc0_s_message.

    data: ls_seltab type rsbk_s_select.

    data: lt_varseltab type mch_t_var_select,

    lt_seltab type table of rsbk_s_select,

    lt_selfields type mch_t_field,

    lt_dtprule type mch_t_sourcecode.

    *----


    |

    • determine the technical name of the DTP |

    *----


    |

    select * from RSBKDTP into ls_rsbkdtp where objvers = 'A'

    and tgt = <font color="red">'Z_TEST'.</font>

    if ls_rsbkdtp-src(9) = <font color="red">'Z_BW_TEST'</font>.

    l_dtp_name = ls_rsbkdtp-dtp.

    exit.

    endif.

    endselect.

    try.

    lcl_dtp = cl_rsbk_dtp=>factory( l_dtp_name ).

    <font color="red">lcl_dtp->if_rso_tlogo_maintain~deactivate( ).</font>

    lcl_filter = lcl_dtp->if_rsbk_dtp_display~get_obj_ref_filter( ).

    catch cx_root into rx.

    clear ls_msg.

    ls_msg-msgid = <font color="red">'Z_TEST'.</font>

    ls_msg-msgty = <font color="red">'E'.</font>

    ls_msg-msgno = <font color="red">'001'.</font>

    ls_msg-msgv1 = rx->get_longtext( ).

    ls_msg-msgv2 = l_dtp_name.

    insert ls_msg into table et_message.

    exit.

    endtry.

    *----


    |

    • get the table with selections |

    *----


    |

    try.

    call method lcl_filter->get_all

    importing

    e_t_varseltab = lt_varseltab

    e_t_seltab = lt_seltab

    e_t_dtprule = lt_dtprule

    e_t_selfields = lt_selfields.

    clear: lt_varseltab, lt_dtprule, lt_selfields.

    catch cx_root into rx.

    clear ls_msg.

    ls_msg-msgid = <font color="red">'Z_TEST'.</font>

    ls_msg-msgty = <font color="red">'E'.</font>

    ls_msg-msgno = <font color="red">'001'.</font>

    ls_msg-msgv1 = rx->get_longtext( ).

    insert ls_msg into table et_message.

    exit.

    endtry.

    *----


    |

    • delete the selections to be changed: year and company |

    *----


    |

    loop at lt_seltab into ls_seltab where field = <font color="red">'RYEAR'</font>

    or field = <font color="red">'RZZCOMP'.</font>

    delete table lt_seltab from ls_seltab.

    endloop.

    *----


    |

    • insert year into table with selections |

    *----


    |

    clear: ls_seltab.

    ls_seltab-sign = 'I'.

    ls_seltab-option = 'EQ'.

    ls_seltab-field = <font color="red">'RYEAR'.</font>

    ls_seltab-low = <font color="red">'2009'.</font>

    append ls_seltab to lt_seltab.

    *----


    |

    • insert company into table with selections |

    *----


    |

    ls_seltab-field = <font color="red">'RZZCOMP'.</font>

    ls_seltab-low = <font color="red">'GHR'.</font>

    append ls_seltab to lt_seltab.

    *----


    |

    • save and activate DTP |

    *----


    |

    try.

    lcl_filter->set_seltab( lt_seltab ).

    lcl_dtp->save( ).

    <font color="red">call method lcl_dtp->activate

    exporting

    i_objvers = 'A'

    i_force_activation = 'X'.</font>

    catch cx_root into rx.

    clear ls_msg.

    ls_msg-msgid = <font color="red">'Z_TEST'.</font>

    ls_msg-msgty = <font color="red">'E'.</font>

    ls_msg-msgno = <font color="red">'001'.</font>

    ls_msg-msgv1 = rx->get_longtext( ).

    insert ls_msg into table et_message.

    exit.

    endtry.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 04, 2020 at 06:00 AM

    Hi, you should deactivate your DTP at first and then change the selections and activate DTP. For example:

    <pre class="jive-pre"><code class="jive-code jive-java">

    data: lcl_dtp type ref to cl_rsbk_dtp,

    lcl_filter type ref to cl_rsbc_filter,

    rx type ref to cx_root,

    l_dtp_name type rsbkdtpnm,

    ls_rsbkdtp type rsbkdtp,

    et_message type uc0_t_message,

    ls_msg type uc0_s_message.

    data: ls_seltab type rsbk_s_select.

    data: lt_varseltab type mch_t_var_select,

    lt_seltab type table of rsbk_s_select,

    lt_selfields type mch_t_field,

    lt_dtprule type mch_t_sourcecode.

    *----


    |

    • determine the technical name of the DTP |

    *----


    |

    select * from RSBKDTP into ls_rsbkdtp where objvers = 'A'

    and tgt = <font color="red">'Z_TEST'.</font>

    if ls_rsbkdtp-src(9) = <font color="red">'Z_BW_TEST'</font>.

    l_dtp_name = ls_rsbkdtp-dtp.

    exit.

    endif.

    endselect.

    try.

    lcl_dtp = cl_rsbk_dtp=>factory( l_dtp_name ).

    <font color="red">lcl_dtp->if_rso_tlogo_maintain~deactivate( ).</font>

    lcl_filter = lcl_dtp->if_rsbk_dtp_display~get_obj_ref_filter( ).

    catch cx_root into rx.

    clear ls_msg.

    ls_msg-msgid = <font color="red">'Z_TEST'.</font>

    ls_msg-msgty = <font color="red">'E'.</font>

    ls_msg-msgno = <font color="red">'001'.</font>

    ls_msg-msgv1 = rx->get_longtext( ).

    ls_msg-msgv2 = l_dtp_name.

    insert ls_msg into table et_message.

    exit.

    endtry.

    *----


    |

    • get the table with selections |

    *----


    |

    try.

    call method lcl_filter->get_all

    importing

    e_t_varseltab = lt_varseltab

    e_t_seltab = lt_seltab

    e_t_dtprule = lt_dtprule

    e_t_selfields = lt_selfields.

    clear: lt_varseltab, lt_dtprule, lt_selfields.

    catch cx_root into rx.

    clear ls_msg.

    ls_msg-msgid = <font color="red">'Z_TEST'.</font>

    ls_msg-msgty = <font color="red">'E'.</font>

    ls_msg-msgno = <font color="red">'001'.</font>

    ls_msg-msgv1 = rx->get_longtext( ).

    insert ls_msg into table et_message.

    exit.

    endtry.

    *----


    |

    • delete the selections to be changed: year and company |

    *----


    |

    loop at lt_seltab into ls_seltab where field = <font color="red">'RYEAR'</font>

    or field = <font color="red">'RZZCOMP'.</font>

    delete table lt_seltab from ls_seltab.

    endloop.

    *----


    |

    • insert year into table with selections |

    *----


    |

    clear: ls_seltab.

    ls_seltab-sign = 'I'.

    ls_seltab-option = 'EQ'.

    ls_seltab-field = <font color="red">'RYEAR'.</font>

    ls_seltab-low = <font color="red">'2009'.</font>

    append ls_seltab to lt_seltab.

    *----


    |

    • insert company into table with selections |

    *----


    |

    ls_seltab-field = <font color="red">'RZZCOMP'.</font>

    ls_seltab-low = <font color="red">'GHR'.</font>

    append ls_seltab to lt_seltab.

    *----


    |

    • save and activate DTP |

    *----


    |

    try.

    lcl_filter->set_seltab( lt_seltab ).

    lcl_dtp->save( ).

    <font color="red">call method lcl_dtp->activate

    exporting

    i_objvers = 'A'

    i_force_activation = 'X'.</font>

    catch cx_root into rx.

    clear ls_msg.

    ls_msg-msgid = <font color="red">'Z_TEST'.</font>

    ls_msg-msgty = <font color="red">'E'.</font>

    ls_msg-msgno = <font color="red">'001'.</font>

    ls_msg-msgv1 = rx->get_longtext( ).

    insert ls_msg into table et_message.

    exit.

    endtry.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.