Generating and Installing COM Objects

The generation and installation process is controlled via a user interface to the DCOM Object Builder, the Connector Wizard.

This section contains the following topics:

dot.gif (151 Byte)   Using the Connector Wizard

             Logon Parameters

            Specifications for DCOM Components

            R/3 Components

dot.gif (151 Byte)     Versions of Proxy Objects

dot.gif (151 Byte)     Troubleshooting for the Build Process

dot.gif (151 Byte)    Debugging Versions of Project

dot.gif (151 Byte)     Exporting MTS Packages

dot.gif (151 Byte)    Configuring the Client Machine for Calling Remote Components

Using the Connector Wizard

Prerequisites

The initial screen of the R/3 DCOM Connector Wizard is already displayed. If not, open file default.htm in the directory rfcsdk\ccwww\ .

Procedure

To execute the generation and installation process, proceed as follows:

  1. Choose Object Builder to start the user interface to the DCOM Object Builder.
  2. Under R/3 System specify the connection parameters.
  3. Click on Logon to start the RFC connection.
  4. Under COM/MTS enter the project directory and the name of the project file. For a remote generation, you must enter the corresponding UNC path name. To do this, use the Browse key.
  5. Under Namespace, you can enter a name space description that differs from the system name, if required.
  6. Assign the DLL to be generated to a package. Select a package under MTS Package or enter the name for a new package.
  7. Choose Session for generation of a session object and specify the name if deviates from the default.
  8. Determine the type of the R/3 components by selecting either Bapi or RFC Function.
  9. If you select Bapi, click on R/3 Business Components in the selection window. The system then displays all BOR objects for the selected system, for which BAPI methods are defined.
    If you select RFC Functions, click on the button Select RFC Functions. The system then displays a dialog window. There you can either further restrict the number of remote functions of a function group or select individual remote functions.
  10. If you select RFC Functions, confirm your entries from dialog box with OK.
    The system reads the selected function groups and the corresponding remote functions from the R/3 Repository and displays them in a tree structure.
  11. Select the components to be generated and choose Add ® . The system copies the selected components to the selection window for the generation and adds them to the structure under COM Components.
  12. After the selection, click on Build Component DLL to start the generation process for DCOM proxies.
    All selected components are assigned to the Projectfile.DLL.
    In the first generation step, the system creates source files. In the second step, the system creates the DLL and the Type Library.

    Note:
    Before the system starts the generation, it checks whether a version of the component is already registered in the MTS.
    It also checks whether a DLL of the same name already exists in the project directory.
    For more information, see Versions of Proxy Objects.

    Note:
    If the generation fails, you can find the possible reasons in the log file Project.log in the project directory. For more information, see Troubleshooting for the Build Process.
  13. As soon as the generation process is terminated successfully, the pushbutton Install Component DLL in MTS becomes active.
    Click on the pushbutton to start the installation process.
    This calls the DCOM Object Builder that installs the generated DLL in the specified MTS Package. As soon as the installation process is terminated successfully, the system displays the message Generated component(s) succesfully installed in MTS!.

 

Result

Together with the installation, the DCOM proxies are entered into the Windows Registry.

The installed DCOM proxies are now visible in the MTS Explorer.

To display the newly installed DCOM proxies,

  1. Start the Microsoft Transaction Server Explorer.
  2. Choose Computers ® My Computer ® Packages Installed.
  3. Select < the package specified under MTS Package > ® Components.
    The generated DCOM proxies are displayed in the Detail Viewer according to the convention for COM objects in the form < Namespace . Objectname . Version >.

Note:

If the MTS Server is already running, update the display of the installed packages by choosing Refresh (right mouse button or icon).

Example:

Note:

You can display the installed components also in the R/3 DCOM Connector initial screen in the Installed Components list.

 

Connection Parameters

When you call the Wizard, all logon parameters are displayed with the preset values maintained in the Destinations window.

Example:

Choose Logon:

This function allows you to test the selected destination and thus the RFC connection to the /3 system.

If the logon parameters are valid, the system establishes an RFC connection to the server. Next to the deactivated pushbutton Connected to the corresponding system name appears.

If the logon parameters are invalid, the Microsoft Internet Explorer displays an error message with a short description of the error reason.

Specifications for DCOM Components

 

Example:

 

R/3 Components

The following R/3 components can be selected:

 

Versions of Proxy Objects

If one or more DCOM proxies are already installed and registered, you can update them to a higher version. Such an update can be reasonable if the corresponding R/3 component was enhanced by new functions (methods), such as a new R/3 release. This would allow you to have several versions of proxy objects.

For this reason, the system checks before starting a generation process, whether a version of the component is registered in the MTS. If so, it displays a dialog window with an appropriate message:


