JCo3.0调用SAP函数的过程
大致可以总结为以下步骤:
- 连接至SAP系统
- 创建JcoFunction接口的实例(这个实例代表SAP系统中相关函数)
- 设置importing参数
- 调用函数
- 从exporting参数或者table参数获取数据
代码:
代码语言:javascript复制package jco3.demo4;
import org.junit.Test;
import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoDestinationManager;
import com.sap.conn.jco.JCoException;
import com.sap.conn.jco.JCoField;
import com.sap.conn.jco.JCoFunction;
import com.sap.conn.jco.JCoRepository;
import com.sap.conn.jco.JCoStructure;
public class RFC
{
public void getCompanyCodeDetail(String cocd) throws JCoException
{
// JCoDestination instance represents the backend SAP system
JCoDestination dest = JCoDestinationManager.getDestination("ECC");
// JCoFunction instance is the FM in SAP we will use
JCoRepository repository = dest.getRepository();
JCoFunction fm