Introduction:
    tclsap is a set of extensions to basic tcl and tk. The command 
    extensions allow interactive or script based access to an 
    SAP R/3 system through RFC calls. 

    There were two primary reasons that tclsap was developed. First 
    was an effort to not require the use of C for all interface
    activities, and second was a desire to be able to quickly make 
    changes to interfaces and immediately see the result. A result 
    is the capability to, at least outside of SAP to fairly quickly 
    put together interface programs for a variety of short term 
    needs.

    A secondary purpose in the development of tclsap was to have a 
    mechanism by which CGI-BIN access to SAP systems could be 
    provided, without being required to use C. An example of this 
    is included in the distribution package.

    While the tclsap extensions have been implemented on HP Unix 
    systems, there is no reason to believe that they would not work 
    on any Unix system where the SAP RFC library is available. 
    It is possible that tclsap may also work on MS-DOS and 
    MS-Windows systems. At present, the author does not plan to 
    explore this avenue.

    tclsap is based on tcl release 7.4 and tk release 4.0. No 
    attempt was made to provide compatibility with earlier 
    versions of tcl/tk. tclsap requires a copy of the SAP RFC 
    library for the target computer system.

    Note: 1) The SAP libraries area apparently compiled with 
             debugging flags set. You may wish to run strip 
             before installing the executables.
          2) The SAP libraries are static only.
          3) tclsap is coded to require a sideinfo file. 
             Code changes to Sap_Open.c are required if this is 
             to be changed.
         
    The author makes no claims to competence in either tcl or tk. 
    The example scripts shown almost certainly do not reflect an 
    accomplished level of tcl/tk expertise. The author's first 
    tcl efforts were after the tcl extensions were written (to test
    the extensions - of course :-) and these scripts are included 
    with the distribution.

Distribution Components:
    The components of tclsap extension:
        Makefile, Sap_CallRX.c, Sap_Ckerr.c, Sap_Header.h, 
        Sap_Help.c, Sap_Open.c, Sap_RFCPing.c, Sap_Systeminfo.c, 
        tclInvoke.c, tclMain.c and tkCustomMain.c
        
    Sample scripts:  
        ItemInfo.tk - Example of a login, parameter transmission 
                      and return of data from SAP. Appears in an 
                      X window.
        Sap_Info.tk - Example of a login and execution and return 
                      from the SAP RFC_SYSTEM_INFO ABAP/4 RFC. 
                      This is to an X window.
        Sap_System_Info.tcl - Script is given the login parameters 
                      and returns the result of the SAP 
                      RFC_SYSTEM_INFO ABAP/4 RFC. 
                      The return is to STDOUT.
        Sap_System_Info_Www.html
        Sap_System_Info_Www.tcl - These two scripts are the FORM 
                      input and the CGI_BIN scripts to make 
                      available the SAP RFC_SYSTEM_INFO ABAP/4 RFC 
                      results to a WWW browser. As implemented, 
                      the WWW user must login to the SAP system. 
                      This could be changed if desired.
                      
    Documentation and miscellaneous
        README - This file
        sideinfo - example of a SAP side info file. 
  
    Other elements may be added at the author's whim.
    


The tclsap command extensions are: 
    Sap_Open - Open a session with SAP
        Example: Sap_Open <System> <Client> <User> <Password> <Trace>
        Return: If successful, the string "Open OK" and a TCL_OK 
                status
                If unsuccessful, the string "RFC Open Error" and a 
                TCL_ERROR status
    Sap_Close - Close an SAP session 
        Example: Sap_Close
        Return:  "OK" a normal TCL_OK status
    Sap_Callrx1 - Send and receive a string to/from SAP
        Example: Sap_Callrx1 <rfc_abap name> <message_string_to_send> 
        Return:  return string from SAP
    Sap_Callrx2 - Send one and receive 2 strings from SAP 
        Example: Sap_Callrx1 <rfc_abap name> <message_string_to_send>
        Return:  first string string returned from SAP
    Sap_Help - Brief message describing the tclsap 
        Example: Sap_Help [command name] 
        Return:  message string describing tclsap commands, or if a 
                 optional tclsap command was included, a description 
                 of that individual tclsap command.
    Sap_RfcPing - Send a ping to SAP. This is included as a tclsap 
                  function because the SAP library RFCOpen call 
                  always returns OK when the only connection to 
                  the SAP system completed successfully. The login 
                  may not have in fact, occurred. This verifies 
                  that the login also occurred.
        Example: Sap_RfcPing
        Return:  if successful, status return of TCL_OK
                 if not successful, status return of TCL_ERROR 
    Sap_SysInfo - Calls the SAP ABAP/4 program RFC_SYSTEM_INFO and 
                  returns a string of system "information" about 
                  the connected SAP system. This command is 
                  included mostly for demonstration purposes. It is 
                  helpful as a means of building confidence that 
                  the interface really works.
        Example: Sap_SysInfo
        Return:  If successful, the info string and status of TCL_OK
                  Otherwise return the status of TCL_ERROR
    Sap_Version - Return tclsap version, contact and copyright 
                  information 
        Example: Sap_Version
        Return:  tclsap Version, Copyright and Author blurb.
                 Status is always TCL_OK
                   

Procedure to Make tclsap

    1.  Make and install tcl and tk. 
        The official ftp location for tcl/tk is : ftp.smli.com 
        Make sure that you have at least tcl version 7.4 and 
        tk version 4.0 or later.
 
    2.  If you have not already done so, locate the SAP RFC 
        "package" and install it. (On an SAP distribution for HPUX 
        the file is called RFCHP.Z. It is a compressed tar file. 
        Uncompress and "untar" the resulting file. It should give 
        you a directory called rfcsdk. The header and library files 
        are contained within the rfcsdk directory.)
     
    3.  Expand the tclsap distribution into a directory.

    4.  Edit the Makefile. Put in the correct locations for the TCL, 
        TK, X11 and SAP libraries. Put in the correct locations 
        for the SAP, X11 and tcl header files. Define where the 
        installed binaries are to be copied.
        If you are not using HPUX-9.x, you may need to change some 
        of the compiler C flags.
        Note: if you do not want tk extended, the X11 and TK 
              locations are not needed.  Do a "make tclsap".
         
    5.  Type make and see what happens. It should compile "fairly" 
        quickly.

    6.  Test the programs in the local directory
        Test the tcl extensions by typing
         ./tclsap Sap_System_Info.tcl  
          (it will if you don't have a correct sideinfo file and do 
           not enter the SAP System ID, Client, User ID and 
           Password on the command line.)
        Similarly test the tk shell (wishtcl) by typing
         ./wishsap Sap_Info.tk
           (This script is X11 based and requires screen entry. 
            This also  requires a correct sideinfo file for 
            successful operation.)
         
    7.  If the above were successful, "su" to the user that will 
        own the installed executables and type 
           make install
 
    8.  Enjoy.

         
     
Legal Notice:         
  AUTHOR: 
       Garth Kennedy (garth@comm.mot.com or garth@mcs.net) 
       Land Mobile Products  Motorola Inc.  
       Schaumburg, Ill. 
  
  COPYRIGHT NOTICE: 
        Copyright 1995   Motorola Inc.; 
        Permission to use, copy modify and distribute without charge 
       this software, documentation etc. is granted, provided that 
        this comment and the author's name is retained. Neither the 
        author or Motorola assume any responsibility for problems 
       resulting from the use of this software. 
  
                 
