cancel
Showing results for 
Search instead for 
Did you mean: 

How to filter standard ALV report with custom UI element?

Former Member
0 Kudos

Hello Expert,

I got a requirement to filter standard ALV report based on the custom UI element (which is created in the screen before displaying the ALV report). Upon entering the values in the Custom field, the ALV report is displayed accordingly.

Any ideas how to approach it?

Thanks,

Mohammed

Accepted Solutions (0)

Answers (1)

Answers (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi,

Let us say you have an input field FILTER_MATNR and you want to get the data into ALV based on the value of this field.

You can achieve your requirement as below

  • Read the value from field FILTER_MATNR on action of enter key or on press of apply filter button
  • Now, you need to get the data matching the value of the above field and bind it to the context node of alv

Hope this helps you.

Regards,

Rama

Former Member
0 Kudos

Hi Rama,

I got the first point but the second point is not clear to me. Do you got any document or steps,it will be very helpful.

Thanks,

Mohammed.

ramakrishnappa
Active Contributor
0 Kudos

Hi,

Okay, let me explain the steps in detail

  • Let us say you have alv table with 10 records and alv table is shown first time with all 10 records
  • Create an internal table in component controller's attribute GT_ORIGINAL_DATA and save all 10 records into this table first time
  • Now, user enters value in FILTER_MATNR field 123 and press apply_filter button or press enter key
  • Read the value of field filter_matnr and get the only matching records from global internal table GT_ORIGINAL_DATA into local internal table as below

         


          data lv_matnr type matnr.

          data lt_data   like wd_comp_controller->gt_original_data.

               " read the value from context attribute of filter_matnr

                    lv_matnr = ???

               " copy all data into local table

                    lt_data[] = wd_comp_controller->gt_original_data.

               "delete the records which does not match

                 delete lt_data where matnr NP lv_matnr.

  • Now, bind the data lt_data to context node of alv table

Hope this helps you.

Regards,

Rama

Former Member
0 Kudos

Hi Rama,

Actually I am working on NWBC, and very new to it. I am confused what will be the associated type for the attribute?

Cant we do it by enhancing standard method of the button? I mean, in post exit, after standard logic, cant we apply filter there???

Thanks,

Mohammed.

ramakrishnappa
Active Contributor
0 Kudos

Yes, you can do it in POST EXIT as well.

Former Member
0 Kudos

Hi Rama,

I am unable to find the database table in nwbc? Is there any way to find the database tables as i said am very new to nwbc. I have tried running sql trace but its showing one one field from different tables.

Thanks,

Mohammed.