on 04-05-2016 2:42 PM
Hi,
I would like to return my ABAP date fields as simple Dates, with no time aspect.
My understanding is that I need to add an annotation of "sap:display-format="Date".
Do I add this annotation in the MPC class? Do someone have a link to a procedure on how to do this?
Thank you for any input.
Kevin
Hi Kevin,
There are multiple documents available on annotation in Gateway.
Check these link if helps.
Maintain Annotation Models - SAP Gateway Foundation (SAP_GWFND) - SAP Library
Working with Annotations - SAP Gateway Foundation (SAP_GWFND) - SAP Library
You can add annotation at code level also in Model class using method /IWBEP/IF_MGW_ODATA_MODEL->CREATE_ANNOTATION.
Add this piece of logic for your property.
DATA lo_annotation TYPE REF TO /iwbep/if_mgw_odata_annotation.
lo_annotation = lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation
( /iwbep/if_mgw_med_odata_types=>gc_sap_namespace ).
lo_annotation->add( iv_key = 'display-format' iv_value = 'Date ).
Clear cache and check metadata for same.
Regards,
Tarun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.