cancel
Showing results for 
Search instead for 
Did you mean: 

how to change the column name in smarttable in sap ui5

lk24
Participant

how can we manuplate the column name in smart table which is coming from the odata service

junwu
Active Contributor
0 Kudos

why you have to manipulate it?

View Entire Topic
bbalci
Contributor
0 Kudos

I've generated the annotation in xtrnhfo 's answer above in ABAP , by redefining DEFINE method of model extension class belong to my service as below , it worked :

DATA lo_ann_target  TYPE REF TO /iwbep/if_mgw_vocan_ann_target.
    DATA lo_annotation  TYPE REF TO /iwbep/if_mgw_vocan_annotation.
    DATA lo_collection  TYPE REF TO /iwbep/if_mgw_vocan_collection.
    DATA lo_record      TYPE REF TO /iwbep/if_mgw_vocan_record.
    DATA lo_property_value TYPE REF TO /iwbep/if_mgw_vocan_property.
    DATA lo_property_label TYPE REF TO /iwbep/if_mgw_vocan_property.
    CALL METHOD super->define( ).
    CALL METHOD model->get_schema_namespace
    IMPORTING
      ev_namespace = lv_schema_namespace.
    lo_ann_target =
    vocab_anno_model->create_annotations_target(
      iv_target = lv_schema_namespace && '.' && 'myEntityTypeName' ).
    lo_annotation =
      lo_ann_target->create_annotation( iv_term = 'com.sap.vocabularies.UI.v1.LineItem' ).
    lo_collection = lo_annotation->create_collection( ).
    lo_record = lo_collection->create_record( iv_record_type = 'com.sap.vocabularies.UI.v1.DataField').
    lo_property_value = lo_record->create_property( 'Value' ).
    lo_property_value->create_simple_value( )->set_path( 'myFieldName' ).  
    lo_property_label = lo_record->create_property( 'Label' ).
    lo_property_label->create_simple_value( )->set_string( 'Field Title To Show' ).  "<< Field title to be shown

Thanks,

Bulent Balci