cancel
Showing results for 
Search instead for 
Did you mean: 

What's wrong with GET_EXPANDED_ENTITYSET?

Former Member
0 Kudos

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?

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Folks,

is there any new insight on this?

I experience a similar problem, but in my case I just use one simple expand attribute (not a list).

I face two problems here

  1. the name of my navigation attribute is "ToCharacteristics"  but to_expand->compare_to_tech_names ("TOCHARACTERISTICS") always returns 'N'2.
  2. I add the expand Path to et_expanded_tech_clause with 

               ls_expanded_clause = 'TOCHARACTERISTICS'.
               append ls_expanded_clause to et_expanded_tech_clauses.

       But still the GET_ENTITYSET Method for the Characterisitcs entitiy is called.

Both notes (2001852 and 2163713) are already installed without any affect.

Has anybody raised a ticket so far about this issue?`

Cheers

Sebastian


Former Member
0 Kudos

Short update:

using the obsolete method and tables works:

lv_compare_result_cfg_chars = io_expand->compare_to( 'ToCharacteristics' ). ' returns 'E'

...

ls_expanded_clause = 'ToCharacteristics'.

append ls_expanded_clause to et_expanded_clauses. n

-> not CHARACTERISTIC_GET_ENTITYSET is called

Cheers

Sebastian

Former Member
0 Kudos

Looks like, the problem has been already met -

And still there is no decision. I agree with Daniel that MARK_AS_EXPANDED_TECH_NAMES doesn't work correctly.

ChandraMahajan
Active Contributor
0 Kudos

Please check notes http://service.sap.com/sap/support/notes/2001852 and http://service.sap.com/sap/support/notes/2163713

  • 2001852 - Data provider $expand - unnecessary call to GET_ENTITY
  • 2163713 - $expand - get_expanded_entity and et_expanded_tech_clauses are implemented, but still it is handled by framework.

These notes might solve the problem.

Regards,

Chandra

Former Member
0 Kudos

Thank you, Chandrashekhar, I'll apply and check the situation.

I'm afraid that both notes don't change the result of the check within MARK_AS_EXPANDED_TECH_NAMES:

IF LINES( mt_children ) EQ LINES( lt_foreign_children ).

In my case, mt_chidren contains both AUTHOREXP and CLIENTEXP, but lt_foreign_children - AUTHOREXP only (according to /IWBEP/IF_MGW_ODATA_EXPAND - SAP NetWeaver Gateway - SAP Library). So the check simply throws us out of the method not setting that the expand is already handled.

Former Member
0 Kudos

Applied and everything goes as I predicted:

if ET_EXPANDED_TECH_CLAUSES contains AUTHOREXP only - both AUTHORSET_GET_ENTITY and CLIENTSET_GET_ENTITY are called and exception is raised.

if ET_EXPANDED_TECH_CLAUSES contains both AUTHOREXP and CLIENTEXP - no one *GET_ENTITY is called and ClientExp is empty in the output.

AshwinDutt
Active Contributor
0 Kudos

Hello Andrei,

When you fire as &$expand=AuthorExp,ClientExp,

You need to append both the Navigation Properties AUTHOREXP and CLIENTEXP to et_expanded_tech_clauses.

Please check the above once.

Regards,

Ashwin

Former Member
0 Kudos

ClientExp is not processed by /IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET code. If I add CLIENTEXP to et_expanded_tech_clauses there, Client entity is empty.

AshwinDutt
Active Contributor
0 Kudos

Can you share the screen shot showing the association and navigation details ? also the deep structure defined inside Get_ExpandEntity_Set method ?

Below will help ->

Former Member
0 Kudos

Associations:

for the 2nd associations there is the next ref constraint:

There are no constraints for the 1st associations.

AshwinDutt
Active Contributor
0 Kudos

Remove only the referential constrain maintained for 2nd association.

Regenerate the run-time objects.


Append both the Navigation Properties AUTHOREXP and CLIENTEXP to et_expanded_tech_clauses in the code.

This should work. Please check.

Former Member
0 Kudos

If I remove the referential constrain nothing is passed to CLIENTSET_GET_ENTITY.

Just for the interest I've made an experiment - ClientExp is empty.

The point is that Author entity is filled by the code of /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET, but Client - by its common CLIENTSET_GET_ENTITY. If both expand clauses are passed to ET_EXPANDED_TECH_CLAUSES, then CLIENTSET_GET_ENTITY is not called at all. If just AUTHOREXP - SAP calls both CLIENTSET_GET_ENTITY and AUTHORSET_GET_ENTITY, which gives an error as there is just RAISE EXCEPTION within AUTHORSET_GET_ENTITY.

kammaje_cis
Active Contributor
0 Kudos

After you handle expand, this time you need to have two entries in the et_expanded_tech_clauses . Do you have it?

This link will be useful.

/IWBEP/IF_MGW_ODATA_EXPAND - SAP NetWeaver Gateway - SAP Library

Former Member
0 Kudos

I've read it carefully before:

It returns MATCH_SUBSET if you call COMPARE_TO_TECH_NAME( IV_EXPAND = 'PRODUCTS' ) - which is the indicator that you can return a table of categories in which every category entry has a 'PRODUCTS table component. The Supplier relation is in this case further expanded generically by the framework. Exporting parameter ET_EXPANDED_TECH_CLAUSES of GET_EXPANDED_ENTITY / GET_EXPANDED_ENTITYSET needs then to contain one entry 'PRODUCTS' to tell the framework that this expression has already been handled by the application.