Hi all
I have created 3 entities: Message, Client and Author. Message is associated with both, Client and Author as 1:1.
The navigation to Author is done by custom code within the method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET of *DPC_EXT class. At the end of the code the corresponding clause 'AuthorExp' (in upper case) is added to et_expanded_tech_clauses table.
Both single $expand requests to Author and Client are processed properly. The difference is that the expand to Author is done once within GET_EXPANDED_ENTITYSET method and the expand to Client - by calling CLIENTSET_GET_ENTITY as much times as there are records received for Message entity set.
The problem starts if I use both expands in one request, i.e. $expand=AuthorExp,ClientExp.
Within /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET method er_entityset is filled by the data for Message and Author. et_expanded_tech_clauses table is filled by 'AUTHOREXP'. Then the process goes back to /IWBEP/CL_MGW_ABS_DATA -> READ_EXPANDED_ENTITYSET and via the method EXPAND_ENTITY calls READ_EXPANDED_ENTITY for every child (expand). And there is a check here:
IF io_expand_node->is_expanded( ) NE abap_true.
which unexpectedly gives us abap_false, instead of abap_true and the AUTHORSET_GET_ENTITY is called. So the question is why, although this clause is reported as already expanded?