Navigation between two ALV components leads to error RABAX_STATE
I got a real stange behaviour programming a WD4A application to show sales orders. But let's start with the setting.
I have one window, called "MAIN", and two views, called "OVERVIEW" and "DETAIL_POSITIONS". There is an ViewContainerUIElement placed on each view.
The context of my componentcontroller is given by a node "KA_HEADER" containing some fields given by SAP table VBAK. The node "KA_HEADER" has cardinality "0..n" and selection "0..1".
The is one subnode of "KA_HEADER" named "KA_POS" containing some fields given by SAP table VBAP. This node ist defined with cardinality "0..n", selection "0..1", initial lead selection and as singleton with a supply function.
There are two SALV_WD_TABLE components unsed in my application embedded into each ViewContainerUIElement mentioned above. By "Component Usage" the "DATA" context of the ALV component mapped to the node "KA_HEADER" and "KA_POS" of the component controller, respectively.
Both views are connected using buttons and plugs, and everything work fine. It ist possible to select a line of the ALV table in "OVERVIEW" to goto to "DETAIL_POSITIONS" and so on.
To make navigation more comfortable I put a link on the order number of the ALV table in "OVERVIEW". Once clicked, the lead selection of context node "KA_HEADER" is set using method "set_lead_selection_index" of interface "if_wd_context_node" to the correct index and the plug to reach "DETAIL_POSITIONS" is fired:
DATA lo_nd_ka_header TYPE REF TO if_wd_context_node.
DATA lo_el_ka_header TYPE REF TO if_wd_context_element.
lo_nd_ka_header = wd_context->get_child_node( name = wd_this->wdctx_ka_header ).
lo_nd_ka_header->set_lead_selection_index( index = r_param->index ).
Correct details are displayed and everything works fine up to this point.
But if I sort the ALV table on view "OVERVIEW" in a different way using the ALV functions on the web ui, something goes wrong. In this case, I can navigate to the details view "DETAIL_POSITIONS" and back once. the next time I try it, the following error comes up:
Error when processing your request
What has happened?
The URL http://sapsrv11.westagsap.intra:1080/sap/bc/webdynpro/sap/zwd_sd01_kundenauftraege/ was not called due to an error.
The following error text was processed in the system E01 : The node specified in mapping ( KA_POS) could not be found
The error occurred on the application server sapsrv11_E01_01 and in the work process 0 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: RESOLVE_MAPPING of program CL_WDR_CONTEXT_NODE_INFO======CP
Method: MAP of program CL_WDR_CONTEXT_NODE_MAP=======CP
Method: IF_WD_CONTEXT_NODE~GET_ATTRIBUTE_PROPS_FOR_NODE of program CL_WDR_CONTEXT_NODE_MAP=======CP
Method: GET_ATTRIBUTE_PROPERTIES of program CL_SALV_WD_DATA_TABLE=========CP
Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Does anyone know what to do to avoid this error. The ALV components seem to get a problem setting the lead element of the header element.
Thanks in advance and best regards,
Thomas Jung replied
>But if I sort the ALV table on view "OVERVIEW" in a different way using the ALV functions on the web ui, something goes wrong.
This is a fairly easy one to answer as to why this is happening. The ALV component doesn't support being bound to a node that has a sub node. This is documented in the online help:
The ALV component requires a context node that can contain the data of the internal data table. This context node has the following properties:
● It has the cardinality 0..n.
● It only contains attributes and no subnodes: For each column of your internal data table, you create exactly one attribute of the same name and data type.
● All the attributes are static, not dynamic.
Important Exception: Sorting
Here ALV has to use the entire dataset so that the data records can be arranged in the new order. For this purpose, the ALV component temporarily takes control of the internal data table and invalidates the corresponding context node of your application during this time. This ensures that the application cannot access the context node while the ALV component is editing the internal data table.
Once the internal data table has been resorted, ALV rebuilds the context node, releases it again for the application, and displays the data accordingly.
When you are planning your application, note the following side-effects of this mechanism:
● When the context node is invalidated, information about current selections, and in particular the lead selection, is lost.
● If your application has created subnodes for the context node, (master-detail scenario), these subnodes are lost as soon as the ALV component invalidates the context node. If the application then tries to access the subnodes, a runtime error occurs.