You can then choose whether to install a new version or not. If you confirm with Yes, the system installs and registers another version of the proxy object. The version number of the object is increased by one and displayed accordingly in the Detail Viewer of the MTS. If you confirm with No, the system does not execute another generation but accesses the existing entries in the Registry.

In addition, the system checks whether a DLL with the same name already exists in the project directory. If so, it displays a message and you can choose whether to overwrite this file or not. If you choose Yes, the system removes all components contained in the DLL from the MTS and all corresponding entries from the Windows Registry. If you choose No, a new generation is not possible.

 

Troubleshooting for the Build Process

There are severals utilities that allow you to find errors occurring during the build process:

Errors Occurring During the Creation of Source Files

If the TraceLevel is set to a value between 1 and 5, the error data is stored in file proxygenxxx.log in a directory specified in the Registry. The extension xxx in the file name is a more-digit number generated by the Builder.

Procedure
To specify the TraceLevel and the directory in the Registry, proceed as follows:

  1. Start the Registry editor with regedit.
  2. Select the Registry path HKEY_LOCAL_MACHINE\SOFTWARE\SAP\MTS\ProxyGenerator\Tracing.
    The following window appears:



  3. Double-click on the entry TraceDir to select it.
  4. A dialog window appears. Enter the path name for the log file under Value data.
  5. Confirm with OK.
  6. Double-click on the entry TraceLevel to select it.
  7. A dialog window appears. Enter a value between 1 and 5 under Value data. The higher the value, the more detailled the tracing will be.
  8. Confirm with OK.
    The current values appear in the editor under Data.

 

Errors Occurring During Compilation and Linking

Generation can also fail during compilation and linking. You can find the error data in the log file Project.log and thus detect possible error reasons. The log file is stored in the project directory you specified.

Activating the RFC Trace

You can log the RFC communication to the selected destination in a trace file. Set the appropriate option in the R/3 DCOM Connector Wizard in the window Administration and Destination Management. See also Maintaining Destinations.

The system writes log information into the trace file rfcxxx_xxx.trc and stores the file in a standard directory. The directory is preset under Working Directory in the window Monitor ® Parameters, where you can change it, if required.
The extension xxx in the file name is a more-digit number.

 

Creating Debugging Versions of the Project

For debugging, the C++ programmer can use a special debugging version of the generated project. This allows the programmer to check in detail, for example, the parameter transfer in the generated C++ coding.

Prerequisites

The corresponding project DLL is generated and installed.

Procedure

  1. In the Visual Studio IDE open the generated MAK file Project.mak.
  2. To set the debugging flag, choose Project Settings  -> General and under Build command line enter the addition BUILD=D.
  3. Specify the RFC SDK include directory to be able to refer to the appropriate include files. Choose Tools -> Options and in the field Directories enter the name of the RFC SDK include directory.
  4. Start the C++ compiler.

 

Result

The new debugging version overwrites the original project file DLL, unless you explicitly create a copy for the original.

To execute the debugging version of the DLL in the MTS process, choose Project Settings -> Debug. In the field Executable for debug session specify the directory name for the MTS (<directory>/mtx.exe). In the field Program arguments specify the respective package ("/p <Package Name>") as argument.

 

Exporting MTS Packages

Procedure

To export a package from the MTS, proceed as follows:

  1. Start the Transaction Server Explorer.
  2. Choose Computers ® My Computer ® Packages Installed.
  3. Select the package you want to export.
  4. Use the right mouse button to choose Export….
    The dialog window Export Package appears.
  5. Enter the complete path name for the package file to be created. To do this, choose Browse, select the directory, enter the file name, and confirm.



    MTS automatically adds the extension PAK to the file name.
  6. Choose Export.
    If the export was successful, the message The Package was successfully exported appears.
  7. Choose OK to close the message window.

 

Result

The MTS package was exported and an executable file for the client configuation was created. The directory you specified in step 5 now includes two files and a subdirectory:

You can use the two files <Projectfile>.dll und <Exportfile>.pak on another MTS by importing them there.

You can use the executable file <Exportfile>.exe to configure the client in a way that allows executing remote components via DCOM.

 

Configuring the Client Machine for Calling Remote Components

To remotely access MTS components from within an application on a client machine, you need the respective entries for the components in the Registry of the client machine.

Prerequisites

Procedure

To configure the client machine for calling remote components of an exported package, proceed as follows:

  1. Copy the file <Exportfile>.exe from the clients directory to a directory on the client machine, from which you want to call the remote MTS.
  2. Start the executable file <Exportfile>.exe on your client machine.
    The required entries are written to the Registry to configure the client machine for calling remote components.
  3. Start your application from the client machine.
    See Example Program: SalesOrder.vbp.