Administración de la empresa > Implementación de Windchill ESI > Implementing Windchill ESI in an SAP Environment > SAP API Structures > Create Document
  
Create Document
The following API structure tables list all the APIs and the respective API fields that are required to create a document information record within the current version of SAP distribution targets. These APIs are listed in the order in which they are invoked.
BAPI_DOCUMENT_CREATE2
This API is used to create all document data in SAP distribution targets; it needs to be called for each document to be created. It does not require plant information.
* 
Version information is always sent with the Create Document function.
Windchill Attribute Name
API Structure
API Field
API Field Description
Value If Default
Source
Transform
Number
DOCUMENTDATA
DOCUMENTNUMBER
Document number
N/A
Windchill
N/A
N/A
DOCUMENTDATA
DOCUMENTPART
Document part
“000”
Default
N/A
Name
DOCUMENT DESCRIPTIONS
DESCRIPTION
Document Description
N/A
Windchill
N/A
Name
DOCUMENT DESCRIPTIONS
LANGUAGE_ISO
Language ISO
EN
Default
N/A
Version
DOCUMENTDATA
DOCUMNENT VERSION
Document version
N/A
Windchill
N/A
Type
DOCUMENTDATA
DOCUMENTTYPE
Document type
N/A
Windchill
Cross Reference
N/A
DOCUMENTDATA
STATUSEXTERN
External status
FR (released)
Default
N/A
Change Number
DOCUMENTDATA
ECNUMBER1
Change Number
N/A
Windchill
N/A
N/A
DOCUMENTFILES
ORIGINALTYPE
Original Type
1 (for URL)
Default
N/A
N/A
DOCUMENTFILES
SOURCEDATA CARRIER
Source Data Carrier
INTERNET (for URL)
Default
N/A
N/A
DOCUMENTFILES
WSAPPLICATION
WS Application
NET (for URL)
Default
N/A
File
DOCUMENTFILES
DOCFILE
Doc File
N/A
Windchill (the URL)
N/A
1. This API field is only sent into the API if the global variable ESIFlags/EnableDocumentECNLock is set to true. See Process Engine Global Variable Groups in the Other PTC Manual referenced by my book for details.
BAPI_TRANSACTION_COMMIT
This API is used to commit a transaction to the SAP distribution target. This API is executed if the return message generated from the BAPI_DOCUMENT_CREATE2 function is a success. When this API completes execution, document data sent fromWindchill PDMLink is committed to the DRAW, DRAK and DRAT SAP database tables. For more information on howWindchill ESI interprets the results of the SAP API calls, see the Windchill Enterprise Systems Integration Customizer's Guide - SAP.
* 
No data is passed through the BAPI_TRANSACTION_COMMIT function module but it is necessary to call the module commit data to the database. For more information on how SAP APIs are called in sequence to execute eachWindchill ESI business function, see the Windchill Enterprise Systems Integration Customizer's Guide - SAP.
Windchill Attribute Name
API Structure
API Field
API Field Descrip-tion
Value If Default
Source
Transform
N/A
HEADER
WAIT
WAIT
X
Default
N/A
BAPI_TRANSACTION_ROLLBACK
This API is used to rollback a transaction to the SAP system. This API is executed if the return message generated from the BAPI_DOCUMENT_CREATE2 function is not a success. When this API completes execution, all part data sent from Windchill is rolled back and not committed to the DRAW, DRAT, and DRAT SAP database tables. For more information on howWindchill ESI interprets the results of the SAP API calls, see the Windchill Enterprise Systems Integration Customizer's Guide - SAP. The following table provides details on this API.
* 
No data is passed through the BAPI_TRANSACTION_ROLLBACK function module but it is necessary to call the module. For more information on how SAP APIs are called in sequence to execute eachWindchill ESI business function, see the Windchill Enterprise Systems Integration Customizer's Guide - SAP.
Windchill Attribute Name
API Structure
API Field
API Field Description
Value If Default
Source
Transform
N/A
N/A
N/A
N/A
N/A
N/A
N/A
BAPI_DOCUMENT_CHANGE2
This API is used to create and delete the links between documents and parts in SAP. The API needs to be called for each document to be changed.
Windchill Attribute Name
API Structure
API Field
API Field Description
Value If Default
Source
Transform
Number
HEADER
DOCUMENTNUMBER
Document number
N/A
Windchill
N/A
N/A
HEADER
DOCUMENTPART
Document part
“000”
Default
N/A
Type
HEADER
DOCUMENTTYPE
Document type
N/A
Windchill
N/A
Version
DOCUMENTHEADER
VERSION
Document version
N/A
Windchill
N/A
N/A
DOCUMENTDATAX
ECNUMBER
Change Number
X
Default
N/A
Number
DOCUMENTDATA
DOCUMENTNUMBER
Document number
N/A
N/A
N/A
N/A
DOCUMENTDATA
DOCUMENTPART
Document part
N/A
Default
N/A
Version
DOCUMENTDATA
DOCUMENVERSION
Document version
N/A
Windchill
N/A
Type
DOCUMENTDATA
DOCUMENTTYPE
Document type
N/A
Windchill
Cross Reference
Change Number
DOCUMENTDATA
ECNUMBER1
Change number
N/A
Windchill
N/A
N/A
OBJECTLINKS
OBJECTTYPE #1
Object Type
MARC
default
N/A
N/A
OBJECTLINKS
OBJECTTYPE #2
Object Type2
MARA
default
N/A
N/A
OBJECTLINKS
DOCUMENT DIRECTION
Document Direction
X
Default
N/A
N/A
OBJECTLINKS
DELETEVALUE
Delete Value
X
Default
N/A
Number (Material) and Plant
OBJECTLINKS
OBJECTKEY#1
Object Key #1
Material + Plant
N/A
Concatenate
Number (Material)
OBJECTLINKS
OBJECTKEY#2
Object Key #2
Material
N/A
N/A
1. This API field is only sent into the API if the global variable ESIFlags/EnableDocumentECNLockis set to true. See Process Engine Global Variables Groups in the Other PTC Manual referenced by my book for details.
2. Two line items are required in this structure to create a reference to a plant and to link the document to the material. One line should have object type = MARC and the Object Key = Material + Plant. Then second line should have Object Type = MARA and the Object Key = Material The API Field Object Type #1 corresponds to the API Field Object Key 1. The structure is repeated for relating The API Field Object Type #2 corresponds to the API Field Object Key #1.