cancel
Showing results for 
Search instead for 
Did you mean: 

Append 10 rows in alv

Madhu2004
Active Contributor
0 Kudos

Hai All,

I have a small requirement where in i need to create a button on the alv tool bar .

on click of this button i need to append 10 blank rows to the alv table.

can some please help me ?

Cheers ,

Madhu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You need to add a new function to your ALV model.

data: lr_function TYPE REF TO cl_salv_wd_function.

lr_function = lr_alv_model->if_salv_wd_function_settings~create_function( id = 'ADD' ).

You would have used a reference of the class cl_salv_wd_uie_button to create your add rows button on the toolbar. Set the function editor as that button reference.

lr_function->set_editor( lr_button ).

In the methods tab of your view, you have to explicitly create the event handler for the on_function event of the ALV. In the parameter r_param, you will have the ID that denotes the name of the function, 'ADD' in this case since thats how we have defined the function. So you can handle that particular event in your method.

To add the empty rows, you just need to add empty rows to your internal table and bind to your context. That would be the same as you do for a table.

Hope this helps.

Regards,

Nithya

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Madhu.

Check this blog:

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2993. [original link is broken] [original link is broken] [original link is broken] [original link is broken]

Here you see how to a add a button.

Add the end of the blog u see the ONUSERFUNCTION event handler.

Here you would add the code that adds 10 empty rows to your context node,

that is bound to the ALV.

So you would just create an internal table with 10 initial rows and bin this with bind_table( ).

Hope this helps,

Sascha