0

I'm afraid this is a very simple question. It might be too easy to be asked here, but I can't figure this out on my own and I just want to know.

It is about oDataModel and the methods "create" and "update". In Demo Kit I find the interface as follows:

create(sPath, oData, mParameters?) : object

update(sPath, oData, mParameters?) : object

The description of "oData" says in both methods "Data of the entry that should be created/updated."

So I understand that oData is exactly one data record. And in SAP in the corresponding method (e.g. StorageUnitSet_Update_Entity) I can read this single record with the method in ABAP:

CALL METHOD io_data_provider->read_entry_data
  IMPORTING
    es_data = ls_data.

Is there a common way to pass more than one record?

In my case I have a simple table with only one column containing storage units. By pressing "save" those shall be created in backend system. Now I am not sure if I loop my table and pass every single storage unit and call this "create method" for each entry. Or I could write all storage units into a long string and pass this one string just once. But if there is a "more correct" way to handle this, I would love to know it.

Here is a little bit code. I tried to minimize it to the necessary:

sap.ui.define([
    "xxx/namespace/controller/BaseController",
    "sap/ui/model/resource/ResourceModel",
    "sap/ui/model/json/JSONModel",
    "sap/ui/core/ValueState"
], function (BaseController, ResourceModel, JSONModel, ValueState) {
    "use strict";

    return BaseController.extend("xxx.namespace.controller.iPunkt01", {

        onInit: function () {

            
            this._data = {
                LePool: [ {lenum: "123456"},
                    {lenum: "234567"},
                    {lenum: "234567"}
                    ]
            };

            this.jModel = new sap.ui.model.json.JSONModel();
            this.jModel.setData(this._data);

            // bind table
            this.byId("ins").setModel(this.jModel);

        },
        
        onStartVert: function () {
            // call oData Method create 
            
        },
    });
});

And here is the XML:

<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:f="sap.f" xmlns:l="sap.ui.layout"
    controllerName="xxx.namespace.controller.iPunkt01" xmlns:html="http://www.w3.org/1999/xhtml" id="iPunkt01">
    <App>
        <pages>
            <Page title="i - Punkt">
                <content>
                    <Label text="Lagereinheit" labelFor="lenum"/>
                    <Input id="lenum" editable="true" submit="onSubmit"/>
                    <Table id="ins" items="{/LePool}">
                        <columns>
                            <Column width="50px"/>
                            <Column>
                                <Text text="LE Pool"/>
                            </Column>
                        </columns>
                        <items>
                            <ColumnListItem>
                                <cells>
                                    <Button icon="sap-icon://delete" press="onDeleteRow" type="Reject"/>
                                    <Text id="lenumCell" text="{lenum}"/>
                                </cells>
                            </ColumnListItem>
                        </items>
                    </Table>
                    <l:HorizontalLayout>
                        <Button text="Zurück" icon="sap-icon://nav-back" press="onNavBack"/>
                        <Button text="Start Verteilung" icon="sap-icon://share-2" press="onStartVert"/>
                    </l:HorizontalLayout>
                </content>
            </Page>
        </pages>
    </App>
</mvc:View>

1 Answer 1

0

Hey you could work with batch. In the Backend tho every Request will be handled on it's own.

Here are some Tutorials how to pass multiple Requests:

If you want to access all Data at the same Time in the Backend you could work with an **DEEP_INSERT **.

2
  • Thank you very much. I will check this.
    – Julia
    Jul 17, 2020 at 10:03
  • Thank, I chose the batch version :) is it not possible to debug in ABAP when running the method "SubmitChanges" in batch request? I cannot even debug the success and error events in WebIDE after "SubmitChanges" ran. Is this correct or am I doing something wrong?
    – Julia
    Jul 24, 2020 at 5:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.