cancel
Showing results for 
Search instead for 
Did you mean: 

OData Annotation - SmartTable Line Item

reachglady
Explorer
0 Kudos

Hi Experts,

I have a requirement to extend one of the standard Fiori Applications without creating a new SEGW or UI projects. I have to add a custom field as a new column to the existing Line Item SmartTable .

I have added and made that field/column as default one as well using annotation and it is showing on the SmartTable. Even though I could see the value in the EntitySet payload, this field value is not displaying on my new column. Requesting your valuable suggestions.

Thanks in Advance,

Glady

0 Kudos

Hi Glady,

could you share some screenshots or codes? It helps for investigating the problem.

Cheers

Cuong

reachglady
Explorer
0 Kudos

Below is the code that I used to extend the model:

DATA: lo_entity      TYPE REF TO /iwbep/if_mgw_odata_entity_typ.


lo_entity = me->core_object->model->get_entity_type( 'Item' ).
lo_entity->create_property( iv_property_name ='Custome Field' iv_abap_fieldname = 'ZZCUSTOM' ).

DATA(lo_header_anno) = cl_fis_uibb_annotation=>create_line_item_annotation(

            io_odata_model     = me->core_object->model

            io_vocan_model     = me->core_object->vocab_anno_model

            iv_namespace       = 'FAC_FINANCIAL_DOCUMENT_SRV_01'

            iv_entity_type     = 'Item' ).

    lo_header_anno->add_line_item_record( EXPORTING iv_value_property  = 'CustomField'

                                                    iv_label_property  = 'Custom Field

                                                    iv_importance      = 'High' ).
View Entire Topic
0 Kudos

Hi Glady,

have you checked if the metadata of your service is already up-to-date and contains new line item?
You will find a node in the metadata looks something like below, this node will contains the new field you added.

<Annotations xmlns="http://docsoasis-open.org/odata/ns/edm Target="YourEntity">
  <Annotation Term="com.sap.vocabularies.UI.v1.LineItem">
....
  </Annotation>
</Annotations>

If the new field is not there, maybe you have to clean the cache. Some useful transactions and reports for clearing caches:

Clear metadata cache
Transaction /IWFND/CACHE_CLEANUP
Transaction /IWBEP/CACHE_CLEANUP

UI2 Cache:
Report /UI2/INVALIDATE_GLOBAL_CACHES
Report /UI2/INVALIDATE_CLIENT_CACHES

Cheers
Cuong

reachglady
Explorer
0 Kudos

Hi Cuong,

I have my new field in the metadata and the new column is displaying and I set it as default field. The issue is data is not displaying in that column though the data is in OData.

0 Kudos

Could you show me the UI5 code for displaying the smart table?

reachglady
Explorer
0 Kudos

That is standard Fiori Application code. We are not touching that part.

As I mentioned, this is a standard application. Both UI and backend are standard. We just want to bring one additional column to the existing SmartTable. Is it possible to do that without redefining the service or the UI code?

0 Kudos

Hi Glady,

as i understand, you did extend the model without redefining the service.
Did you create a standalone annotation model and reference it to the standard service?

reachglady
Explorer
0 Kudos

Cuong, I extended the standard model with a Post Exit in the existing model class and that's how I could bring the custom field as a new column to the existing SmartTable.

0 Kudos

Hi Glady,

sorry I can not help further. From your comments, everything looks ok to me too.
What I can think of is trying to make sure you had cleaned all the caches (browser and abap system), this is often the cause of the all headaches.
And maybe you look again in the metadata and UI5 code to see if there is any annotation or property which prevents the rendering of displaying the field data. Or, you have to add any annotation or property to make that field data visible.

I hope you find a solution soon.

Cheers
Cuong

reachglady
Explorer
0 Kudos

Thanks Cuong. I'll update if I get a solution for this. Appricieate your help.