12-01-2005 2:19 PM
Hi all,
I have an internal table display in a ALV GRID. Only one column is editable. When I change the field value, ALV GRID display the change, but when I click on refresh return the old value.
I've checked in DEBUG mode and when I click on refresh (in the PAI module), the internal table haven't data modified.
For example: the field qta have value 15. I change it in 18 and then press Refresh. In debug, the field qta still have the value 15.
What I have to do?
12-01-2005 2:22 PM
Hi Christian,
I thought we had answered to the same question in your last post.. did that not help?
In any case, did you implement the suggestion?
Are you calling check_changed_data in your PAI module as suggested and still its not working?
If that is the case can you paste your code from your PAI module? and the necessary ALV Grid code for us to analyse...
Sri
12-01-2005 2:22 PM
12-01-2005 2:22 PM
Hi Christian,
I thought we had answered to the same question in your last post.. did that not help?
In any case, did you implement the suggestion?
Are you calling check_changed_data in your PAI module as suggested and still its not working?
If that is the case can you paste your code from your PAI module? and the necessary ALV Grid code for us to analyse...
Sri
12-01-2005 2:27 PM
I follow the example BCALV_EDIT_02.
In this report seems that internal table is automatically update when you change a value. Infact, if you see, when you switch display/change mode, it hold the right values.
The source code of the example call only the alv_grid_first_display method and the set_ready_for_input
method to switch mode.
Why my report don't work? Where is the event of the update of internal table?
When I switch from editing mode to display, ALV GRID display the initial value of the cell.
12-01-2005 2:34 PM
Hi,
Ok, then go through example BCALV_GRID_EDIT.
From what I can understand, you have not registered and handled data_changed event.
That appears to be your problem..
Hope this helps..
Sri
12-01-2005 2:37 PM
Maybe I understood,
In my report I've written
IF go_custom_container IS INITIAL.
...
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
it_toolbar_excluding = it_exclude
i_structure_name = 'ZST_CAT_INV'
is_layout = gs_layout
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = it_record.
ELSE.
CALL METHOD go_grid->refresh_table_display.
ENDIF.
the problem is CALL METHOD go_grid->refresh_table_display. right?
But this ALV GRID is call by a list by an at-selection screen event. If I don't use this instruction, when I back in the list and choose another ALV GRID, I display always the same ALV GRID with the same data.
12-01-2005 2:38 PM
Hi
The Example prg is using Classes, then you need to use the same approach in the way i mentioned below...
You need to Update the ITAB with the Modifeid values.
*---------------------------------------------------------------------*
* CLASS lcl_event_handler DEFINITION
*---------------------------------------------------------------------*
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Handler to Check the Data Change
HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED
E_ONF4
E_ONF4_BEFORE
E_ONF4_AFTER.
ENDCLASS. "lcl_event_handler
DEFINITION
**Handle Data Change
METHOD HANDLE_DATA_CHANGED.
DATA: X_CHANGE TYPE LVC_S_MODI,
X_FINAL TYPE T_FINAL,
X_OCRC TYPE ZSD_OC_HOLD,
L_FLAG.
LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO X_CHANGE.
IF X_CHANGE-FIELDNAME = 'ZZOCHOLDRC'.
READ TABLE IT_FINAL INTO X_FINAL INDEX X_CHANGE-ROW_ID.
IF SY-SUBRC = 0.
READ TABLE IT_OCRC INTO X_OCRC WITH KEY
ZZOCHOLDRC = X_CHANGE-VALUE
TRANSPORTING ZZRCDESC.
IF SY-SUBRC = 0.
X_FINAL-ZZRCDESC = X_OCRC-ZZRCDESC.
MODIFY IT_FINAL FROM X_FINAL INDEX X_CHANGE-ROW_ID
TRANSPORTING ZZRCDESC.
L_FLAG = 'X'.
ENDIF.
ENDIF.
ENDIF.
IF X_CHANGE-FIELDNAME = 'ZZPROMDT'.
READ TABLE IT_FINAL INTO X_FINAL INDEX X_CHANGE-ROW_ID.
IF SY-SUBRC = 0.
X_FINAL-ZZPROMDT = X_CHANGE-VALUE.
MODIFY IT_FINAL FROM X_FINAL INDEX X_CHANGE-ROW_ID
TRANSPORTING ZZPROMDT.
L_FLAG = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
IF L_FLAG = 'X'.
CLEAR V_DATA_CHANGE.
V_DATA_CHANGE = 'X'.
ENDIF.
ENDMETHOD. "data_changed
**you need to SET the HANDLER after the method first display.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DATA_CHANGED FOR G_GRID.
try this
vijay
12-01-2005 2:40 PM
I think this will solve your Problem,.
reward for helpful answers...
regards
vijay
12-01-2005 2:57 PM
Hi,
I dont think there is any problem with REFRESH_TABLE_DISPLAY call...that is fine..
Your internal table it_record gets updated with your changes on ALV Grid only when you call CHECK_CHANGED_DATA method or whenever event data_changed is fired.
Now if you are dealing with some REFRESH button in your PAI module then have a call to CHECK_CHANGED_DATA method of your grid reference go_grid...
If you put a break-point then after the CHECK_CHANGED_DATA method call you should see your changes in it_record table..
Hope this helps..
Sri
12-01-2005 3:03 PM
Hi Can you Try to Give the Code,SO thatit is easy to see
and can fix the problem...
regards
vijay
12-01-2005 2:23 PM