cancel
Showing results for 
Search instead for 
Did you mean: 

Expand not working ...

0 Kudos

Hi all.

I'm developing a simple scenario where I read employee data and later if expanding, I get the absences it has. For this purpose, I've implemented the GET_ENTITY_SET for both entities and made an association between them.

I tested them separately and both work.

/sap/opu/odata/sap/ZDEMO_SRV/EmployeeSet?$filter=EmployeeID eq 000000001
/sap/opu/odata/sap/ZDEMO_SRV/EmployeeAbsenceSet?$filter=EmployeeID eq 000000001

The problem is when I want to do an expand. I want to get employee basic details and do a expand to its absences. If I check the content of IT_FILTER_SELECT_OPTIONS table in the implementation of GET_ENTITYSET for the Absences entity, is empty. However if I check the content of IT_KEY_TAB, has the employee number. What is missing here? Why I don't receive the employee number in the IT_FILTER_SELECT_OPTIONS table?

Thanks in advance.

Accepted Solutions (0)

Answers (4)

Answers (4)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Any update on this thread? Have you found thes solution?

Rgrds,

JK

former_member206574
Active Participant
0 Kudos

Hi Garcia,

You have to Redefine the methods in DPC_EXT class. The methods to redefine are GET_EXPANDED_ENTITYSET and GET_EXPANDED_ENTITY.

Follow the document as shared by Syam.

Regards,

Venu

AshwinDutt
Active Contributor
0 Kudos

Hello,

You will be able to see filter values in IT_FILTER_SELECT_OPTIONS table & IT_KEY_TAB table when call goes to GET_ENTITYSET for the employee entity and you will not be able to see filter values in IT_FILTER_SELECT_OPTIONS table when call goes to GET_ENTITYSET for the Absences entity which is correct. You will not be able to see that values apart from just key properties in IT_KEY_TAB.

The above behavior can be seen when you just model service in SEGW without referential constraints and implement the methods by redefining in DPC_EXT class.

Solution as per my knowledge :

Please maintain referential constraints when you create association & navigation between the entities so that you will get filters values when call goes to Absences entity ( GW itself will take care of persisting filter values and key values for the second call as well . No need of writing any code for that ).

OR

If at all you don not want to create referential constraints for some reasons , Implement expand entity set to accomplish your scenarios , where in first call you can read all your filter values and keys as well which you can use those values as input to get Absences data.

Regards,

Ashwin

SyambabuAllu
Contributor
0 Kudos

Hello,

Check with below blog for expand

Thanks,

Syam

kammaje_cis
Active Contributor
0 Kudos

Can you show the URL which you use for $expand?

My doubt is that you are using a URL like this.

/sap/opu/odata/sap/ZDEMO_SRV/EmployeeSet(EmployeeID=000000001)/<navigationToAbsence>

That is the reason key_tab is filled.