cancel
Showing results for 
Search instead for 
Did you mean: 

Injecting Lineage Data as a Custom Annotation into a SAP Gateway Model

Bernard
Participant
0 Kudos

Hi.

I am wanting to inject a specific custom annotation into the metadata returned to my SAPUI5 client(s).

I am happy with the ability to add custom annotations (represented as attributes off the XML Property Element - in my case in am interested in adding the custom annotation to every field element).

My question is: Is there a way for me to access the service metadata? :- in particular, i would like to add the mapping of the oData API fields to the table-field combo they ultimately end up in.

I suspect the metadata may be available under certain conditions (i.e. if I do the above assignment in code its unlikely to be available).

Can anyone tell me what condition are nesessary for me to have access to this metadata.

Thanks for any assistance

EDIT: Use case

The intent is to leverage an existing depiction of our customised Business Partner API to assist Business Analysts, Test Teams, Auditors, etc... in understanding the destination of fields exposed on the API.

For example in our current depiction below we would like to insert a popup triggered by a hover (e.g. hover over BP Category) that discloses some of the existing annotations (eg: sap:quickinfo) as well as the lineage data (SAP table-field combo)

Trust this makes sense.

BP Category currently:

<Property Name="BusinessPartnerCategory" Type="Edm.String" MaxLength="1" sap:display-format="UpperCase" sap:label="BP Category" sap:quickinfo="Business Partner Category"/>

Required (additional lineage attribute refers):

<Property Name="BusinessPartnerCategory" Type="Edm.String" MaxLength="1" sap:display-format="UpperCase" sap:label="BP Category" sap:quickinfo="Business Partner Category" sap:lineage="BUT000-TYPE" />

below provides substance to above:

gregorw
Active Contributor

Could you perhaps explain the usecase first?

Bernard
Participant
0 Kudos

I will edit my question with the use case - thank you

Bernard
Participant
0 Kudos

update to question completed

View Entire Topic
gregorw
Active Contributor
0 Kudos

What's about adding the following to the DEFINE method of your Data Provider Class:

DATA(lo_entity_type) = model->get_entity_type( iv_entity_name = gc_bp_entity ).
DATA(lo_property) = lo_entity_type->get_property( iv_property_name = 'BusinessPartnerCategory' ).
DATA(lo_annotation) = lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation(
   iv_annotation_namespace =  /iwbep/if_mgw_med_odata_types=>gc_sap_namespace ).
lo_annotation->add(
        iv_key      = 'lineage' 
        iv_value    = 'BUT000-TYPE' 
).

Bernard
Participant
0 Kudos

Hi Gregor.

Answer appreciated.

So, yes, this is adding a custom annotation - but not my challenge. My challenge is to distill these values automatically (i.e. the above is simply hard-coded and I need this done for all fields automatically).

A number of integration tools provide rich APIs into orchestrations or mappings (I was hoping SAP Gateway might).

In short I am not looking for a manually marked up solution. Hope this makes sense?