2017-10-19 10 views
0

チェックボックスをオンにしてoDataを作成しようとしましたが、次のエラーが表示されます。これがフロントエンドかバックエンドのABAPの問題であるかどうかは分かりませんが、この同じ機能が別のプロジェクトで機能しているためです。SAPUI5 oData POST 500エラー

作成部分には不具合がありますが、不思議なことに、SiteId、ArticleNumber、VarianceDate &の詳細を引き続き通過しています。

console log error

gui error log

// Set CheckBox status, X for true, blank for false 
    onVarianceChecked: function (oEvent) { 
     var oEntry = {}; 

     var bindingContext = oEvent.getSource().getBindingContext(this.MODEL_VIEW); 
     var path = bindingContext.getPath(); 
     var object = bindingContext.getModel("SI").getProperty(path); 

     // Pass in the Header fields 
     oEntry.SiteId = this.SiteId; 
     oEntry.ArticleNumber = object.ArticleNumber; 
     oEntry.VarianceDate = moment(new Date(object.VarianceDate)).format('YYYY-MM-DDTHH:mm:ss'); 

     // Set X or blank 
     if (oEvent.getParameter("selected") === true) { 
      oEntry.Confirmed = "X"; 
     } else { 
      oEntry.Confirmed = ""; 
     } 

     // Do the create 
     var oModel = this.getView().getModel("SI"); 
     oModel.create("/VarianceHeaderSet", oEntry, { 
      success: function() { 
       console.log("Variance confirmed"); 
       MessageToast.show("Variance confirmed", { 
        duration: 1000 
       }); 
      }, 
      error: function (oError) { 
       console.log("Error, variance could not be confirmed"); 
       MessageToast.show("Error, variance could not be confirmed", { 
        duration: 1000 
       }); 
      } 
     }); 
    } 

答えて

1

'000000000' は、あなたがNULL可能ではないとDateTimeプロパティをモデル化しているとき、したがって、それは失敗し、Edm.DateTimeの初期値です。

SEGWに移動し、プロパティを "nullable"に変更するか、POSTで常に正しいDateを指定してください。

+0

ご返信ありがとうございます。私は明日ABAPの開発者に言及します。私はUI5のフロントエンドの人です。 これに似た回答がありましたが、私のABAPの人はそれを設定できませんでしたそれは主キーだったのでnullable?理由は分かりませんが、それは私が彼と一緒に迎えに行くものです。ありがとう。 – Scott

+0

@Scottキーフィールドをnullableに設定することはできません。フロントエンドで日付フィールドを検証する必要があります。また、バックエンドに渡すときにデフォルトの日付値を送信できます。 –

関連する問題