为了账号安全,请及时绑定邮箱和手机立即绑定

这个要怎么new呢?

这个要怎么new呢?

函数式编程 2022-09-02 18:14:01
private JCoTable table = (JCoTable) new HashMap();我想new一个JCoTable ,可是直接JCoTable table = new JCoTable()是不行的,
查看完整描述

2 回答

?
富国沪深

TA贡献1790条经验 获得超9个赞

Properties logonProperties = new Properties();
logonProperties.put("jco.client.ashost", "10.10.11.22");
logonProperties.put("jco.client.client", "100");
logonProperties.put("jco.client.sysnr", "01");
logonProperties.put("jco.client.user", "username");
logonProperties.put("jco.client.passwd", "password");

File file = new File("sapconnection.jcoDestination");
FileOutputStream stream = new FileOutputStream(file, false);
logonProperties.store(stream, "SAP connection properties");
stream.close();
JCoDestination destination = JCoDestinationManager.getDestination("sapconnection");
JCoRepository repository = destination.getRepository();
JCoFunction function = repository.getFunction("Z_SD_XXXX");
JCoParameterList list = function.getImportParameterList();

//设置输入参数
list.setValue("PLANT", "1000");
...

function.execute(destination);
JCoTable rs = function.getTableParameterList().getTable("TABLE_HEAD");

//获取输出
List<HeadBean> sh = new ArrayList<HeadBean>();
for (int i = 0; i < rs.getNumRows(); i++) {
rs.setRow(i);
HeadBean s = new HeadBean();
s.setCompanyCode(rs.getString("COMPANY_CODE"));
s.setSalesOrg(rs.getString("SALES_ORG"));
...
sh.add(s);
}


查看完整回答
反对 回复 2022-09-06
?
人到中年有点甜

TA贡献1895条经验 获得超7个赞

用JCO.createTable,构造函数是不可见的。

查看完整回答
反对 回复 2022-09-06
  • 2 回答
  • 0 关注
  • 270 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信