从SAP通过JCO调用Java程序(1)-配置

本文介绍了如何从SAP通过JCO(Java Connector)调用Java程序。首先,需要查询SAP网关服务,然后配置RFC终点,包括设置RFC Destination、选择激活类型和填写Program ID。接着启动Java JCO Server,并在SAP中测试连接以确保配置成功。最后,提供了一个SAP JCO的示例代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 查询SAP网关和网关TCP服务调用事务SMGW
菜单GOTO-PARAMETERS-DISPLAY,在Attributes中找到如下参数对:
gateway hostname        hostabc
gateway service            sapgw00
2. 配置RFC终点
调用事务SM59
点击“创建”按钮
RFC Destination:用户定义RFC名
连接类型:T (TCP连接)
说明:自己输入
技术设置:
    Activation Type,选取Registered Server Program
Program ID,为JCO服务器中所输入的ProgramID,如JCOServer01
Gateway Options:
    网间主机名:取上一步gateway hostname参数
    TCP服务:取上一步gateway service参数
3. 保存参数,不要退出此界面
4. 启动你所写的Java JCO Server程序(命令行形式,程序代码附后)
5. 在SAP此界面中点击“测试连接”,如没有红字应是连接成功。
示例代码(SAP JCO Demo程序)

 

package jco1;

/**
 * Example5.java - Simple implementation of an (external RFC) server. This example is based on
 * static metadata with non-unicode layout, so the calls only from non-unicode systems can be
 * handled.
 * Property of SAP AG, Walldorf
 * (c) Copyright SAP AG, Walldorf, 2000-2003.
 * All rights reserved.
 */
import com.sap.mw.jco.*;

/**
 * @version 1.0
 * @author  SAP AG, Walldorf
 */

//******************************************************************************
public class Example5 implements JCO.ServerExceptionListener, JCO.ServerStateChangedListener {
//******************************************************************************

  /**
   *  Implementation of our own repository.
   *  Just dummy extend the basic repository that comes with the JCO package
   */
  static public class Repository extends JCO.BasicRepository implements IRepository {

    /**
     * Creates a new empty repository
     */
    public Repository(String name)
    {
      super(name);
    }
  }

  /** The repository we gonna be using */
  protected static IRepository repository;

  static {

    repository = new Reposi

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值