cancel
Showing results for 
Search instead for 
Did you mean: 

default values on click of append row in alv

Former Member
0 Kudos

When i click on the Append row (standard) button of the ALV grid, i want that the newly added row should hold some default value which is based on the preceding row (of course the first row will be an exception).

Basically each row has two dates - starting and ending dates. Based on the ending date of the previous row, the newly added row should have the the starting date as the next day.

Could anyone tell me which event do i code this in?

regards,

Priyank

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Priyank,

To solve your problem, Please don't use the APPEND ROW functionality of the WD ALV. Follow the folloing steps:

<b>Step1:</b> It will add the custom button in an ALV.

<b>Step2:</b> Add the functionality in the View where you embeded the ALV TABLE

i) Create a Event handle method ON_APPL_FUNCTION . This event handle must be referewith the ON_FUNCTION event which is avilable in SALV_WD_TABLE. And write the code in that event handle method

<i><b>CODE</b></i>

<b>Step1: In Component Controller</b>

**Declaration

data:

lr_functions type ref to if_salv_wd_function_settings.

lr_functions ?= wd_this->r_table.

data:

lr_function type ref to cl_salv_wd_function.

data:

lr_button type ref to cl_salv_wd_fe_button,

lr_function = lr_functions->create_function( 'MYBUTTON' ).

create object lr_button.

lr_button->set_text( 'MYBUTTON' ).

lr_function->set_editor( lr_button ).

<b>Step-2: Write this one in View where you emped the ALV Table</b>

method on_appl_function .

data:

lr_node type ref to if_wd_context_node.

lr_node = wd_comp_controller->get_function_elements_node( ).

data:

l_value type string.

case r_param->id.

when 'MYBUTTON''.

      • write code here ie give your logic like, pick the infromation from the table and add new row to that table

endcase.

Warm Regards,

Vijay.

Former Member
0 Kudos

Hi Vijaya,

Thanks for the response. Is it not possible with the standard Append row button of the grid? It would involve rework from my side if i do it again.

I just want to know which is the event i can capture when i click on the append row button.

regards,

Priyank

Former Member
0 Kudos

Hi Priyank,

That is the only solution which you can do for you requirement. If you are using the Standard functionality of Appended row, then you can't control that functionality and you can't modify its behaviour also.

There is no other option for you. I spent lot of time for an alternative throught SAP Notes and Books also. So that is the only possible way...

Best Regards,

Vijay

Former Member
0 Kudos

Hi Priyank

Just check the following link by Thomas Jung

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/webDynproABAP-ALVControllingStandard+Buttons&

Best Regards

Naresh

Message was edited by:

Naresh Kumar Malik