Overview
The Document Info Record plugin is in the SAP Targets group on the left panel of the Designer. Use it as a target to create new document info records (DIRs) in SAP Document Management or to update existing ones.
It is a target plugin: map fields from any source (Excel, database, SAP table, Python, and so on) to it. For every source record, the plugin creates or changes one DIR with the standard SAP BAPIs BAPI_DOCUMENT_CREATE2, BAPI_DOCUMENT_CHANGE2 or BAPI_DOCUMENT_LOAD. In the same call it can also maintain:
- header data of the document (description, status, user, laboratory and so on);
- object links, for example to materials or equipment;
- classification (classes and characteristic values);
- originals (files);
- document structures and components;
- descriptions in several languages;
- long texts.
Connecting to SAP
Password Manager
To configure the plugin:
- In SAP System, select an entry from the Password Manager.
- In Server Type, select one of two server types:
- Application Server
- Message Server
- Select the operation type (see Operation settings).
- Click Connect.
- Select the DIR type to build the plugin structure.
Password manager entry should have the following keys in its Options:
App Server Host, Client, Language, SAP Router, System Number, System ID
All of those fields can be used from SAP System options template
Application Server
To configure the plugin fill the following fields:
- Server Host
- System Number
- SAPRouter - optional
- User
- Password
- Client
- Language
After that:
- Select the operation type (see Operation settings).
- Click Connect.
- Select the DIR type to build the plugin structure.
Message Server
To configure the plugin fill the following fields:
- SID
- Server Host
- Logon Group
- Server Service - optional
- SAPRouter - optional
- User
- Password
- Client
- Language
After that:
- Select the operation type (see Operation settings).
- Click Connect.
- Select the DIR type to build the plugin structure.
Operation settings
| Field | Description |
|---|---|
| Operation type | Create New Document creates new DIRs. Update Existing Document changes existing DIRs. |
| Version Assigned Automatically | Shown for Create New Document. SAP assigns the document version automatically. Available only if the selected DIR type allows automatic version assignment. |
| Ignore Document Status | Shown for Update Existing Document. Updates the document even if its status would normally block changes (the plugin calls BAPI_DOCUMENT_LOAD with FORCE_UPDATE). |
| DIR type | Appears after you connect. Select the document type; the plugin structure is built for it. |
When you connect, the plugin reads the list of DIR types and their descriptions from SAP (tables TDWA and TDWAT, in the logon language). When you select a DIR type, it reads the type's settings:
- the header fields that the DIR type marks as required in its field selection (for example Description or Laboratory/office); these fields are marked M;
- the object links allowed for the DIR type (
BAPI_DOCUMENT_GETDOCTYPEDETAIL) and the key fields of each linked object (tableTCLO); - the class assigned to the DIR type, if any, with its characteristics;
- whether the DIR type allows automatic version assignment. If it doesn't, Version Assigned Automatically is disabled.
Settings
Expand Settings in the connection parameters to change the SAP connection pool settings:
| Field | Description |
|---|---|
| IDLE_TIMEOUT | Time after which an idle connection is closed. |
| POOL_SIZE | Number of connections kept open in the pool. |
| MAX_POOL_SIZE | Maximum number of connections the plugin can open at the same time. |
Click Notes to add your own notes to the plugin.
How to use
- Add the Document Info Record plugin to the canvas.
- Open the Connection Parameters.
- Fill in the SAP connection parameters, user name and password.
- Select the operation with the document.
- Click Connect.
- The line under the connection button turns green when the connection to SAP is established.
- Select the DIR type.
- Map the import fields to a source (required) and the export fields to a target (optional).
Import and export fields
The Document Info Record plugin consists of three main parts, see image 1 below:
- Input document data parameters (1)
- Input object parameters (2)
- Output (return) parameters (3)
Select fields and objects
- Open the Fields section.
- Select the fields and objects you need on the tabs. Click Select All to select everything on a tab.
| Tab | Content |
|---|---|
| Document data | Header fields of the DIR (structure BAPI_DOC_DRAW2), for example document number, part, version and description. The document type is not in the list; it comes from the selected DIR type. |
| Objects | Object Links, Classifications, Originals, Doc Structures, Components, Descriptions, Longtexts and Additional Parameters. |
| Return Data | Export fields: DOCUMENTTYPE, DOCUMENTNUMBER, DOCUMENTPART, DOCUMENTVERSION of the processed DIR, and RETURN_NUMBER and RETURN_MESSAGE with the SAP message. Map them to a target, for example to write the created DIR numbers back to Excel. |
The drop-down list shows the description of each field.
Object links
For Object Links, select the linked object type (Select Object Link). Only the object types allowed for the selected DIR type are offered. The object link fields (structure BAPI_DOC_DRAD) appear on the canvas; OBJECTKEY and DOCUMENTDIRECTION are mandatory. Object links without key fields are also supported.
If the object key consists of one field, map that field directly. If it consists of several fields (for example material and plant), there are two ways to fill it:
- Multi-Field Key Mode selected (the default): each key field appears as a separate item. Map each one to its own source field or give it a default value.
- Multi-Field Key Mode cleared: map one source field that contains the complete key, with the key parts separated by the Separator (default
/). The plugin splits the value at the separator and assigns the parts to the key fields in order.
In both cases the plugin builds the internal object key with BAPI_OBJCL_CONCATENATEKEY. A source table with several rows creates several links of the same object type.
Classification
For Classifications, click Add Class and select the class by Class Type and Class Number. If the DIR type has a class assigned in Customizing, that class is added automatically and can't be removed. Then select the characteristics to fill (Select Characteristic). Hover over a classification item to see a tooltip with its class or characteristic details, for example whether multiple values or interval values are allowed.
For a characteristic with multiple values, click Add again to add another value item; the list shows how many values are used out of the number allowed. CHARVALUE is mandatory for every characteristic item. The plugin adds each class that has at least one characteristic value to the class assignments of the DIR.
Originals, structures, components, descriptions and long texts
These objects are tables. Each object item has an Add Row button to add another row, for example a second original or a description in another language. If a row is mapped to a source table, every source row creates one entry. Mandatory fields:
| Object | SAP structure | Mandatory fields |
|---|---|---|
| Originals | BAPI_DOC_FILES2 |
DOCFILE |
| Doc Structures | BAPI_DOC_STRUCTURE |
DOCUMENTTYPE, DOCUMENTNUMBER, DOCUMENTPART, DOCUMENTVERSION |
| Components | BAPI_DOC_COMP |
DOCUMENTTYPE, DOCUMENTNUMBER, DOCUMENTPART, DOCUMENTVERSION |
| Descriptions | BAPI_DOC_DRAT |
LANGUAGE, DESCRIPTION |
| Longtexts | BAPI_DOC_TEXT |
LANGUAGE, TEXTLINE |
- Originals: if
WSAPPLICATION(workstation application) is empty, the plugin determines it from the file extension ofDOCFILE, using the workstation applications defined in SAP (tableTDWP). Rows without a file name are skipped when a document is created. - Longtexts: you can map a long text as one value. The plugin splits it at line breaks and into lines of at most 132 characters, and removes trailing spaces from each line. Rows where all fields are empty are skipped.
Additional parameters
Additional Parameters are passed directly to the BAPI as import parameters. A parameter is passed only if the called BAPI has it.
| Parameter | Description |
|---|---|
PF_FTP_DEST, PF_HTTP_DEST |
RFC destinations used to transfer originals. |
CAD_MODE |
CAD flag for the document structure. |
DOCBOMCHANGENUMBER, DOCBOMREVISIONLEVEL, DOCBOMVALIDFROM |
Change number, revision level and valid-from date for the document structure. |
SENDCOMPLETEBOM, ACCEPT_EMPTY_BOM |
Send the complete document structure instead of only the changes, and accept a structure without items. |
Mapping
To use this plugin, create a mapping between a source and the DIR plugin. The source can be the Excel plugin, a database, the SAP Read Table plugin, the Python plugin and so on.
For example, if the source is the Excel plugin, map the fields between the Excel plugin and the DIR plugin with drag and drop, as shown below:
Field options
Open the details of an import field to set how its value is converted before it is sent to SAP:
| Option | Description |
|---|---|
| Default Value | A value to use instead of, or in addition to, the source value. Choose No Default Value., Ignore Source. (always use the default value) or Only If Source Empty. (use the default value only when the source value is empty). A D marker shows that a default value is set. |
| Convert To Upper Case | Converts the value to upper case. Marked with U. |
| Add Leading Zeros | Pads the value with leading zeros to the field length. Marked with Z. |
Mandatory fields are marked with M. Export fields have a Remove Zeros option that removes leading zeros from the returned value.
Run-time behavior
- Create New Document calls
BAPI_DOCUMENT_CREATE2. Update Existing Document callsBAPI_DOCUMENT_CHANGE2, orBAPI_DOCUMENT_LOADwhen Ignore Document Status is selected. Changes are committed withBAPI_TRANSACTION_COMMIT. - Without Ignore Document Status, an update first checks that the document exists (
BAPI_DOCUMENT_EXISTENCECHECK). If it doesn't, the entry fails with the message "Document ... does not exist". - In simulation mode, the plugin calls SAP but doesn't commit the changes.
- When updating a document, mandatory fields aren't required.
STORAGECATEGORYis not a mandatory field. - The migration log shows a DIR Key column (document type, number, part and version) and a DIR Description column. Click the DIR Key to open the document in SAP. This requires SAP GUI on your computer and the function module
RFC_DISPLAY_DOCUMENT_MASTERin the SAP system; VeloXm checks that the function module exists when you connect.
SAP calls per record
| Operation | Calls in order |
|---|---|
| Create New Document with Version Assigned Automatically | BAPI_DOCUMENT_CREATE2, then BAPI_TRANSACTION_COMMIT. |
| Create New Document without Version Assigned Automatically | BAPI_DOCUMENT_EXISTENCECHECK. If the document already exists, the record fails with the message "Document ... exist." and nothing is created. Otherwise BAPI_DOCUMENT_CREATE2, then BAPI_TRANSACTION_COMMIT. |
| Update Existing Document | BAPI_DOCUMENT_EXISTENCECHECK, then BAPI_DOCUMENT_CHANGE2, then BAPI_TRANSACTION_COMMIT. |
| Update Existing Document with Ignore Document Status | BAPI_DOCUMENT_LOAD with FORCE_UPDATE = X, then BAPI_TRANSACTION_COMMIT. |
BAPI_TRANSACTION_COMMITis called withWAIT=X, in the same SAP session as the BAPI, and only if the BAPI returns no error.- The document type is always taken from the selected DIR type; it is not a mapped field.
- When updating, every header field that is on the canvas is marked for change (
DOCUMENTDATAX). A header field that is on the canvas but gets an empty value is therefore sent as empty. Remove header fields you don't want to change. BAPI_DOCUMENT_LOADhas no document structure parameter, so Doc Structures are not sent when Ignore Document Status is selected.- When a record has originals, the plugin opens the SAP connection with SAP GUI support, because SAP uses the front end to transfer files. If SAP reports
SYSTEM_PREPARE_ATTACH_GUIorSYSTEM_FINISH_ATTACH_GUI, the error refers to SAP Note 1258724 and the run stops. - Before a run, VeloXm checks that you are connected and a DIR type is selected. For Create New Document, every mandatory field must be mapped or have a default value; otherwise the run doesn't start ("Required SAP fields must be linked to the fields of the file or have a default value.").
Simulation mode
The simulation mode is available for this plugin. In simulation mode, the plugin runs the same BAPI calls with the same data, so SAP checks the data and returns its messages, but BAPI_TRANSACTION_COMMIT is not called. The changes are not saved when the SAP session ends. Because nothing is saved, the Return Data fields of a created document show the values returned by the BAPI, not a document that exists in SAP.
Simulation is not a replacement for a test load. Test new projects in a non-productive system first.
Log
The technical log of each record shows the plugin and SAP connector versions, the operation type, the simulation flag, the Ignore Document Status or Version Assigned Automatically setting, the result of the existence check, and all import and export parameters of the BAPI call.
If SAP returns an error, the record is marked as an error with the SAP message. If the error is raised as an ABAP runtime exception, the exception text is shown.
Prerequisites
- SAP .NET Connector (NCo) installed on the computer that runs VeloXm.
- An SAP user with authorization to create and change documents of the selected DIR types and to call the BAPIs listed above over RFC.
- Read access with
RFC_READ_TABLEto the tablesTDWA,TDWAT,TCLO,TDWPand the tables of the linked objects. The plugin reads them when you connect and when you select a DIR type. - SAP GUI on the computer that runs VeloXm, if you load originals or want to open documents from the log.
Our experienced team of experts has the capability to develop customized solutions to fit your individual needs.
We understand that each situation is unique and thus can provide services tailored to those requirements. Our goal is to provide the best possible service and to ensure the most successful outcome for the project.
Please contact us for more information on how we can help you.