cancel
Showing results for 
Search instead for 
Did you mean: 

Advise on check append insert buttons in alv

0 Kudos

Dear Experts,

Please advise on standard alv standard function buttons and how to call methods in the view to check out the parameters and put our own code for validation.

Could you please advise on this.

Your time and help much appreciated.

Many thanks in advance.

Best Regards

Chandra

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Dear Vivekananthan,

Thanks for the info directed me which demonstrates the custom buttons.

But my question is I wanted to use the standard alv function "check, append and insert button" which will appear in ALV. I need to intercept these in my view and put the custom code. For eg when I click 'append 'button I want to update the table, like wise check button I wanted to validate the data therefore I need to get the parameters to get to know what button is clicked. Please advise.

Former Member
0 Kudos

hi,

The workaround is Hide the standard buttons and instead place your own buttons with the desired functionality.

Thanx.

Saurav.

Former Member
0 Kudos

Hi,

Eventhough you use the standard buttons and write your own code, Only standard functionality gets triggered and custom code is bypassed.You need to design your own buttons and functionality.

Regards,

Lekha.

vivekananthan_sellavel
Active Participant
0 Kudos
0 Kudos

Dear Vivekananthan,

As per your doco I have created the custom button and it looks good in ALV Then I created a new method

called on_search and put the following code.

DATA: temp TYPE string.

temp = r_param->id.

IF temp = 'LBUTTON'.

wd_comp_controller->fill_sflights( ).

It is coming out as syntax error that r_param IS NOT DEFINED.

Could you please explain in steps how to do this bit.

"Specify event, ON_FUNCTION of the interface controller of ALV for the event handler method"

Your time and help is much appreicated.

Many thanks.

Cheers

Chandra

Former Member
0 Kudos

Hi,

I think the Button Id that you are passing against r_param->id is wrong.

Please check the below code -

Create custom button -

DATA:
    lr_btnui_save type REF TO CL_SALV_WD_FE_BUTTON,  
     lr_function_save TYPE REF TO CL_SALV_WD_FUNCTION. 
  CREATE OBJECT lr_btnui_save.
  lr_btnui__save->SET_TEXT( 'SAVE' ).

  lr_function_save =
  lr_model->IF_SALV_WD_FUNCTION_SETTINGS~create_function( id = 'BTN_SAVE'  ).
  lr_function_save->SET_EDITOR( lr_btnui_save ).

in the On_function of that specific ALV - 

 DATA:
    lv_temp TYPE string.                      "Holds the button id
  lv_temp = r_param->id.
  IF lv_temp EQ 'BTN_SAVE'.          
  wd_this->save_data( ).
endif.

Please check ST22 for more detailed error analysis.

Regards,

Lekha.

0 Kudos

Hi Lekha,

Many thanks for your quick response.

I am definitely missing some thing in ALV .

Could you please explain where is "in the On_function of that specific ALV - "

and how to define this ON_FUNCTION .

Your time and help much appreciated.

Best Regards

Chandra

Former Member
0 Kudos

Hi Chandra,

I hope you have used the below code:

DATA : lr_table_settings TYPE REF TO if_salv_wd_table_settings.

lr_table_settings ?= l_value.

lr_table_settings->set_read_only( abap_false )

when you use this code you will get 4 standard buttons on alv tool bar....

Insert, append, delete...

whenever you want to write your custom code in these specefic buttons then you need to create a method with using function selection(not remeber exactly), but you need to select one of ALV functions there..use F4 on the right side of your new method creation.

inside you will be able to write your custom code....for insert,append,deletion.

let me know if you are not cleared,...I will send you sample code for you.

thanks,

Naresh.

0 Kudos

Hi Naresh & others

Many thanks for your kind help so far. Let me clear what i wanted to know.

I followed the below link for creating a custom button in ALV tool bar which looks great.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c...

But I am missing the last bit of the exercise that is "Capturing Events triggered by Toolbar elements"

That I DO NOT know HOW TO "Specify event, ON_FUNCTION of the interface controller of ALV for the event handler method. The importing parameter r_param of the method contains unique ID of the function for which the toolbar element is assigned."

Please shed light on this one with steps to follow:

Your time and help much appreciated.

Warm Regards

Chandra

Former Member
0 Kudos

Hi Chandra,

In the view, Methods tab, You give an entry as

(name) (type) ( Desc) Name

ONACTIONSAVE EVENTHANDLER Action for Save ON_FUNCTION(click f4 and choose the

ON function of your ALV) . This is the way you define the event for the ALV. Save it. Now double click on this method then you can see r_param as the importing parameter.

If you have names your ALV as ALV then on F4 help select ON_FUNCTION row for this ALV.

If you have used other ALV component usages then that list will also be seen in the F4.

If you dont see any F4 help entries as specified above then first have this ALV as a component use in the view's properties tab.

Regards,

Lekha.

0 Kudos

Hi Lekha,

Thanks for your answer.

Your are a legend..!!!

Your time and help is much appreciated.

Have a nice day.

Best Regards

Chandra

Former Member
0 Kudos

Hi,

To have our own functionality, then we have use custom buttons not the Standard buttons of the ALV.

Regards,

Lekha.