Skip to Content
avatar image
Former Member

Creating a dynamic RFC destination in a BSP?

Hello,

I've been playing around with the webmonitor BSP that comes with the 620 system and I would like to expand it to look at all application instances as well on the system.

I do this now by

CALL FUNCTION 'TH_WPINFO' DESTINATION rfcdest

TABLES

wplist = r3_list.

Given the rfcdest of the server I want to look at. In theory I should be able to give the rfc destination of an application server as well. The question is how can I dynamically create the rfc destination? Not manually create them first.

I do this now to get the list of the servers

CALL FUNCTION 'TH_SERVER_LIST' DESTINATION RFCDEST

TABLES

LIST = tablelist

exceptions

NO_SERVER_LIST = 1.

where tablelist-name is the server names.

Is it possible in a BSP to then take that server name and dynamically create the RFC connection? I do something similiar with JCo and I make my connection to each server dynamically.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Mar 10, 2004 at 04:22 PM

    Hi Craig,

    It is my understanding that you cannot generate RFC destinations in R3 on the fly.

    However, there is a standard RFC entry for each application server, of type Internal.

    For example, if your hostname is "host01", your sid is "B01" and your instance is "00", there is an internal RFC by name host01_B01_00 that you can use.

    The trick is to find out all internal RFC destinations.

    One way could be to read table RFCDES for all entries of type "I" (field RFCTYPE)

    hope this helps.

    cheers,

    Thorsten.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Actual this seems to be working for me...

      Tables: rfcdes.

      DATA: rfcdest LIKE RFCDES-RFCDEST,

      RFC_OPTIONS LIKE RFCDES-RFCOPTIONS,

      RFC_CLIENT LIKE RFCDES-RFCDEST,

      begin of instances occurs 5,

      host(10) type c,

      sysnr(3) type c,

      end of instances.

      instances-host = [HOST NAME].

      instances-sysnr = [SYS NUM].

      append instances.

      loop at instances.

      RFC_OPTIONS = 'H=%HOST,S=%SID,M=%MANDT,U=%USER,L=%LANGU,Z=%PWD,'.

      PERFORM REPLACE_STRING

      USING RFC_OPTIONS '%HOST' instances-host.

      PERFORM REPLACE_STRING

      USING RFC_OPTIONS '%SID' instances-sysnr.

      PERFORM REPLACE_STRING

      USING RFC_OPTIONS '%MANDT' '000'.

      PERFORM REPLACE_STRING

      USING RFC_OPTIONS '%USER' '[USER]'.

      PERFORM REPLACE_STRING

      USING RFC_OPTIONS '%LANGU' 'E'.

      PERFORM REPLACE_STRING

      USING RFC_OPTIONS '%PWD' '[PASS]'.

      RFC_CLIENT = 'IM-CSB_%HOST_%SID_%SYSNR'.

      PERFORM REPLACE_STRING

      USING RFC_CLIENT '%HOST' instances-host.

      PERFORM REPLACE_STRING

      USING RFC_CLIENT '%SID' '[SID]'.

      PERFORM REPLACE_STRING

      USING RFC_CLIENT '%SYSNR' instances-sysnr.

      RFCDES-RFCOPTIONS = RFC_OPTIONS.

      RFCDES-RFCTYPE = '3'.

      RFCDES-RFCDEST = RFC_CLIENT.

      INSERT RFCDES.

      IF SY-SUBRC >< 0.

      write: / 'RFC_ENTRY_EXISTS'.

      exit.

      ENDIF.

      ************************************************************************

      • Verify new desitnation is active

      ************************************************************************

      call function 'RFC_PING' destination rfc_client

      EXCEPTIONS

      communication_failure = 1 message msg_text

      system_failure = 2 message msg_text.

      write: / 'Result: '.

      write: SY-SUBRC.

      delete from rfcdes where rfcdest = RFC_CLIENT.

      ENDLOOP.