Connecting the Converter 

Use

There are several ways to connect a converter to the SAP System. You must consider the conversion results when selecting one. For example if you want to convert original application files from documents you must set up the conversion server differently than when you want to convert assemblies.

There are three ways to connect a converter to the SAP System.

Method

Objects you want to convert

Transfer of parameters

1

Individual original application files from documents

Parameters are transferred between the SAP System and the converter using files

2

Individual original application files eof documents and assemblies

3

Individual original application files eof documents and assemblies

Parameters are transferred between the SAP System and the converter using an RFC interface

  1. Method

You can convert individual original application files of documents using the converter connected with this method. You can use the compiled example server ConvServSamp. No previous programming knowledge is required. It is however necessary to modify the shell-script and possibly a batch file.

You can find examples on the SAP server SapservX in the directory ~ftp/general/misc/converter/.

Th graphic display how the example convert All2txt is connected to the SAP System using the first method. All2txt converts files into text files. A shell-script file (such as ConvServ) starts ConvServSamp. This method uses the following conversion steps:

Below are tips and notes for the individual steps

Step

Note

Call ConvServSamp

You must enter the following parameters when calling ConvServSamp:

  • RFC parameter
  • Path name of the shell-script file that ConvServSamp starts for conversion (using parameter -s<shell-script filename> )

More information about the document you are converting can be saved as an extra file by using the parameter -ReadDocumentDetails .

Examples:

  • ConvServSamp -s c:\bat\StartConv.bat <RFC Parameter>
  • ConvServSamp -s $HOME/bin/StartConv <RFC Parameter>

ConvServSamp creates <WorkingDirectory>
/Parameters.txt

The file <WorkingDirectory>/Parameters.txt is created before calling StartConv and contains the parameters that were maintained in Customizing of the conversion specification. In Customizing of Conversion you make the settings Logistics General® Conversion ® Determine conversion.

Additional Files

The following files are also created when ConvServSamp is called using the parameter -ReadDocumentDetails:

  • <WorkingDirectory>/Documentdata.txt
  • <WorkingDirectory>/Ecmdata.txt
  • <WorkingDirectory>/Documentdescriptions.txt
  • <WorkingDirectory>/Longtexts.txt
  • <WorkingDirectory>/ClassData.txt
  • <WorkingDirectory>/Objectlinks.txt
  • <WorkingDirectory>/Statuslog.txt
  • <WorkingDirectory>/ExportData.txt
  • <WorkingDirectory>/UserData.txt

The files contain the data that the function module CAD_GET_TITLE_BLOCK_DATA determines. You can find information about the content of these files in the documentation for this function module (Export Parameter DOCUMENTDATA and ECMDATA and tables DOCUMENTDESCRIPTIONS, LONGTEXTS, CLASS_DATA, OBJECTLINKS, STATUSLOG, EXPORT_DATA and USER_DATA ).

 

  • The files Documentdata.txt and Ecmdata.txt contain DOCUMENTDATA or ESMDATA for every element of the structure. This data is in a line where the name and value of the element are entered:
    <Name> = <Value> (example: DOCUMENTTYPE = DRW)
  • All other files contain a line for each line of the structure. Each line contains a value for each element of the structure from the table. The number of the columns is based on the width set in the SAP System.
    No limits are used.

ConvServSamp sets parameter values for StartConv

The example server ConvServSamp calls the file StartConv:

StartConv <Version> <WorkingDirectory> <FileToConvert> <language> <ConverterTimeOut> <conversionName> <DocumentKey> <current_user_name> <sy_language>

  • ConvServSamp sets <WorkingDirectory> <FileToConvert>, <DocumentKey>, <current_user_name> and <sy_language> for the parameter values at the beginning and end of each special character "
    This keeps the Shell from interpreting the special character.
  • Each conversion has its own (<WorkingDirectory>) where the converted files are written.

Parameter meanings:

  • <Version> (such as: 5):
    Which functions are supported by the current SAP System
  • <WorkingDirectory>:
    Directory used for converted files
  • <FileToConvert>:
    Files you want to convert
  • <language>:
    Language for possible dialog boxes ('X' means no language selected)
  • <ConverterTimeOut>:
    Cancel conversion after this many minutes.
  • <conversionName>:
    Name for conversion
  • <DocumentKey>:
    Key for the document in the following sequence:
    3 characters: documenttype
    25 characters: documentnumber
    3 characters: documentpart
    2 characters: documentversion
  • <current_user_name>:
    Name of user who started the conversion implicit or explicit
  • <sy_language>:
    Language used by <current_user_name>

Modifying StartConv

Change the example file StartConv so that

  • This file starts your converter and
  • One of the files <WorkingDirectory>/Error.txt or <WorkingDirectory>/ConvPath.txt is created

After StartConv is completed ConvServSamp runs through the following steps:

  • The first line of the file <WorkingDirectory>/Error.txt is transferred to the SAP System as an error message when
  • The file <WorkingDirectory>/Error.txt exists and
  • The first line of this file is not empty
  • If exit code of the shell-scripts (for example StartConv) does not equal 0 (zero) the value is returned the SAP System as an error.
  • If none of the above is true, the path name of the converted file from the file <WorkingDirectory>/ConvPath.txt is read.
    This file is automatically transferred to the SAP System and stored as a new original application file.

