cancel
Showing results for 
Search instead for 
Did you mean: 

[SEGW] Create annotation for SmartTable

Joseph_BERTHE
Active Contributor
0 Kudos

Hi All,

I want to play with the Smart control in UI5 especialy with the table. In my investigation I found that I need to drive the UI with Annotation stuff.

I found out the solution to add annotation into my Metadata file but it miss the VALUE property.

Here is what I get :

The property I have is LABEL but it seams that I need the property VALUE :

src: Step 5: Smart Filter Bar and Smart Table


When I try to modify my annotation (TCode SEGW) I do not have that property :

So my question is how to set VALUE property ?

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

Joseph_BERTHE
Active Contributor
0 Kudos

I'm close to find a solution, but it is a programmed solution. What I done is to insert code into ZCL****MPC_EXT classe inside the method DEFINE_VOCAB_ANNOTATIONS.

Inside I set that code :


(...)

     lo_property = lo_record->create_property( 'Value' ).

     lo_simp_value = lo_property->create_simple_value( ).

     lo_simp_value->set_property_path( 'Fonds' ).

     " Annotation

     lo_sub_annotation = lo_record->create_annotation( iv_term       = 'com.sap.vocabularies.UI.v1.Importance' ).

     lo_simp_value = lo_sub_annotation->create_simple_value( ).

     lo_simp_value->set_enum_member_by_name( iv_value = 'com.sap.vocabularies.UI.v1.Importance/High' ).

I replace Label by Value and in my Metadata file I get this :

But it still doesn't work because the property Fonds has not the parameter SAP:VISIBLE

And I really don't know how to set this parameter ?!

Regards

Former Member
0 Kudos

Hi,

that's the way we want to try.

Can you make a Screenshot from your Entity?

Think your Properties are also missing the SAP:Label Annotation... so they can't be displayed!

In my case only the Property "IncDate" will be displayed as "Zeitstempel".

Thats why we still using the SEGW type 1: SAP-Annotation and trying to create the whole LineItem-Tag in the *MPC_EXT.


This has the benefit that the properties are translatable in the backend.


Regards

Joseph_BERTHE
Active Contributor
0 Kudos

Here is my entity


<EntityType Abstract="true" Name="EtFondsDetails" sap:content-version="1">

  <Key><PropertyRef Name="Fonds"/></Key>

  <Property MaxLength="4" Name="Fikrs" Nullable="false" Type="Edm.String" sap:label="Périm.financier"/>

  <Property MaxLength="1" Name="Status" Nullable="false" Type="Edm.String"/>

  <Property MaxLength="10" Name="Fonds" Nullable="false" Type="Edm.String"/>

  <Property MaxLength="255" Name="Designation" Nullable="false" Type="Edm.String"/>

  <Property MaxLength="1024" Name="Responsable" Nullable="false" Type="Edm.String"/>

  <Property Name="SoldeInitial" Nullable="false" Precision="13" Scale="2" Type="Edm.Decimal" sap:label="Montant pér.fin"/>

  <Property Name="Recette" Nullable="false" Precision="13" Scale="2" Type="Edm.Decimal" sap:label="Montant pér.fin"/>

  <Property Name="Depense" Nullable="false" Precision="13" Scale="2" Type="Edm.Decimal" sap:label="Montant pér.fin"/>

  <Property Name="SoldeFinal" Nullable="false" Precision="13" Scale="2" Type="Edm.Decimal" sap:label="Montant pér.fin"/>

</EntityType>

Former Member
0 Kudos

Hi,

you can easily verify my guess. If you set Fikrs instead of Fonds in your solution.

If I am right, you'd have to get displayed the Fikrs column by default.

Joseph_BERTHE
Active Contributor
0 Kudos

Nop... doesn't work.

But as discussed in that blog : https://scn.sap.com/community/developer-center/front-end/blog/2015/09/16/smarttable-exampl


