Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Filter Option in Table Control

Former Member
0 Kudos
1,419

Hi Folks ,

I am working on a table control , i need to add Filter functionality same as of ALV filter

i tried with suggestion given on SCN

Following is the code that i tried, but its not working, no popup with FM LVC_FILTER_DIALOG

please help me with sum more suggestion or sample code


DATA : cp_vbak LIKE it_vbak OCCURS 0.
  DATA : it_fieldcat1 TYPE lvc_t_fcat,
         wa_fieldcat LIKE line of it_fieldcat1,
         it_group1 like  lvc_s_sgrp occurs 0,
         ls_group LIKE lvc_s_sgrp,
         filter_ranges TYPE lvc_t_filt.

DATA: counter TYPE i.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'VBELN'.
  wa_fieldcat-tabname    = 'IT_VBAK'.
   APPEND wa_fieldcat TO it_fieldcat1.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'VKORG'.
  wa_fieldcat-tabname    = 'IT_VBAK'.
  APPEND wa_fieldcat TO it_fieldcat1.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'VTWEG'.
  wa_fieldcat-tabname    = 'IT_VBAK'.
  APPEND wa_fieldcat TO it_fieldcat1.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'SPART'.
  wa_fieldcat-tabname    = 'IT_VBAK'.
  APPEND wa_fieldcat TO it_fieldcat1.
  CLEAR wa_fieldcat.

ls_group-SP_GROUP = '0001'.
ls_group-TEXT = 'VBELN'.
append ls_group to it_group1.

clear ls_group.
ls_group-SP_GROUP = '0002'.
ls_group-TEXT = 'VKORG'.
append ls_group to it_group1.

  cp_vbak[] = it_vbak[].

  CALL FUNCTION 'LVC_FILTER_DIALOG'
    EXPORTING
      it_fieldcat           = it_fieldcat1
      it_groups             = it_group1
*   IS_FILT_LAYOUT        =
*   I_NO_DIALOG           =
*   IT_EXCEPT_QINFO       =
    tables
      it_data               = it_vbak
    CHANGING
      ct_filter_lvc         = filter_ranges
* EXCEPTIONS
*   NO_CHANGE             = 1
*   OTHERS                = 2
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
*Need to code more for Filter the internal table 

7 REPLIES 7

Former Member
530

solved my self

0 Kudos
530

Hi Pihu,

I am also trying to implement the filter functionality in a Table Conntriol.

I have used following two function modules to handle the filter option.

1. CEP_DOUBLE_ALV: You will get the pop up to select you filtering fields.

2. LVC_FILTER_DIALOG: Second pop up to select the filtering data for the fields selected.

But the second FM is giving an error 'filter internal error : 15'

If u have already implemented this functionality, can u give me the sample code.

Thanks in advance,

Sai

0 Kudos
530

Hi Phiu/Sai,

If you have solved the problem..please paste the code. I m also having similar requirement.

Regards

Venkatesh P

0 Kudos
530

Hi,

Can you please post the solution?

Thanks in advance...

Ram

0 Kudos
530

solved. FM used : K_KKB_OUTTAB_FILTER_CRITERIA_K

There are other function modules too, we just need to pass data properly, otherwise it may result in

FILTER INTERNAL ERROR 15.

Note that, the number 15 meant for one of the exceptions in FM FREE_SELECTIONS_INIT. so fill-out the FIELDCATALOG.

15 - no filed type ( solution: pass DATATYPE and INTYPE in field catalog structure)

Thanks

Ram

0 Kudos
530

This message was moderated.

0 Kudos
530

This message was moderated.