cancel
Showing results for 
Search instead for 
Did you mean: 

valueset problem in alv

Former Member
0 Kudos

hi guys,

I made a value set for a dropdown in a certain column in alv and have several questions:

1. I have the value set as an attribute of the node (cardinality 0...n) which contains the shown data in alv which is bound to the alv data node.

So each row in alv (or element of this node) gets in this column the same value set bound...thats not optimal because each row shows the same value set in its dropdown...so I tried to make a second node in context for the value set with cardinality 1..1 and wanted to bind it additionally to alv but this was not possible...how can I avoid holding the same value set several times for each element in context?

2. In my alv I want to insert new elements with the alv standard functionality "insert row"...I think have to react in the on_data_check event (see blog from thomas jung) when 1 row is insert and have to bind the value set to the column of the editable row in this eventhandler...but the dropdown is empty at runtime...

how can I achieve that I can insert a new element with standard function "insert row" at runtime with the dropdown and value set in it? do I have to use the set_data method in the eventhandler when 1 row should be inserted? at the moment I bound the data at designtime to alv.

regards

thorsten

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

For your second problem, instead of using the standard Add row property in the ALV , create your own function.

lr_function = l_alv_model->if_salv_wd_function_settings~create_function( id = 'INSERT' ).

lr_function->set_function_std( if_salv_wd_c_std_functions=>edit_append_row ).

Then create a method INSERT for ON_DATA_CHECK function and write your code ib this handler.

Regards,

Shruthi R

Former Member
0 Kudos

hi Shruthi,

thanks for your answer.

but where is the difference (concerning bind the value set in a handler) if I react on the standard alv functionality "insert row" in an handler and when I define an own alv function and react in its handler?

that seems for me the same...or am I wrong?

regards

Former Member
0 Kudos

Hi,

I tried this earlier, but on standard functionality, on_data_check event handler is not called. It blindly inserts the row. What you could do is have a user defined method (INSERT) for inserting a row and write the code for the valueset in ON_FUNCTION event handler.

Hope this helps.

Regards,

Shruthi R

Former Member
0 Kudos

thank you Shruthi

it works with an own alv function but I didn´t understand why it didn´t worked when I react on the standard alv function "insert row".