I have add a custom assignment block on the overview page to show the data of a custom table. To add assignment block, I have
created a new view and have added value node with the attributes as per requirement. I have also added edit, insert and delete buttons there. All the things are working fine but Save is not working. To save data, I have used custom controller and trying to fetch data in the overview page controller class, but the custom controller is not reflecting the new value(added/modified), it only shows the previous value. So I am not able to save the changes in the custom table and I want to save the changes only though the save button on overview page..
Please help in this regard.
Thanks a lot !
While adding/modifying attribute in the Custom Assignment Block , in the debug mode after setting the attribute check out the current entity ,and compare with the entity in custom controller at that point .It should maintain the same instance.As your view is in overview page , the custom controller should still be active when it reaches ON_SAVE event.
It is possible that the collection in the custom controller is being overwriteen by some toher istance of the same context node.
Possibly you should put a breakpoint in methods like DO_PREPARE_OUTPUT, or other methods which are calle don rounttrips.These are the ones which will be called after you save method,and you will get an idea if any replacement to the entity is done here.
also try to check the ON_NEW_FOCUS of the custom controller and the view context nodes.
To fetch the values of a view in overview you can use the following method.
In the method of the overview page fetch the value of the view controller.
Data: lr_viewctrl TYPE REF TO cl_bsp_wd_view_controller. lr_viewctrl = me->get_subcontroller_by_viewname( 'BT231H_ACQC/Contractview' ). "Here give your view name
Now you can get the values of the view.
It will be good if you can create a CN at Component controller level and use it for save. Make sure you bind it with View/Custom Controller Node. Once the save is done sucessfully make sure you refresh the entity.
Also you should clear the old values once your view is loaded.