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: 

OOPS ALV grid toolbar-Duplicate row handling.

shadab_sk
Participant
0 Kudos

Hi experts,

I have developed a report using oops alv. Here i have 10 columns in my result, out of which 4 are provided to user as editable. Now these 4 columns will not be completely editable through out the report ,instead depend on certain conditions i.e. for these 4 columns i am controlling the editable/greyed out feature at cell level(row level)

Now my requirement is : User may to need to add multiple values for 4th column for a single line item, so i can see that sap has provided the button of "Duplicate Row" in the alv grid toolbar. so when i click on it, i am getting a duplicate row with values and having cell properties(Greyed out/editable) as in the row for which i am creating a duplicate. Now since user only edits the 4th column, i want to make the remaining 3 columns greyed out.

Can somebody please tell me how this can be achievable. Any code snippet would greatly help.

Thank you..

Regards,

shadab

3 REPLIES 3

roberto_vacca2
Active Contributor
0 Kudos

Hi.

You'll need to customize At RowDuplicate event.

Implement HANDLE_DATA_CHANGED. method for your grid then call inside:

CALL METHOD EVENT_RECEIVER->HANDLE_USER_COMMAND

EXPORTING E_UCOMM = '&LOCAL&APPEND'.

Once you'll have set the receiver you'll be able to handle the command in a  FORM like  HANDLE_USER_COMMAND


CASE UCOMM.

  WHEN '&LOCAL&APPEND'.

"Set cells non editable within celltab style = cl_gui_alv_grid=>mc_style_disabled  and modify global internal table for your new row

After this you should do a refresh_table_display.


CALL METHOD YOUR_GRID->SET_USER_COMMAND

  EXPORTING

    I_UCOMM = SPACE

This should work but you'll have to try to implement it. Hope to help.

Bye

0 Kudos

Thanks for the reply.

Where do i need to place the set_user_command method call.

0 Kudos

Hi.

After your final action that could be refresh_table_display.

Hope to help

Bye