使用DI SDK更改SAP B1中生产订单的到期日期

时间:2016-09-06 11:48:04

标签: c# sdk sap sapb1

我正在尝试使用以下代码更改/更新SAP B1中生产订单的到期日期:

CREATE OR REPLACE PROCEDURE comentar_evento
(
    id_usuario IN NUMBER, 
    id_lugar IN NUMBER, 
    nombre_evento IN VARCHAR2, 
    comentario IN VARCHAR2
)
IS
otag VARCHAR2(50); 
ctag VARCHAR2(50);
xmlPath VARCHAR2(50);
xpEnd VARCHAR2(50);
ag XMLType;
v_result xmltype;
BEGIN
    otag := '<comentario>';
    ctag := '</comentario>';
    xmlPath := '/agenda/evento/[nombre_evento="';
    xpEnd := '"]/comentarios';
    xmlPath := xmlPath || nombre_evento || xpEnd;

    SELECT agenda INTO ag FROM usuario WHERE id = id_usuario;

    v_result := insertChildXML(ag, xmlPath, 'comentario', otag || comentario || ctag);
END;
/

但是,我收到以下错误:

  

更改&#39; 145&#39;的截止日期时出错到&#39; 11-09-2016&#39;,出现以下错误&#39;字段无法更新(ODBC -1029)&#39;。

SAP给出的错误是:

  

无法更新字段(ODBC -1029)

其他信息:

  • 这是一个状态为public static void ChangeDueDateForProductionOrder(SAPB1Credentials credentials, int poAbsEntry, DateTime dueDate) { DebugLogger.Log(credentials.CompanyDB, $"Changing due date for production order '{poAbsEntry}' to '{dueDate.ToString(C_DATE_FORMAT_NL)}'."); using (var sap = new SAPB1Connection(credentials)) { ProductionOrders productionOrder = sap.Company.GetBusinessObject(BoObjectTypes.oProductionOrders); if(productionOrder.GetByKey(poAbsEntry)) { productionOrder.DueDate = dueDate; if (productionOrder.Update() != 0) { var message = $"Error while changing due date for '{poAbsEntry}' to '{dueDate.ToString(C_DATE_FORMAT_NL)}', the following error is given '{sap.Company.GetLastErrorDescription()}'."; DebugLogger.Log(credentials.CompanyDB, message); throw new Exception(message); } } else throw new Exception($"PoId '{poAbsEntry}' does not exists."); } } 的新生产订单。
  • 创建日期为Planned
  • 截止日期我正在尝试将其更改为Today
  • 生产订单的ID(AbsEntry)为Today + 5 days
  • SAP Business One 9.1
  • 是的,我可以毫无问题地更改SAP B1 GUI中的截止日期。

短,自包含,正确(可编译),示例

下面的代码给出了完全相同的错误。用145替换了连接设置。

??

我错过了什么,为什么会收到此错误?

1 个答案:

答案 0 :(得分:0)

来自评论中链接的 SAP 线程。

艾迪西蒙说:

<块引用>

嗨,拉斯,

一定是补丁级别的错误。

我可以使用您的代码在 SBO 881PL6 上更新它。

您可能想在另一个版本上测试它。

问候

艾迪

解决了这个问题。