cancel
Showing results for 
Search instead for 
Did you mean: 

Context change log of ALV

0 Kudos

*Hi friends ,

I have used context change log to record the user changes in my Webdynpro application. It records succesfully when the user has manually changed something in ALV. But in that ALV if I add or delete an row it doesn't record it.

So I had used the cl_wd_context_services class for this.

In the WDDOINIT method of component controller I have written the following code to subscribe to the node changes.

DATA context TYPE REF TO if_wd_context.

DATA lo_change_list TYPE REF TO cl_wd_context_services.

DATA l_changed TYPE cl_wd_context_services=>changed_list.

DATA lo_nd_node TYPE REF TO if_wd_context_node.

DATA lt_subscription TYPE cl_wd_context_services=>subscription_list.

DATA ls_subscription type cl_wd_context_services=>SUBSCRIPTION_ELEMENT.

DATA lo_controller type REF TO if_wd_controller.

lo_controller ?= wd_this->wd_get_api( ).

"create OBJECT lo_controller.

CREATE OBJECT lo_change_list.

lo_nd_node = wd_context->get_child_node( 'Z_SPFLI' ).

context = wd_context->get_context( ).

CALL METHOD context->enable_context_change_log( ).

ls_subscription-controller = wd_this->wd_get_api( ).

ls_subscription-node_name = 'Z_SPFLI'.

APPEND ls_subscription to lt_subscription.

CALL METHOD lo_change_list->subscribe_to_node_changes

EXPORTING

subscriptions = lt_subscription .

lo_change_list->activate_subscriptions( ).

Now if the user inserts or delete some rows from ALV and clicks on some button I have written the following code in the action

handler.

DATA lt_changes_list TYPE cl_wd_context_services=>changed_list.

DATA lo_change_list TYPE REF TO cl_wd_context_services.

CREATE OBJECT lo_change_list.

CALL METHOD lo_change_list->get_change_list

  • EXPORTING

  • reset_list = abap_true

RECEIVING

changed_items = lt_changes_list.

But lt_changes_list is coming initial. It does not record any changes.

Accepted Solutions (1)

Accepted Solutions (1)

saravanan_narayanan
Active Contributor
0 Kudos

Hello Mohsin,

I think the problem is that you are creating new instance of lo_change_list again the event handler. you should use the same instance CL_WD_CONTEXT_SERVICES which was used of subscription.

try this

1. create a component level/ view level attribute (in the Attributes tab) for mo_change_list

2. in the Init method create instance of wd_this->mo_change_list and subscribe for the changes

3. in the action handler method use the same wd_this->mo_change_list to get the change list.

note that reset_list attribute of the get_change_list method will reset the previous changes. So in the next call to this method you won the previous changes. just for your information.

BR, Saravanan

0 Kudos

Hi,

Thank you for your reply. The issue is solved now.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi soudagar,

Please check this,.. same issue

Cheers,

Kris.