我正在使用全栈式Web IDE创建一个简单的表单,该表单将过帐561个初始库存货物移动。我不确定我绑定中缺少什么。控制器似乎在执行应有的操作,但是生成的JSON不正确。
正确的JSON看起来像这样:
{
"PostingDate": "2018-08-27T00:00:00",
"GoodsMovementCode": "05",
"to_MaterialDocumentItem": [{
"Material": "MZ-FG-E11",
"Plant": "1710",
"StorageLocation": "171A",
"GoodsMovementType": "561",
"Batch" : "0000000013",
"QuantityInEntryUnit": "12",
"ShelfLifeExpirationDate":"2018-08-27T00:00:00",
"ManufactureDate": "2018-05-27T00:00:00"
}]
}
我在网络视图中的摘录如下:
<f:SimpleForm class="editableForm" columnsL="1" columnsM="1" editable="true" emptySpanL="4" emptySpanM="4" id="newEntitySimpleForm" labelSpanL="3" labelSpanM="3" layout="ResponsiveGridLayout" maxContainerCols="2" minWidth="1024" title="{= ${viewModel>/mode} === 'edit'? 'Edit API_MATERIAL_DOCUMENT_SRV': 'New API_MATERIAL_DOCUMENT_SRV'}">
<f:content>
<Label text="Posting Date" required="false"/>
<DatePicker name="PostingDate" value="{ path: 'PostingDate', type: 'sap.ui.model.type.DateTime'}" id="PostingDate_id" enabled="true" visible="true"/>
<Label text="Goods Movement Code" required="false"/>
<Input name="GoodsMovementCode" id="GoodsMovementCode_id" valueLiveUpdate="true" liveChange="_validateSaveEnablement" enabled="true" visible="true" value="{ path: 'GoodsMovementCode', type: 'sap.ui.model.odata.type.String' , constraints:{ maxLength:2 } }"/>
<Label text="Material" required="true"/>
<Input name="Material" id="MaterialDocument_id" valueLiveUpdate="true" liveChange="_validateSaveEnablement" enabled="{= ${viewModel>/mode} === 'edit'? false: true}" visible="true" value="{ **path: 'to_MaterialDocumentItem>Material'** , type: 'sap.ui.model.odata.type.String' , constraints:{ maxLength:10, nullable:false } }" cd:w5g.dt.context="/A_MaterialDocumentItem"/>
<Label text="Plant" required="false"/>
<Input name="Plant" id="Plant_id" valueLiveUpdate="true" liveChange="_validateSaveEnablement" enabled="true" visible="true" value="{ path: 'Plant', type: 'sap.ui.model.odata.type.String' , constraints:{ maxLength:2 } }"/>
测试此表单时,我从chrome开发人员工具收到以下信息,错误400错误请求:
PostingDate: "/Date(1536642000000)/", GoodsMovementCode: "1",…}
Batch:"7"
GoodsMovementCode:"1"
GoodsMovementType:"5"
Plant:"3"
PostingDate:"/Date(1536642000000)/"
QuantityInEntryUnit:"6"
StorageLocation:"4"
__metadata:
{type: "API_MATERIAL_DOCUMENT_SRV.A_MaterialDocumentHeaderType",…}
type:"API_MATERIAL_DOCUMENT_SRV.A_MaterialDocumentHeaderType"
uri:"/My187/sap/opu/odata/sap/API_MATERIAL_DOCUMENT_SRV/A_MaterialDocumentHeader('id-1536693644259-199')"
我的问题是: