2017-11-25 18 views
0

배치 레코드를 보낼 수 없습니다. 하지만 매번 단일 엔티티를 추가 할 수 있습니다. 제출할 때 다음 함수를 사용했습니다. // 매번 단일 항목을 만듭니다. onSubmitChanges : 함수() {SAPUI5에서 oData를 사용하여 배치를 작성하는 방법은 매번 단일 레코드를 생성 할 수 있습니다.

 var oSelectedVal = this.getView().byId("plmSelect"), 
      oSelectedVal = oSelectedVal.getSelectedItem().getKey(), 
      oModel = this.getView().getModel(), 
      oEntry = {}; 
     oEntry.MyKeyField1 = oSelectedVal; 
     oEntry.MyEntry1 = globalVariable1; // global variable declared to get values 
     oEntry.MyEntry2 = globalVariable2; 
     oEntry.MyEntry3 = globalVariable3; 
     oEntry.MyEntry4 = globalVariable4; 

     if (oEntry.MyKeyField1 !== "" && oEntry.MyEntry1 !== "" && oEntry.MyEntry2 !== "") { 
      var oContext = oModel.createEntry('/MyEntitySet', { 
       properties: oEntry, 
       success: function() { 
        MessageToast.show("Create successfuly"); 
        // not able to delete/remove after created successfully used the following 

        //oModel.setBindingContext(oContext); 
        //oModel.resetChanges(); 
        //aModel.destroyBindingContext(); 

        /*oModel.updateBindings({ 
         bForceUpdate: true 
        });*/ 
        // oModel.refresh(); 
        //oModel.deleteCreatedEntry(); 
       }, 
       error: function() { 
        MessageToast.show("Create failed"); 
       } 
      }); 
      oModel.submitChanges(); 

      //oModel.refresh(); 

     } else { 
      MessageToast.show("Store Area and Store Description are madatory."); 
     } 
     this.onUpdateFinished(); 
    }, 
+0

게시하기 전에 코드를 정리하십시오. –

+0

질문에 대한 답변이 정말 없습니다. 배치로 무엇을 보내시겠습니까? 지금은 효과가없는 것은 무엇입니까? – luuksen

답변

-1

배치가 허용되지 않습니다. 표를 보내려면 깊은 실체를 사용해야합니다.

+0

정말입니까? 무엇 때문에 허용되지 않습니까? 이전에 UI5에서 배치 요청을 수행했습니다. –

+0

이 답변은 잘못되었습니다. 딥 인서트와 배치를 모두 사용할 수 있습니다. 둘 다 장점/불이익을 가지고 있습니다. – luuksen

+0

안녕하세요 크리스, 아마도 나는 worong이지만 언제 시도 했습니까? 코드를 공유 할 수 있습니까? 왜냐하면 ı 일괄 처리 방법을 구현하면 브라우저에서는 허용되지 않지만 이전 표준 응용 프로그램에서는 사용하고 있기 때문입니다. @ ChrisNeve – Emre