The next thing is the sap:visible="true" annotation at the properties of the EntityType. We need to set this attribute to make the property visible in the SmartTable.

So now, how can I set that parameter : sap:visible.

Regards

Former Member
0 Kudos

Hi,

have you take a look to the SAPUI5 Explored? - SAPUI5 Explored

There is an example with a mocked Metadata file... This guys has no "sap:visible" Annotaion to there Entity Properties...

And as you can see here: SAP Annotations for OData Version 2.0 | SCN

sap:visible is true by default...

But there EntityType isn't abstract like yours!

and there LineItem Annotation is different! It hast to be like this:

(your PropertyValue has an PropertyPath )

My guess is that the "sap:visible" Annotation makes Properties visible who has no sap:label

Regards

Joseph_BERTHE
Active Contributor
0 Kudos

You got it !!!!!!

2 points missed :

  1. Annotation term should be com.sap.vocabularies.UI.v1.ImportanceType/High and not com.sap.vocabularies.UI.v1.Importance/High
  2. Property Value should be PATH and no PROPERTY_PATH
Former Member
0 Kudos

Perfect!

can you send me an How to?

Because I have still the problem that I can't add sap:labels to my Entity Properties in an SEGW Type 2 Project -.-

Joseph_BERTHE
Active Contributor
0 Kudos

Hi,

I will create a blog on this topic.

But to answer to your question, the label came from the DDIC type.

1. I disconnected my entity type from ABAP Structure Type name

2. For each property I manually set ABAP type through ABAP type editor

And automatically the sap:label appears

regards,

0 Kudos

How do you set the filterability for the properties of the entity? I am stuck with this. Please help if you know how. Thank you.

Regards,

Tejas

Former Member
0 Kudos

data : param_entity type ref to /IWBEP/IF_MGW_ODATA_ENTITY_TYP,

        param_properties TYPE /IWBEP/IF_MGW_MED_ODATA_TYPES=>TY_T_MGW_ODATA_PROPERTIES,

        param_property_s like line of PARAM_PROPERTIES,

        param_property type ref to /IWBEP/IF_MGW_ODATA_PROPERTY.

     super->define( ).

     param_entity = MODEL->GET_ENTITY_TYPE( IV_ENTITY_NAME 'ZEQ_YCMRES_CP_Q0025Parameters' ).

     param_properties = param_entity->GET_PROPERTIES( ).

     loop at param_properties into param_property_s.

      param_property_s-PROPERTY->SET_FILTERABLE(

          IV_FILTERABLE = ABAP_TRUE

      ).

     endloop.

Former Member
0 Kudos

Hi,

I have a similar issue as Joseph Berthe, but I want to set the property sap:visible as "False".

It doesn't exist in vocabulary based annotation list so how  can I set it.

Best Regards.

Sirine.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Joseph,

we have the same Problem.

With an Vocabulary-Based Annotated Service we can't set the 'sap:label' Annotation to the Entity Properties and we can't add the Value Property to the LineItem.

The Vocabulary-XML still looks fine.

How did you get the 'sap:label' Annotation to your Entity Properties?

We are currently using a Service with SAP-Annotations (cause the Entity Properties are Language-dependent) and try to extend the MPC to get the LineItem Annotaions.

Best regards,

Ullrich

Joseph_BERTHE
Active Contributor
0 Kudos

Hello,

I have created a project in SEGW type 2 : Service with Vocabulary-Based Annotations. Then I imported :/IWBEP/VOC_UI vocabulary.

Then after having created my Entity Types I create annotation :

Then I created LineItem annotation:

Hope it helps

markteichmann
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Joseph,

for the LineItem annotation youshould choose the complex type 'DataFieldForAnnotation':

Then you have both properties 'Label' and 'Target' at hand:

Now I only have to solve the 'sap:visible' riddle. I did not found out until now how to populate this through SEGW and I think you also have the same problem until now.

Cheers,

Mark