메뉴 건너뛰기

SAP 한국 커뮤니티

Ch23. 07번 onCreate 변경

감자깡 2025.09.22 17:57 조회 수 : 1

sap.ui.define([

    "ea/zcertemp/controller/BaseController",

    "sap/m/MessageToast",

    "sap/m/MessageBox"

 

], function (BaseController, MessageBox, MessageToast) {

 

 

...

 

 

 

 

       onCreate: function () {

            const oModel = this.getView().getModel();

            const oSmartForm = this.byId("smartForm");

            if (oSmartForm.check().length > 0)

                return;

 

            oModel.submitChanges({

                success: function (oData, oResp) {

                    const oError = oData.__batchResponses.find(

                        (element) => element.statusCode == undefined

                    );

                    if (oError) {

                        MessageToast.show(JSON.parse(oError.response.body)

                            .error.message.value);

                        return;

                    }

 

                    MessageToast.show("자격증 정보가 성공적으로 생성되었습니다.");

                    this.oDialog.close();

                }.bind(this),

                error: function (oError) {

                    var oMsg = JSON.parse(oError.responseText);

                    MessageBox.error(oMsg.error.message.value);

                }

            });

        },