Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV add new row

Former Member
0 Kudos

Hello,

I have a editable OO ALV Grid. I excluded the standard add row function and I am trying to implement my own add row function. The field catalog of my grid contains at the end a filed cellstyles type lvc_t_styl, for playing with the editabillity of the fields. The problem is like this. When I press my custom "ADD" button, I am running this code.

CALL METHOD g_grid->set_ready_for_input

EXPORTING

i_ready_for_input = 1.

CALL METHOD g_grid->append_rows

  • EXPORTING

  • I_ROW_COUNT = 1

.

CALL METHOD g_grid->check_changed_data

IMPORTING

E_VALID = flag

  • CHANGING

  • C_REFRESH = 'X'

The problem here is that I don't know how to make only that inserted row editable. For the rest of the table I am playing with the cellstyles field and I am able to make only one row editable, but for this new row I have troulbes, because it is not yet in my internal table and I cannot use the cellstyles field.

Thank you!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

In the fieldcatalog, set all fields as editable.

<fcat>-edit = gc_true.

In your cellstyles table, make all fields non-editable.

For the existing lines, put the cellstyles table in the record. the cellstyles table will over-ride the layout setting, so the fields will not be editable.

When you insert a line, there will be no cellstyles, to the fields on that line are editable.

Regards

Michael

4 REPLIES 4

Former Member
0 Kudos

Hi George ,

Send me your whole code .

Second you have a method when data is changed on the screen .

In that methodsyou will er_data_changed object which have mt_inserted_rows this will have the inserted row record use this transfer into your internal table .

Former Member
0 Kudos

In the fieldcatalog, set all fields as editable.

<fcat>-edit = gc_true.

In your cellstyles table, make all fields non-editable.

For the existing lines, put the cellstyles table in the record. the cellstyles table will over-ride the layout setting, so the fields will not be editable.

When you insert a line, there will be no cellstyles, to the fields on that line are editable.

Regards

Michael

Former Member
0 Kudos

Hi,

What if my some of my fields in the ALV is having drop down list? The new appended row do not seems to display the drop down. Any workaround?

Former Member
0 Kudos

Why can't you update your internal table and do a refresh running through all methods which are setting your cell style. Then the new line is set up correctly automatically.

Regards,

Thomas