首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >HANA Express XSODATA更新操作错误

HANA Express XSODATA更新操作错误
EN

Stack Overflow用户
提问于 2018-04-11 21:04:12
回答 1查看 1.3K关注 0票数 2

我有一个带有XSA的服务器,我创建了一个包含DB和NodeJS模块的MTA应用程序,在NodeJS模块中我创建了一个连接到DB模块的.xsodata。

XSOdata定义:

代码语言:javascript
复制
service {
    //Definición de servicios
    "SISGASTOS"."CATEGORIA" as "Categoria"
        create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_categoria");
    "SISGASTOS"."ESTADO" as "Estado"
        create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_estado");
    "SISGASTOS"."PROYECTO" as "Proyecto"
        create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_proyecto");
    "SISGASTOS"."TIPO_DOCUMENTO" as "TipoDoc"
        create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_tipo_documento");
    "SISGASTOS"."INFORME" as "Informe" 
        navigates ("Informe_Comentario" as "Comentarios", "Informe_Proyecto" as "Proyecto", "Informe_Estado" as "Estado","Informe_Gasto" as "Gastos", "Informe_Hist" as "Info_Historial")
        create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_informe");
    "SISGASTOS"."HIST_INFORME" as "Hist_Informe"
        navigates ("Hist_Informe_Estado" as "Estado")
        create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_hist_informe");
    "SISGASTOS"."COMENTARIO_INFORME" as "ComentarioInforme";
//      create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_comentario_informe");
    "SISGASTOS"."GASTO" as "Gasto" 
        navigates ("Gasto_Categoria" as "Categoria", "Gasto_TipoDoc" as "TipoDoc", "Gasto_Estado" as "Estado", "Gasto_Comentario" as "Comentarios", "Gasto_Anexo" as "Anexos", "Gasto_Hist" as "Gasto_Historial")  
        create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_gasto");
    "SISGASTOS"."HIST_GASTO" as "Hist_Gasto"
        navigates ("Hist_Gasto_Estado" as "Estado")
        create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_hist_gasto");
    "SISGASTOS"."COMENTARIO" as "Comentario"
        create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_comentario");
    "SISGASTOS"."ANEXO" as "Anexo"
        create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_anexo");

    //Asociacion Historiales
    association "Hist_Gasto_Estado"
        principal "Hist_Gasto"("ID_ESTADO") multiplicity "1"
        dependent "Estado"("ID_ESTADO") multiplicity "1";
    association "Hist_Informe_Estado"
        principal "Hist_Informe"("ID_ESTADO") multiplicity "1"
        dependent "Estado"("ID_ESTADO") multiplicity "1";

    //Asociacion Informe    
    association "Informe_Comentario"
        principal "Informe"("ID_INFORME") multiplicity "1"
        dependent "ComentarioInforme"("ID_INFORME") multiplicity "*";
    association "Informe_Proyecto" 
        principal "Informe"("ID_PROYECTO") multiplicity "1" 
        dependent "Proyecto"("ID_PROYECTO") multiplicity "1";
    association "Informe_Estado" 
        principal "Informe"("ID_ESTADO") multiplicity "1" 
        dependent "Estado"("ID_ESTADO") multiplicity "1";
    association "Informe_Gasto" 
        principal "Informe"("ID_INFORME") multiplicity "1" 
        dependent "Gasto"("ID_INFORME") multiplicity "*";
    association "Informe_Hist"
        principal "Informe"("ID_INFORME") multiplicity "1" 
        dependent "Hist_Informe"("ID_INFORME") multiplicity "*";

    //Asociación Gasto
    association "Gasto_Categoria" 
        principal "Gasto"("ID_CATEGORIA") multiplicity "1" 
        dependent "Categoria"("ID_CATEGORIA") multiplicity "1";
    association "Gasto_TipoDoc" 
        principal "Gasto"("ID_TIPO_DOCUMENTO") multiplicity "1" 
        dependent "TipoDoc"("ID_TIPO_DOCUMENTO") multiplicity "1";
    association "Gasto_Estado" 
        principal "Gasto"("ID_ESTADO") multiplicity "1" 
        dependent "Estado"("ID_ESTADO") multiplicity "1";   
    association "Gasto_Comentario" 
        principal "Gasto"("ID_GASTO") multiplicity "1" 
        dependent "Comentario"("ID_GASTO") multiplicity "*"; 
    association "Gasto_Anexo" 
        principal "Gasto"("ID_GASTO") multiplicity "1" 
        dependent "Anexo"("ID_GASTO") multiplicity "*";
    association "Gasto_Hist"
        principal "Gasto"("ID_GASTO") multiplicity "1" 
        dependent "Hist_Gasto"("ID_GASTO") multiplicity "*";
}

我们使用更新操作从SAPUI5应用程序调用服务。

代码语言:javascript
复制
        submitChanges: function() {
        this.getView().getModel("oModelDialogo").setProperty("/busy", true);
        this.getView().getModel().submitChanges({
            success: function(oResult) {
                this.getView().getModel("oModelDialogo").setProperty("/busy", false);
                console.log(oResult);
            }.bind(this),
            error: function(oError) {
                this.getView().getModel("oModelDialogo").setProperty("/busy", false);
                console.log(oError);
            }.bind(this)
        });
    },

但答复没有执行501:

代码语言:javascript
复制
--batch_1523471867867_0
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 501 Not Implemented
Content-Type: application/json;charset=utf-8

{"error":{"code":501,"message":{"lang":"en-US","value":"Not implemented"}}}

读取、创建和删除操作工作正常,只有更新操作有问题。

编辑:

作为0x17推荐,我将清单文件中的defaultUpdateMethod更改如下:

代码语言:javascript
复制
    "models": {
        "i18n": {
            "type": "sap.ui.model.resource.ResourceModel",
            "settings": {
                "bundleName": "Adjuntos.i18n.i18n"
            }
        },
        "": {
            "dataSource": "mainService",
            "preload": true,
            "settings": {
                "defaultBindingMode": "TwoWay",
                "defaultUpdateMethod": "sap.ui.model.odata.UpdateMethod.Put"
            }
        }
    },

这样,更新请求就能工作了!谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-04-15 05:07:16

你能不能。检查更新操作期间发送的完整请求头?我想,如果请求方法被设置为合并,这可能会发生。

我假设您正在使用OData V2 Model在ui5应用程序中。但是,在HANA xsa版本的(基于Cloudfoundry的) OData V2 API中,默认情况下不支持合并。

您可以将defaultUpdateMethod设置为“放入”(在manifest.json中)然后再试一次吗?您还可以在控制器代码中更改相同的内容,如下所示

SCP与SAP (基于cloudfoundry)中的OData v2 API有细微的区别。对于V2 API,后者不像前者那么健壮,但它正在慢慢倾向于使用OData V4 API(这很好)。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49784435

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档