0
votes

We are developing an SAP Fiori App to be used on the Launchpad and as an offline-enabled hybrid app as well using the SAP SDK and its Kapsel Plug Ins. One issue we are facing at the moment is the ODATA message handling.

On the Gateway, we are using the Message Manager to add additional information to the response

" ABAP snippet, random Gateway entity method
[...]
DATA(lo_message_container) = me->mo_context->get_message_container( ).
lo_message_container->add_message(
  iv_msg_type = /iwbep/cl_cos_logger=>warning
  iv_msg_number = '123'
  iv_msg_id = 'ZFOO'
).

" optional, only used for 'true' errors
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
  EXPORTING
    message_container = lo_message_container.

In the Fiori app, we can directly access those data from the message manager. The data can be applied to a MessageView control.

// Fiori part (Desktop, online)
var aMessageData = sap.ui.getCore().getMessageManager().getMessageModel().getData();

However, our offline app always has an empty message model. After a sync or flush, the message model is always empty - even after triggering message generating methods in the backend. The only way to get some kind of messages is to raise a /iwbep/cx_mgw_busi_exception and pass the message container. The messages can be found, in an unparsed state, in the /ErrorArchive entity and be read for further use.

// Hybrid App part, offline, after sync and flush
this.getModel().read("/ErrorArchive", { success: .... })

This approach limits us to negative, "exception worthy", messages only. We also have to code some parts of our app twice (Desktop vs. Offlne App).

So: Is there a "proper" to access those messages after an offline sync and flush?

1
Good luck getting help with the Kapsel plugin... I remember struggling for months. The documentation is really basic and there's little else to go on.Chris Neve
Thank you, the development has been quite unpleasend so far...SDD64
I also think that the ErrorArchive is the only way to get the messages that occured during the sync. The Kapsel odata plugin is independent of SAPUI5 and does not integrate with the message model directly. Nevertheless, you could parse those errors in the ErrorArchive and add them manually to the MessageModel.pguddi
Have you tried to add iv_add_to_response_header = abap_true to add_message()? Maybe it will help to pipe also warnings and infos into/ErrorArchive entitySuncatcher

1 Answers

0
votes

For analyzing the issue, you might use the tool ILOData as seen in this blog: Step by Step with the SAP Cloud Platform SDK for Android — Part 6c — Using ILOData

Note, ILOData is part of the Kapsel SDK, so while the blog above was part of a series on the SAP Cloud Platform SDK for Android, it also applies to Kapsel apps. ILOData is a command line based tool that lets you execute OData requests and queries against an offline store. It functions as an offline OData client, without the need for an application. Therefore, it’s a good tool to use to test data from the backend system, as well as verify app behavior. If a client has a problem with some entries on their device, the offline store from the device can be retrieved using the sendStore method and then ILOData can be used to query the database.

This blog about Kapsel Offline OData plugin might also be helpful.