Application Development and Automation 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: 
Read only

ALV Grid Problem

Former Member
0 Likes
838

Hi,

I am facing one problem in ALV Grid. I am using OOPS ABAP for ALV Grid.

ALV Grid is in Edit mode. When I am changing data in the ALV, data is not getting reflected in the internal table.

Please give me the solution.

Regards,

Varun

4 REPLIES 4
Read only

former_member386202
Active Contributor
0 Likes
629

Hi

Refer these standard alv programs

BCALV_EDIT_01 Switch on and off the ready-for-input status of

BCALV_EDIT_02 Define ready-for-input status at cell level

BCALV_EDIT_03 Verification of modified cells

BCALV_EDIT_04 Delete and append rows

BCALV_EDIT_05 Checkboxes

BCALV_EDIT_06 Dropdown Listbox at Column Level

BCALV_EDIT_07 Dropdown Listbox at Cell Level

BCALV_EDIT_08 Integrate Non-Standard F4 Help

BCALV_FIELDCAT_TEST Edit field catalog online

BCALV_FULLSCREEN_GRID_EDIT

BCALV_GRID_EDIT

BCALV_GRID_EDIT_DELTA Example Report for F4 Help of the ALV Grid

BCALV_GRID_EDIT_DELTA_APPL

Regards,

PRashant

Read only

VikasB
Active Participant
0 Likes
629

Hi Varun,

You can try for grid method get_selected_rows.

CALL METHOD grid1->get_selected_rows

IMPORTING

et_index_rows = selected_rows.

it will get the index of that particular row that data have been changed.

then you can read your internal table as follows

READ TABLE i_itab INTO wa_tab INDEX sel_rows-index.

if sy-subrc = 0

modify wa_tab transporting <values>.

endif.

regards,

vikas.

plz reward if helpful.

Read only

Former Member
0 Likes
629

PROGRAM sapmy01 MESSAGE-ID ZTYP.

TABLES : vbak,tvls.

  • ALV Grid Control

DATA : alv_grid TYPE REF TO cl_gui_alv_grid.

  • Custom Control Name

DATA : custom_control_name TYPE scrfname VALUE 'CONTAINER1'.

  • Custom Container

DATA : custom_container TYPE REF TO cl_gui_custom_container.

  • Fieldcatalog Table

DATA : gt_fieldcat TYPE lvc_t_fcat.

  • Layout Structure

DATA : gt_layout TYPE lvc_s_layo.

  • Internal Table for Header Sales Order

DATA : itab_header TYPE STANDARD TABLE OF vbak INITIAL SIZE 0.

  • Internal Table for Item Sales Order

DATA : itab_item TYPE STANDARD TABLE OF vbap INITIAL SIZE 0.

DATA : wa_vbuk TYPE vbuk.

DATA : wa_vbak TYPE vbak.

DATA : vbeln_low TYPE vbak-vbeln,

vbeln_high TYPE vbak-vbeln.

DATA : it_bdcdata_tab TYPE STANDARD TABLE OF bdcdata INITIAL SIZE 0 WITH HEADER LINE.

----


  • CLASS event_handle DEFINITION

----


*

----


CLASS event_handle DEFINITION.

PUBLIC SECTION.

METHODS : handle_double_click

FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row e_column.

METHODS : handle_data_changed

FOR EVENT data_changed OF cl_gui_alv_grid

IMPORTING er_data_changed.

ENDCLASS. "event_handle DEFINITION

----


  • CLASS event_handle IMPLEMENTATION

----


*

----


CLASS event_handle IMPLEMENTATION.

METHOD handle_double_click.

PERFORM double_click USING e_row .

ENDMETHOD. "handle_double_click

METHOD handle_data_changed.

PERFORM data_changed USING er_data_changed.

ENDMETHOD. "handle_data_changed

ENDCLASS. "event_handle IMPLEMENTATION

DATA : event_handler TYPE REF TO event_handle.

FORM data_changed USING p_er_data_changed TYPE REF TO cl_alv_changed_data_protocol.

DATA : changed_values TYPE lvc_t_modi.

DATA : good_cells TYPE lvc_t_modi.

DATA : wa TYPE LINE OF lvc_t_modi.

changed_values = p_er_data_changed->mt_mod_cells.

LOOP AT changed_values INTO wa.

SELECT SINGLE * FROM tvls WHERE lifsp = wa-value.

IF sy-subrc <> 0.

CONTINUE.

ELSE.

READ TABLE itab_header INTO wa_vbak INDEX 1.

wa_vbak-lifsk = wa-value.

PERFORM bdc_run USING wa_vbak.

ENDIF.

ENDLOOP.

Read only

Former Member
0 Likes
629

hi

Assuming that you are using CL_GUI_ALV_GRID then you have to call method go_grid->check_changed_data( ) at PAI of the dynpro displaying the ALV list in order to retrieve the data from the frontend (= ALV list) to your backend (= itab in ABAP program).

Place this method call as one of the first statements within your USER_COMMAND module (PAI) and the save will work.

For more details please refer to threads:

Where/how would you add the actual DB update to BCALV_EDIT_03?

"Implicit" Binding in ABAP OO?: the ALV method grid->check_changed_data