Skip to content

Instantly share code, notes, and snippets.

@ClementRoyer
Created September 13, 2023 11:30
Show Gist options
  • Select an option

  • Save ClementRoyer/0e5373c102c80a53a90b4fad3f4e4720 to your computer and use it in GitHub Desktop.

Select an option

Save ClementRoyer/0e5373c102c80a53a90b4fad3f4e4720 to your computer and use it in GitHub Desktop.
CLASS zcl_zc_ext_purrequisit_mpc_ext DEFINITION
PUBLIC
INHERITING FROM zcl_zc_ext_purrequisit_mpc
CREATE PUBLIC .
PUBLIC SECTION.
METHODS define
REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_zc_ext_purrequisit_mpc_ext IMPLEMENTATION.
METHOD define.
super->define( ).
** "Here starts the Annotation for Object Explorer App
*
DATA lo_ann_target TYPE REF TO /iwbep/if_mgw_vocan_ann_target.
DATA lo_record1 TYPE REF TO /iwbep/if_mgw_vocan_record.
DATA lo_record2 TYPE REF TO /iwbep/if_mgw_vocan_record.
DATA lo_record3 TYPE REF TO /iwbep/if_mgw_vocan_record.
DATA lo_record4 TYPE REF TO /iwbep/if_mgw_vocan_record.
DATA lo_record5 TYPE REF TO /iwbep/if_mgw_vocan_record.
DATA lo_property_value1 TYPE REF TO /iwbep/if_mgw_vocan_property.
DATA lo_property_value2 TYPE REF TO /iwbep/if_mgw_vocan_property.
DATA lo_property_value3 TYPE REF TO /iwbep/if_mgw_vocan_property.
DATA lo_property_value4 TYPE REF TO /iwbep/if_mgw_vocan_property.
DATA lo_property_value5 TYPE REF TO /iwbep/if_mgw_vocan_property.
DATA lo_property_value6 TYPE REF TO /iwbep/if_mgw_vocan_property.
DATA lo_collection1 TYPE REF TO /iwbep/if_mgw_vocan_collection.
DATA lo_collection3 TYPE REF TO /iwbep/if_mgw_vocan_collection.
DATA lo_collection4 TYPE REF TO /iwbep/if_mgw_vocan_collection.
DATA lo_function TYPE REF TO /iwbep/if_mgw_vocan_function.
DATA lo_labeled_element TYPE REF TO /iwbep/if_mgw_vocan_label_elem.
DATA lo_annotation TYPE REF TO /iwbep/if_mgw_vocan_annotation.
vocab_anno_model->create_vocabulary_reference(
iv_vocab_id = 'vocabularies.UI.v1'
iv_vocab_version = '0001'
)->create_include(
iv_namespace = 'com.sap.vocabularies.UI.v1'
iv_alias = 'UI' ) ##NO_TEXT.
vocab_anno_model->create_vocabulary_reference(
iv_vocab_id = 'vocabularies.Communication.v1'
iv_vocab_version = '0001'
)->create_include(
iv_namespace = 'com.sap.vocabularies.Communication.v1'
iv_alias = 'vCard' ) ##NO_TEXT.
vocab_anno_model->create_vocabulary_reference(
iv_vocab_id = 'Measures.V1'
iv_vocab_version = '0001'
)->create_include(
iv_namespace = 'Org.OData.Measures.V1'
iv_alias = 'CQP' ) ##NO_TEXT.
vocab_anno_model->create_vocabulary_reference(
iv_vocab_id = 'Core.V1'
iv_vocab_version = '0001'
)->create_include(
iv_namespace = 'Org.OData.Core.V1'
iv_alias = 'Core' ) ##NO_TEXT.
vocab_anno_model->create_vocabulary_reference(
iv_vocab_id = 'vocabularies.Common.v1'
iv_vocab_version = '0001'
)->create_include(
iv_namespace = 'com.sap.vocabularies.Common.v1'
iv_alias = 'Common' ) ##NO_TEXT.
vocab_anno_model->create_vocabulary_reference(
iv_vocab_id = ''
iv_vocab_version = '0001'
)->create_include(
iv_namespace = 'ZC_EXT_PURREQUISITION_FS_SRV'
iv_alias = 'ZC_EXT_PURREQUISITION_FS_SRV' ) ##NO_TEXT.
DATA(lv_obje_service_name) = CAST /iwbep/if_mgw_odata_re_model( model )->get_schema_namespace( ).
IF lv_obje_service_name IS INITIAL.
lv_obje_service_name = 'ZC_EXT_PURREQUISITION_FS_SRV'.
ENDIF.
lo_ann_target = vocab_anno_model->create_annotations_target( iv_target = lv_obje_service_name && '.' && 'C_PurRequisitionFsType' ) ##NO_TEXT.
lo_annotation = lo_ann_target->create_annotation( iv_term = 'UI.Facets' ) ##NO_TEXT.
lo_collection1 = lo_annotation->create_collection( ).
lo_record2 = lo_collection1->create_record( iv_record_type = 'UI.CollectionFacet') ##NO_TEXT.
lo_record2->create_annotation( iv_term = 'UI.IsSummary' ) ##NO_TEXT.
lo_property_value3 = lo_record2->create_property( 'Label' ) ##NO_TEXT.
lo_property_value3->create_simple_value( )->set_string_from_otr( '005056AC4BF11ED58CC0769EF8561BF9' ).
lo_property_value3 = lo_record2->create_property( 'ID' ) ##NO_TEXT.
lo_property_value3->create_simple_value( )->set_string( 'GeneralInformation' ) ##NO_TEXT.
lo_property_value3 = lo_record2->create_property( 'Facets' ) ##NO_TEXT.
lo_collection4 = lo_property_value3->create_collection( ).
lo_record5 = lo_collection4->create_record( iv_record_type = 'UI.ReferenceFacet') ##NO_TEXT.
lo_property_value6 = lo_record5->create_property( 'Label' ) ##NO_TEXT.
lo_property_value6->create_simple_value( )->set_string_from_otr( '005056B2532A1EE585D11741D97E947F' ).
lo_property_value6 = lo_record5->create_property( 'Target' ) ##NO_TEXT.
lo_property_value6->create_simple_value( )->set_annotation_path( '@UI.Identification' ) ##NO_TEXT.
lo_record2 = lo_collection1->create_record( iv_record_type = 'UI.ReferenceFacet') ##NO_TEXT.
lo_property_value3 = lo_record2->create_property( 'Label' ) ##NO_TEXT.
lo_property_value3->create_simple_value( )->set_string_from_otr( '40F2E93067D51EE5849F27F534B504F5' ).
lo_property_value3 = lo_record2->create_property( 'Target' ) ##NO_TEXT.
lo_property_value3->create_simple_value( )->set_annotation_path( 'to_PurRequisitionItemFs/@UI.LineItem' ) ##NO_TEXT.
lo_property_value6->create_simple_value( )->set_annotation_path( '@UI.Identification' ) ##NO_TEXT.
lo_record2 = lo_collection1->create_record( iv_record_type = 'UI.ReferenceFacet') ##NO_TEXT.
lo_property_value3 = lo_record2->create_property( 'Label' ) ##NO_TEXT.
* lo_property_value3->create_simple_value( )->set_string_from_otr( '40F2E93067D51EE5849F27F534B504F5' ).
lo_property_value3->create_simple_value( )->set_string( 'Limit Items' ).
lo_property_value3 = lo_record2->create_property( 'Target' ) ##NO_TEXT.
lo_property_value3->create_simple_value( )->set_annotation_path( 'to_PurReqnLimitItemFactSheet/@UI.LineItem' ) ##NO_TEXT.
* "Here ends the Annotation for Object Explorer App
DATA(lo_entity_type) = model->get_entity_type( 'C_PurRequisitionFsType' ).
IF lo_entity_type IS BOUND.
DATA(lo_property) = lo_entity_type->get_property( iv_property_name = 'ContactCardNavLinkSemanticObj' ).
IF lo_property IS BOUND.
DATA(lo_anno) = lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).
IF lo_anno IS BOUND.
lo_anno->add( iv_key = 'visible'
iv_value = 'false').
ENDIF.
CLEAR lo_property.
ENDIF.
lo_property = lo_entity_type->get_property( iv_property_name = 'ContactCardNavLinkQueryPart' ).
IF lo_property IS BOUND.
lo_anno = lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).
IF lo_anno IS BOUND.
lo_anno->add( iv_key = 'visible'
iv_value = 'false').
ENDIF.
ENDIF.
lo_property = lo_entity_type->get_property( iv_property_name = 'PurchaseRequisitionText' ).
IF lo_property IS BOUND.
lo_anno = lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).
IF lo_anno IS BOUND.
lo_anno->add( iv_key = 'visible'
iv_value = 'false').
ENDIF.
ENDIF.
lo_property = lo_entity_type->get_property( iv_property_name = 'PurchaseRequisitionType' ).
IF lo_property IS BOUND.
lo_anno = lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).
IF lo_anno IS BOUND.
lo_anno->add( iv_key = 'visible'
iv_value = 'false').
ENDIF.
ENDIF.
ENDIF.
lo_entity_type = model->get_entity_type( 'C_PurRequisitionItemFsType' ).
IF lo_entity_type IS BOUND.
lo_property = lo_entity_type->get_property( iv_property_name = 'ContactCardNavLinkSemanticObj' ).
IF lo_property IS BOUND.
lo_anno = lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).
IF lo_anno IS BOUND.
lo_anno->add( iv_key = 'visible'
iv_value = 'false').
ENDIF.
CLEAR lo_property.
ENDIF.
lo_property = lo_entity_type->get_property( iv_property_name = 'ContactCardNavLinkQueryPart' ).
IF lo_property IS BOUND.
lo_anno = lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).
IF lo_anno IS BOUND.
lo_anno->add( iv_key = 'visible'
iv_value = 'false').
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment