Skip to Content
Jan 11, 2018 at 01:53 PM

How to implement an confirmation dialog send by the OData backend in SAPUI5?


Hello everyone,

I'm currently working on a timekeeping app in SAPUI5. Now I'm planning to show a warning if an employee enters a value > 7.5 for his daily working hours. My question regarding this is how i can achieve this in the best way possible?

Currently i check the following in the CREATE_ENTITY method in the odata service:

 SELECT SUM( wrkhrs )
      INTO lv_sum_wrkhrs
      WHERE uname = ls_timesheet-uname
      AND wrkdat = ls_timesheet-wrkdat.

IF ( sy-subrc = 0 AND lv_sum_wrkhrs + ls_timesheet-wrkhrs > max_wrkhrs ).
        iv_msg_type = 'W'
        iv_msg_id = 'BUSINESS_WARNING'
        iv_msg_number = '008'
        iv_msg_text = text-008

So I can display a warning on the client but how can i react according to his answer from the confirm dialog?

I thought of an additional parameter "skipWrkhrsWarning" i pass to the call of the create() method of sap.ui.model.odata.v2.ODataModel and check this parameter in the CREATE_ENTITY method. But I don't know if this is the right approach nor how to do it.

I'm glad for any kind of help!

Kind regards,