Skip to Content
author's profile photo Former Member
Former Member

Connect to R/3 with the connector framework

Hi,

I am trying to call a RFC function from R/3 using the new connector framework instead of JCO.

However, I'm not quite sure how to create complex data type for the input parameters. I get the parameter structure but I don't know how to create the IRecordSet object to send in the input parameters record.

Any help would be appreciated.

Thank you.

Regards,

Rui Gonçalves

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Dec 21, 2003 at 06:37 PM

    Check the JCO examples.

    It is the same. Sap CF just offers the connection management.

    BR,

    Oliver

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Sure...

      public static IConnection getConnection(String sapSystemAlias,

      IPortalComponentRequest componentRequest)

      throws IllegalArgumentException {

      // check if passed attributes are null

      if (componentRequest == null) { throw new IllegalArgumentException(

      "IComponentRequest object can not be null!"); }

      if (sapSystemAlias == null) {

      // use default system alias

      //sapSystemAlias = defaultSAPSystemAlias;

      }

      ILogger logger = PortalLog.getLogger();

      com.sap.security.api.IPrincipal user = componentRequest.getUser();

      Locale locale = componentRequest.getLocale();

      ConnectionProperties properties = new ConnectionProperties(locale, user);

      IConnection connection = null;

      try {

      IConnectorGatewayService connectorGatewayService = (IConnectorGatewayService) PortalRuntime

      .getRuntimeResources().getService(IConnectorService.KEY);

      connection = connectorGatewayService.getConnection(sapSystemAlias,

      properties);

      } catch (Exception e) {

      logger.severe(e, "Exception while creating a connection.");

      }

      return connection;

      }

      It makes also sense to have a central method to close connections...

      public static boolean closeConnection(IConnection connection) {

      boolean succesful = false;

      if (connection != null) {

      try {

      connection.close();

      succesful = true;

      } catch (ResourceException re) {

      PortalLog.getLogger().severe(re,

      "Connection to SAP could not be closed!");

      }

      }

      return succesful;

      }

      and interactions...

      public static boolean closeInteraction(IInteraction interaction) {

      boolean success = false;

      if (interaction != null) {

      try {

      interaction.close(); // close interaction

      success = true;

      } catch (Exception e) {

      String message = "Exception closing interaction.";

      PortalLog.getLogger().severe(e, message);

      }

      }

      return success;

      }

      Regards,

      Kai

      Message was edited by: Kai

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.