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: 

Editable ALV-No change in internal table

Former Member
0 Kudos
3,174

Hello Experts,

I have an ALV output, in which I have a column as editable. I have generated the output using 'REUSE_ALV_GRID_DISPLAY'. I got to know that after changing the editable cell's value, if we double click the cell or if operate with any PF-status components, the value will automatically get changed in internal table also. For double click I am getting the expected result. But If I click a button the value doesn't get changed in internal table. Is there any other change I have to do for this. If I have checkbox in ALV will it be rectified. But my requirement is when I click the button only It has to be modified in the database table.

Thanks and regards,

Venkat.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
590

Hi Venkat,

In your form for User Command

write following

DATA ref1 TYPE REF TO cl_gui_alv_grid.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = ref1.
      CALL METHOD ref1->check_changed_data.

Case 'User-Command'.

   ......
Endcase.

or

data : i_grid_settings type lvc_s_glay.

 "Calling ALV grid for display
 
 call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      i_callback_program             = sy-repid
      i_callback_user_command   = i_callback_user_command
      i_grid_settings                    = i_grid_settings
      is_layout                            = is_layout
      it_fieldcat                           = it_fieldcat
    tables
      t_outtab                             = it_final


"for call back values from editable grid cells
  i_grid_settings-edt_cll_cb = 'X'.

Hope it helps you,

Pratik

9 REPLIES 9

Former Member
0 Kudos
590

In PAI need to modify the internal table

MODIFY <Itab> index <table control-current_line>

Former Member
0 Kudos
590

Hi

Which is the button from which you need changes ?

Did you get the code of that button and write code for it in your program ?

Can you send the extract of it ?

0 Kudos
590

Hi,

The button I am using is coming from PF-status of ALV . If I click the button the following code will trigger.

FORM user_command USING ok_code TYPE sy-ucomm sf TYPE slis_selfield.

if ok_code = 'EDIT'.

MODIFY ysdinvoicerpt from table t_invoice_rpt.

commit WORK.

endif.

ENDFORM.

This user_command form has been given as input parameter of i_callback_user_command of ALV grid display. If I double click the cell in ALV some system code is triggered and internal table is automatically changed. But If I click the cell, that updation doesn't get changed. Is there any way to take the value of the ALV cell.

Thanks for your response,

Venkat

0 Kudos
590

Looks like when you click on cell, PAI is not triggering.

0 Kudos
590

Hi

When you click the button does the debugger come inside 'if ' and internal table t_*rpt gets changed .

OR modify is not working ?

0 Kudos
590

Hi Venkat ,

You should use Event handler ,

in the event handler method you can write code to modify internal table as well as to update the Database table .

Thanks

Sreenivas reddy

Former Member
0 Kudos
590

Hi Venkat,

The other option is the refresh button on the grid, if u assign the function code of the refresh button to any of your custom button the data shall be saved authomatically ..

try this..

it will work

thanks

ravi

former_member451655
Active Participant
0 Kudos
590

in your "REUSE_ALV_GRID_DISPLAY' use the export Parameter

i_callback_user_command = 'USER_COMMAND' and also in the User_command form you can user fm

'GET_GLOBALS_FROM_SLVC_FULLSCR' and METHOD ref1->check_changed_data to capture changed Data

Br,

Dilum

Former Member
0 Kudos
591

Hi Venkat,

In your form for User Command

write following

DATA ref1 TYPE REF TO cl_gui_alv_grid.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = ref1.
      CALL METHOD ref1->check_changed_data.

Case 'User-Command'.

   ......
Endcase.

or

data : i_grid_settings type lvc_s_glay.

 "Calling ALV grid for display
 
 call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      i_callback_program             = sy-repid
      i_callback_user_command   = i_callback_user_command
      i_grid_settings                    = i_grid_settings
      is_layout                            = is_layout
      it_fieldcat                           = it_fieldcat
    tables
      t_outtab                             = it_final


"for call back values from editable grid cells
  i_grid_settings-edt_cll_cb = 'X'.

Hope it helps you,

Pratik