如何获取最佳实践CRUD的POST数据(更新)

时间:2016-02-24 07:56:44

标签: sap sapui5 hana

我们想要更新/编辑客户的数据。所以我们已经从示例中尝试了原始代码。该示例工作正常,但我们通常必须先检查UserInputs,然后再将其写入数据库。这是我的代码:

    /**
     * Event handler (attached declaratively) for the view save button. Saves the changes added by the user.
     * @function
     * @public
     */
    onSave: function() {
        var that = this,
            oModel = this.getModel();

        // abort if the  model has not been changed
        if (!oModel.hasPendingChanges()) {
            MessageBox.information(
                this._oResourceBundle.getText("keine Änderungen"), {
                    id: "noChangesInfoMessageBox",
                    styleClass: that.getOwnerComponent().getContentDensityClass()
                }
            );
            return;
        }
        this.getModel("appView").setProperty("/busy", true);
        if (this._oViewModel.getProperty("/mode") === "edit") {
            // attach to the request completed event of the batch
            oModel.attachEventOnce("batchRequestCompleted", function(oEvent) {
                var oParams = oEvent.getParameters();
                if (oParams.success) {
                    that._fnUpdateSuccess();
                } else {
                    that._fnEntityCreationFailed();
                }
            });
        }
        oModel.submitChanges();
    },

我如何访问REQUEST数据?我试图查看oModel DOM,但只找到了aBindings,那里有很多无用的东西。即使window.location.search也不是解决方案。

1 个答案:

答案 0 :(得分:0)

我们已经修好了。

只需使用StructField("RT", StringType,nullable = true) :: StructField("SERIALNO", StringType,nullable = true) :: StructField("SPORDER", StringType,nullable = true) :: // ... remaining 200+ columns

即可