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 OO data change problem

dirk_wieczorek
Product and Topic Expert
Product and Topic Expert
0 Likes
3,927

We use an editable alv grid oo in a customer project.

We have the problem thaht the customer enters a value in one cell and then without enter or leaving the cell pushes save.

In the save routine we trigger the check data changed event and we have the the enter event triggered. But the data in inserted in to the cell

is not available in and after the data changed it gets lost.

If the user leves the cell with tab or enters a second one check data changed works but not when he enters a value and starts the save

routine.

Is there a way to get this values?

Regards

Dirk

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,424

Hi Dirk,

You may use the below events to check the data changes without use of TAB or Enter key.

*--metohd to detect if data was changed in oops alv

CALL METHOD OBJ_ALV2->CHECK_CHANGED_DATA

  • IMPORTING
  • E_VALID =
  • CHANGING
  • C_REFRESH = 'X'

.

ENDIF.

Also use REGISATER_EDIT_EVENT before REFRESH_TABLE_DISPLAY.

Sample code for REGISTER_EDIT_EVENT is given below:

*--event to detect if data gets edited

CALL METHOD OBJ_ALV2->REGISTER_EDIT_EVENT

EXPORTING

I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED

EXCEPTIONS

ERROR = 1

OTHERS = 2.

IF SY-SUBRC 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards,

Amit

3 REPLIES 3
Read only

gouravkumar64
Active Contributor
0 Likes
1,424

Hi,

I do not know ur exact code & problem.

But what genrally have to do in this case is,

Is well explained in this thread

https://scn.sap.com/thread/1067549

there is some standard program in sap also ,in se38,search with bcalv* or salv*.

there are some standard program in SAP HELP.,WIKI.

see that also like

http://wiki.sdn.sap.com/wiki/display/ABAP/Editable+ALV+through+OOPS

Hope this will solve ur problem.

Thanks

Gourav.

Read only

Former Member
0 Likes
1,425

Hi Dirk,

You may use the below events to check the data changes without use of TAB or Enter key.

*--metohd to detect if data was changed in oops alv

CALL METHOD OBJ_ALV2->CHECK_CHANGED_DATA

  • IMPORTING
  • E_VALID =
  • CHANGING
  • C_REFRESH = 'X'

.

ENDIF.

Also use REGISATER_EDIT_EVENT before REFRESH_TABLE_DISPLAY.

Sample code for REGISTER_EDIT_EVENT is given below:

*--event to detect if data gets edited

CALL METHOD OBJ_ALV2->REGISTER_EDIT_EVENT

EXPORTING

I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED

EXCEPTIONS

ERROR = 1

OTHERS = 2.

IF SY-SUBRC 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards,

Amit

Read only

dirk_wieczorek
Product and Topic Expert
Product and Topic Expert
0 Likes
1,424

Hello Amit,

thanks for your answer. The Edit Event solved our problem with the data input.

There are 2 other problems we have with the alv grid 00 perhaps you or someone ohter here

can gve me an advice for them too.

First is there any possibilty to notice when a user makes a layout change?

I can read an Layout that is assignded to the alv but same steps require that we notice

any change when the user makes them.

The data Change event and the Data Change finished seem not to be triggered by this.

Is there a way?

Finally the user has some filters declared / assigned to an Layout he assigned to the alv.

Our problem is that when he changes the data and these filters are not triggered during the refresh dipslay.

Anyone on idea what we have to do that the filters are triggered during refresh?

Regards

Dirk