• JCO事务管理


    /*
    * 标准对账单过账
    * @account 标准对账单号
    * @year 年度
    */
    public List<String> doAccountStatmentPost(String account,String year) throws JCoException{
    JCoDestination destination = JCOUtil.getDestination();
    JCoFunction function = destination.getRepository().getFunction("BAPI_INCOMINGINVOICE_POST");
    if (function == null) {
    throw new RuntimeException("BAPI_INCOMINGINVOICE_POST not found in SAP.");
    }
    //设置参数-对账单号
    function.getImportParameterList().setValue("INVOICEDOCNUMBER", account);
    //设置参数-年度
    function.getImportParameterList().setValue("FISCALYEAR", year);
    //<开始SESSION>
    JCoContext.begin(destination);
    //调用函数
    function.execute(destination);
    JCoTable jcoTable1 = function.getTableParameterList().getTable("RETURN");
    List<String> errorMessages = new ArrayList<String>();
    for (int i = 0; i < jcoTable1.getNumRows(); i++) {
    jcoTable1.setRow(i);
    errorMessages.add("TYPE:"+jcoTable1.getString("TYPE")+" MESSAGE:"+jcoTable1.getString("MESSAGE"));
    }
    if(jcoTable1.getNumRows()==0){
    JCoFunction function2 = destination.getRepository().getFunction("BAPI_TRANSACTION_COMMIT");
    function2.getImportParameterList().setValue("WAIT", "X");
    function2.execute(destination);
    }
    //<结束SESSION>
    JCoContext.end(destination);
    return errorMessages;
    }
    /*

  • 相关阅读:
    winform中主窗体可以实现拖动代码
    winform中自定义窗体启动位置
    winform中启动登陆窗体,登陆成功后登陆窗体自动销毁
    winform中隐藏窗体边框
    作业2
    画图
    作业
    day01
    java.String中的方法
    网站的内链反链黑链
  • 原文地址:https://www.cnblogs.com/zfswff/p/5671150.html
Copyright © 2020-2023  润新知