cancel
Showing results for 
Search instead for 
Did you mean: 

call ALV custom function externally

Former Member
0 Kudos

Hi,

I am wondering whether it is possible to call a custom function of an ALV from a method because I don't want to repeat coding.

Best regards,

ts

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi ts,

Yes, you can call as long as R_PARAM is filled accordingly.

Any way what kind of custom functions are you looking for ?

Regards,

Rama

Answers (1)

Answers (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi ts,

Option 1:

You can use class CL_SALV_WD_TABLE_FUNCTION to create object R_PARAM.

Sample Code:

          data lo_r_param type ref to cl_salv_wd_table_function.

           data lo_event      type ref to cl_wd_custom_event.

               "Create r_param object

               create object lo_r_param.

              

               "Create wdevent object & fill event parameters

               create object lo_event

               exporting

                    id = 'ADD' .

               WD_THIS->ON_ADD_LINE(

               exporting

                    wdevent = lo_event

                    r_param = lo_param ).             

   

Note: here ON_ADD_LINE is the event handler method triggered for alv table function

Option 2

Also, you can make the parameter R_PARAM as optional in event handler method, so that you no need to pass r_param  while calling the event handler method explicitly.

Hope this helps you.

Regards,

Rama