Amministrazione generale > Implementazione di Windchill ESI > Implementing Windchill ESI in an SAP Environment > SAP API Structures > Change Document
  
Change Document
The following API structure tables list all the APIs and the respective API fields that are required to change a document within the current version of SAP distribution targets. These APIs are listed in the order in which they are invoked.
BAPI_DOCUMENT_CREATENEWVRS2
This API is required to create a new document version. It is assumed that before any document changes are made, a new document version is created. Thus, this API is executed before each document change. The following table provides details on this API.
Windchill Attribute Name
API Structure
API Field
API Field Description
Value If Default
Source
Transform
Doc Type
HEADER
REFDOCUMENTTYPE
Document Type
N/A
Windchill
N/A
Doc Number
HEADER
REFDOCUMENTNUMBER
Document Number
N/A
Windchill
N/A
N/A
HEADER
REFDOCUMENTPART
Document Part
000
Default
N/A
Previous Version
HEADER
REFDOCUMENTVERSION
Ref Document Version
N/A
Windchill
N/A
Version
HEADER
NEWDOCUMENTVERSION
New Document Version
N/A
Windchill
N/A
N/A
HEADER
STATUSEXTERN
Status
FR
Default
N/A
N/A
HEADER
COPYORIGINALS
Copy Originals
\u00201
Default
N/A
N/A
HEADER
COPYDOCBOM
Copy Document BOM
\u0020 1
Default
N/A
N/A
COPY OBJECT LINKS
OBJECTTYPE
Copy all object links
*
* 
This value is an asterisk
Default
N/A
1. For the COPYORIGINALS and COPYDOCBOM fields, it is necessary to pass in a blank space because the API defaults in an “X” which would ultimately copy originals into the new versions created. It is critical to the design that a " " blank space is copied into these fields. The value "\u0020" is the UTF-8 format of a space.
BAPI_TRANSACTION_COMMIT
This API is used to commit a transaction to the SAP system. It is executed if the return message generated from the BAPI_DOCUMENT_CREATENEWVRS2 function is a success. When this API completes execution, all document data sent from Windchill 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 this module to 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. The following table provides details on this API.
Windchill Attribute Name
API Structure
API Field
API Field Description
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_CREATENEWVRS2 function is not a success. When this API completes execution, all part data sent froWindchill PDMLink 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.
* 
No data is passed through the BAPI_TRANSACTION_COMMIT function module but is necessary to call this 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.
The following table provides details on this API.
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 change all the document data in SAP. The API needs to be called for each document to be changed. The API does not require plant information. The following table provides details on this API.
Windchill Attribute Name
API Structure
API Field
API Field Descrip-tion
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
Cross Reference
Document Version
HEADER
VERSION
Document Version
N/A
Windchill
N/A
Type
DOCUMENTDATA
DOCUMENTTYPE
Document Type
N/A
Windchill
Cross Reference
N/A
DOCUMENTDATAX
DOCUMENTTYPE
Document type
X
Default
N/A
N/A
DOCUMENTDATAX
DOCUMENTVERSION
Document Version
X
Default
N/A
N/A
DOCUMENTDATAX
ECNUMBER
Change Number
X
Default
N/A
Number
DOCUMENTDATA
DOCUMENTNUMBER
Document number
N/A
DOCUMENTDATA
DOCUMENTPART
Document part
N/A
Default
N/A
Version
DOCUMENTDATA
DOCUMENVERSION
Document version
N/A
Windchill
N/A
N/A
DOCUMENTDATA
STATUSEXTERN
External status
IA
Default
N/A
Change Number
DOCUMENTDATA
ECNUMBER1
Change number
N/A
Windchill
N/A
N/A
DOCUMENTFILES
ORIGINALTYPE
Original Type
1
Default
N/A
N/A
DOCUMENTFILES
SOURCEDATA CARRIER
Data Carrier
INTERNET
Default
N/A
N/A
DOCUMENTFILES
WSAPPLICATION
Application
NET
Default
N/A
File
DOCUMENTFILES
DOCFILE
Document File
N/A
Windchill (URL)
N/A
Number
DOCUMENTFILES
DOCUMENTNUMBER
Document Number
N/A
Windchill
N/A
Version
DOCUMENTFILES
DOCUMENTVERSION
Document Version
N/A
Windchill
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.