2. Method

You can convert individual original application files of documents and assemblies using the converter connected with this method.

You can use the compiled example server ConvServSamp. No previous programming knowledge is required. It is however necessary to modify the shell-script and possibly a batch file.

The procedure is very much the same as the previous method.

The following overview shows information about files and parameters that are processed for converting assemblies only.

Activity

Note

ConvServSamp
creates <WorkingDirectory>/
ConvStructFilename.txt

Before calling StartConv the <WorkingDirectory>/ConvStructFilename.txt is created by ConvServSamp.

Each line of this file contains the following parameters:

  • parent_guid[38]
    ID of the father of this part
  • guid[38]
    ID of this part
  • file_changed[1]
    If the part was changed (currently not supported)
  • filename[255]
    Path name of the part

The format is fixed. There is no separator between the entries.

Converter creates <WorkingDirectory>
/ConvPathAndMatrix.txt

The converter creates <WorkingDirectory>/ConvPathAndMatrix.txt instead of the file <WorkingDirectory>/ConvPath.txt.
This file is not read when the file <WorkingDirectory>/ConvPath.txt exists.

Each line of this file contains the following parameters:

  • parent_guid[38]
    ID of the father of this part (as entered)
  • guid[38]
    ID of this part (as entered)
  • filename[255]
    Path name of the part
    Path name: Must not contain any empty spaces, end with empty or end of line

The format for these three parameters. There is no separator between the entries.

In case the path name is not yet at its end, it must contain 12 real number between these there must be an empty space:
locox, locoy, locoz, axis1x, axis2x, axis3x, axis1y, axis2y,
axis3y, axis1z, axis2z, axis3z, scale

The transformation matrix is used to describe the relative position of the part to the father.

When more than on instance exists then each instance must have its own line. These lines must be identical except for the transformation matrix.

3. Method

You can change the example server ConvServSamp when you do not wan to transfer your conversion parameters as files or when the first two methods do not meet your needs. You need to have programming knowledge of (C source code).

You will find the C source code for the RFC Server ConvServSamp on the SAP Server SapservX in the following directory: ~ftp/general/misc/converter/source.SAR

The converter is called from the SAP System as follows:

CALL FUNCTION 'ASSEMBLIE_CONVERTER'

DESTINATION wa_converter_dests-conv_dest

EXPORTING interface_version = interface_version

output_directory = output_directory

language = isola

sy_language = sy_isola

timeout_minutes = timeout_minutes

conversion_name = wa_conv_requested-handle

document_key = document_key

current_user_name = sy-uname

IMPORTING error_message = error_message

return = bapireturn

TABLES ti_conv_struct_filename = t_conv_struct_filename

ti_parameters = te_parameters

te_conv_path_and_matrix = ti_conv_path_and_matrix

Information about the type and structure of the fields are in the file ConvServ.h.

Below is information about the use of individual fields.

Entries for the Converter

Entry

Use

interface_version
(int, for example 3)

Indicates which functions are supported by the current SAP version

output_directory
(char *255)

Working directory where the converted files are sent

language
(char *2, such DE or EN)

Language for the error messages in the SAP System

sy_language
(char *2, such as DE or EN)

Language used by the user to logon to the SAP System before starting the conversion.

timeout_minutes
(int, for example 30)

Time in minutes after which the conversion is cancelled as not successful

conversion_name
(char *32)

Name for identifying the conversion

document_key
(struct DOCUMENT_KEY)

Key of the document that you want to convert

current_user_name
(char 12*)

User who started the conversion

ti_conv_struct_filename (table)

Structure and path names
See: Section Converting Assemblies , <WorkingDirectory>/ConvStructFilename.txt

ti_parameters (table)

See: Section Converting Original Application Files of a Document, <WorkingDirectory>/Parameters.txt

Output of the Converter

Output

Use

te_conv_path_and_matrix
(table)

Here you can transfer the converted file and the transformation matrix and/or an error message (in 2 table lines) for the file you entered.

  • msg_type = ' ' (Blank)
    The table lines (struct CONV_PATH_AND_MATRIX) contain a converted files and possibly transformation matrix transformation_matrix_valid = 'X'
    See: Section Converting Assemblies , <WorkingDirectory>/ConvPath.txt)
  • msg_type <> ' ' (Blank)
    The table lines (struct CONV_PATH_AND_MATRIX_ERR) contain an error message.

error_message
(struct MESSAGES)

Error Messages:

  • msg_type = ' ' (Blank)
    No error
  • msg_type = 'W' Warning: The file was converted, however there is still a problem that user should know about
  • msg_type = 'E'
    Error: File or assembly could not be converted
  • msg_type = 'F'
    There are error messages in te_conv_path_and_matrix ; parts of the assembly or the entire assembly could not be converted.
  • msg_type = 'L'
    Not all licenses are available for conversion. The converter will be available later, however with input from an administrator.
  • msg_type = 'C'
    System error that requires input form the administrator (for example hard drive is full)

If all fields (except msg_type and msg_txt) are released, an long message can be entered in the msg_txt that has up to 200 characters.

return
(struct BAPIRET2)

Error messages can also be added to this structure

The RFC server must also contain the function CONV_SERV_ABOUT that you can use without changing the example ConvServSamp.c.