2010 May 26 11:09 AM
HI ,
I have a requirement in oo alv where user will enter the data.
if the user enters a material and quantity in first row, and in the second row if he enters the SAME material ,
the first row should be updated with the quantity and second row should be removed.
I am handling this is Data_changed event .
The problem is , manually entered material number in second row is not getting cleared . ( I have cleared the second row in internal table and used refresh_table_display ).
still the material in second row is not getting removed.
Pl let me know if you have any idea how to do this. awarding points is for sure.
Thanks alot.
Sandeep.
2010 May 26 11:33 AM
You have to set the value by using method MODIFY_CELL of class CL_ALV_CHANGED_DATA_PROTOCOL.
An example from a program from me:
CALL METHOD er_data_changed->modify_cell
EXPORTING
i_row_id = 2
i_fieldname = 'MATNR'
i_value = ''.
2010 May 26 11:16 AM
Hi,
Are you calling the table refresh method as below:
GS_REFRESH-ROW = 'X'.
GS_REFRESH-COL = 'X'.
CALL METHOD GR_ALVGRID->REFRESH_TABLE_DISPLAY
EXPORTING
IS_STABLE = GS_REFRESH.This should display only the updated internal table. Please check
Regards,
Jayesh
2010 May 26 11:28 AM
hi Jayesh,
I am passing the parameters mentioned.
still it dint work !!
2010 May 26 11:17 AM
Hi Sandeep try this code for refreshing the grid
MODULE ALV_100 OUTPUT.
*free container and object
PERFORM FREE.
*alv grid display
PERFORM DISPLAY.
ENDMODULE.
FORM FREE.
IF C_ALV IS NOT INITIAL.
CALL METHOD C_ALV->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
FREE C_ALV.
ENDIF.
ENDIF.
IF C_CONTAINER IS NOT INITIAL.
CALL METHOD C_CONTAINER->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
FREE C_CONTAINER.
ENDIF.
ENDIF.
ENDFORM.
FORM DISPLAY.
*Creating object of container.
CREATE OBJECT C_CONTAINER
EXPORTING
CONTAINER_NAME = 'CONTAINER'.
*Creating object of alv
CREATE OBJECT C_ALV
EXPORTING
I_PARENT = C_CONTAINER.
Fieldcatalog.
PERFORM ALV_FIELDCAT.
CALL METHOD C_ALV->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = WA_LAYOUT
CHANGING
IT_OUTTAB = IT_OUTPUT
IT_FIELDCATALOG = IT_FIELDCAT.
ENDFORM.
Try in this way free the container and grid....
2010 May 26 11:33 AM
You have to set the value by using method MODIFY_CELL of class CL_ALV_CHANGED_DATA_PROTOCOL.
An example from a program from me:
CALL METHOD er_data_changed->modify_cell
EXPORTING
i_row_id = 2
i_fieldname = 'MATNR'
i_value = ''.
2010 May 26 11:55 AM