Skip to Content
0
Jan 02, 2023 at 08:47 AM

Error- Success- Handling in OData V4 by SubmitBatch - patchCompleted - RESTful ABAP On Premise

260 Views

Hi Experts and happy New Year,

i need your Help! ;-)

Scenario:

1. Upload Excel to Freestyle UI5 App (Table Bound to OData V4 Model) via create Entrys are added to Model. No Backend Call cause GroupId submit API

here the create
 for (const aWorkModelHelperLine of aWorkModelHelperAll) {
                            var oContext = that.getView().byId("idQuotTable").getBinding("items").create(aWorkModelHelperLine);
                        }
here the Manifest
"": {
                "dataSource": "mainService",
                "preload": false,
                "settings": {
                    "synchronizationMode": "None",
                    "operationMode": "Server",
                    "autoExpandSelect": true,
                    "earlyRequests": true,
                    "groupProperties":{
                        "QuotUpdateGroupId" : {"submit" : "API"}
                    },
                    "updateGroupId": "UpdateGroupId"
                }
            },

here the xml

 <Table 
                    id="idQuotTable" 
                    autoPopinMode="true" 
                    items="{ 
                        path : '/ForcQuot',
                        events : {
                            dataReceived : '.onDataEventsReceived',
                            dataRequested : '.onDataEventsRequested',
                            createCompleted : '.onDataCreateCompleted',
                            patchCompleted : '.onPatchCompleted'
                        },
                        parameters : {
                            $$updateGroupId : 'QuotUpdateGroupId'
                        }
                    }"

2. Pressing on Save Button

oView.getModel().submitBatch("QuotUpdateGroupId");

3. here my Behavior Create Class:

i write success and error mesages

    LOOP AT entities INTO DATA(ls_entiti).
      IF ls_entiti-materialgroup = 'CCM'.
            append value #(
            %cid = ls_entiti-%cid
            material = ls_entiti-material
             ) to failed-zi_fcstquot_prep.
      ELSE.

        DATA(success_txt) = ls_entiti-material && 'Toll, das hat geklappt von Luis!'.
        APPEND VALUE #(
        %cid = ls_entiti-%cid
        material = ls_entiti-material
        %msg = new_message_with_text(
            severity = if_abap_behv_message=>severity-success
            text = success_txt
            )
         ) TO reported-zi_fcstquot_prep.

      ENDIF.
    ENDLOOP.

Error:

patchCompleted is not called.

createCompleted is called for every record, and the messages are completely mixed and not matching the number of sent messages from the backend.


Target:

Messages as build in backend shown all collected in one frontend event.

here you can see a screenshot from Backend building messages:

image.png

here you can see a screenshot from frontend in the createCompleted event with the mixed up messages:

image.png

thanks for your Help,

bye Luis

Attachments

image.png (101.9 kB)
image.png (330.4 kB)