Skip to Content
0

$metadata does not show custom field from appended Entity structure

Mar 07 at 02:23 PM

103

avatar image
Former Member

I have added a custom field to the entity structure HCMFAB_S_EMPLOYEEDETAILS by appending a Z-structure.

I implemented the BADI HCMFAB_B_COMMON, more specific the following method where I can see the custom property I added in the entity: IF_EX_HCMFAB_COMMON~GET_EMPLOYEE_DETAILS

I executed /IWBEP/CACHE_CLEANUP and /IWFND/CACHE_CLEANUP, however the $metadata /iwfnd/gw_client is not showing the new property.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Diego Dora
Mar 07 at 07:49 PM
1

Hi Former Member !

I think that what Gregor Wolf mention is exactly what's missing. You modify the structure and the BAdI but didn't modify the Model Provider which it's defined on the OData service class. Sometimes you have service enhancements where you have a BAdI just to modify the MDP class but in this case doesn't seem like that. Check this other message:

https://archive.sap.com/discussions/thread/3949478

Also, here is a link where there was a BAdI to modify the MDP (check page: 15) : https://www.sap.com/documents/2015/08/9ccbe927-5a7c-0010-82c7-eda71af511fa.html . (in case you want to see another example).

Hope this helps!

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Diego Dora,

I assumed because there was a BADI to enrich the entity and because I'm only adding fields to existing entities that there would be some dynamic code in place to update the model based on the (appended) structure of the entity. So you are saying that sometimes this is the case (as I've indeed seen in some examples)? Question is, how would I know when this is the case without trial and error?

Is it only supported in case there is a method exactly named "enhance_gw_service_entity_mdp"?

Pieter

0

rule #1 when working with SAP.....never assume ANYTHING! haha

0

Hi Former Member ,

I see your point and I think that the "rule of thumb" here would be doing a quick checklist every time that you're going to deal with an OData service:

From the Model Provider (metadata / service definition) point of view:

1. Did I change the Structure used on the service?

2. Did I update somehow the Service metadata? (whether is via Code with a BAdI or via SEGW and the subsequent generated code)

From the Data Provider (business logic) point of view:

1. Did I Updated the business logic? (redefining a method/service or adding code via BAdI)

In my 6 years working with gateway I didn't find a "SAP Standard Dynamic Service" that by enhancing the structured used then the Model is automatically updated.
I coded custom OData services like that in the HCM space because, as you know, there are many country specific Infotypes but there is a "down side to that" and is that every call is being done to the service the Constructor executes all your code increasing all the calls by a % (so performance wise it's not the best - you can pre-calculate things but it's not that simple straight forward).

I think that checking those 3 questions that I mention you can avoid the "trial and error", just verify that the BAdI are or not in place and if not then you know what to do (redefine).

Let me know what you think!
Diego.

0
Gregor Wolf
Mar 07 at 07:17 PM
0

I would guess you have to create a SEGW project and redefine the SAP delivered standard service. There you should then be able to add your custom field to the Entity.

Share
10 |10000 characters needed characters left characters exceeded