進階自訂 > Windchill ESI Customization > Windchill ESI Customization—SAP > Overview > The Six Steps > Step 6: Validate API Molecular Functionality Outside SAP
Step 6: Validate API Molecular Functionality Outside SAP
SAP Readiness Validator Introduction
The Purpose of Step 6 is to isolate issues with the TIBCO BusinessWorks-to-SAP interface with realistic Windchill Enterprise Systems Integration test scenarios. Finding problems at this stage can streamline troubleshooting by ruling out the actual Enterprise Systems Integration business logic, Windchill PDMLink, and the Enterprise Systems Integration services as root causes.
Your test scenarios should match those developed for Step 5 of the SAP Readiness Validation Process. Invoke a connected, "molecular" series of SAP APIs, emulating the manner in which they are invoked by the actual Windchill Enterprise Systems Integration solution. However, in this case, rather than invoking the APIs from within SAP, you will use an API testing application developed in TIBCO BusinessWorks, and provided with the Windchill Enterprise Systems Integration EAI Windchill Simulation module. This testing utility is called the SAP Readiness Validator.
What It Tests
The SAP Readiness Validator allows you to execute each Windchill Enterprise Systems Integration business function and confirm that the APIs are behaving as expected. The SAP Readiness Validator supports testing of the following business functions.
No.
Windchill Enterprise Systems Integration Business Function
Prerequisites/Assumptions
1
Create Part
N/A
2
Create Part Revision
Part and change master exist
3
Change Part
Part exists
4
Create BOM
Parts exist for BOM header and BOM component
5
Change BOM
BOM exists
6
Create Document
N/A
7
Create Document Revision plus Change Document plus, optionally, Add or Delete Document Links
Document exists; document links assume linked part exists
8
Create CN
N/A
9
Change CN3
CN exists
10
Create Tooling (Tool and Fixture)
N/A
11
Change Tooling (Tool and Fixture)
Tooling exists
12
Create Process Material
N/A
13
Change Process Material
ProcessMaterial exists
14
Create Routing and all its associated objects like Operations, Sub Operations, Sequences, Material Allocations, Component Allocations, etc
N/A
15
Change Routing and all its associated objects like Operations, Sub Operations, Sequences, Material Allocations, Component Allocations, etc
Routing with all the associated objects exists
Business Functions Supported by SAP Readiness Validator
* 
Change ECN is not a core Windchill Enterprise Systems Integration function, but the solution uses the Change ECN API during Create ECN operations to add alternate effectivity dates for each line item, and to update the effectivity date in the ECN header.
What It Includes
Each of the Windchill Enterprise Systems Integration Business Functions shown in the table Business Functions Supported by SAP Readiness Validator is realized as a separate process definition within the Windchill Enterprise Systems Integration EAI Windchill Simulation module, as follows:
No.
Windchill Enterprise Systems Integration Business Function
BusinessWorks Process Definition Name
1
Create/Change Part
RV_Part_SAPCreateChange_PD
2
Create Part Revision
RV_Revision_SAPCreate_PD
3
Create BOM
RV_BOM_SAPCreate_PD
4
Change BOM
RV_BOM_SAPChange_PD
5
Create Document
RV_Document_SAPCreate_PD
6
Create Document Revision plus Change Document plus, optionally, Add or Delete Document Links
RV_Document_SAPChange_PD
7
Create CN
RV_ECN_SAPCreate_PD
8
Change CN
RV_ECN_SAPChange_PD
9
Create Tooling of type Fixture
RV_Equipment_SAPCreate_PD
10
Change Tooling of type Fixture
RV_Equipment_SAPChange_PD
11
Create Process Plan
RV_ProcessPlan_SAPCreate_PD
12
Change Process Plan
RV_ProcessPlan_SAPChange_PD
BusinessWorks Process Definitions in the SAP Readiness Validator
The SAP Readiness Validator also uses a shared process definition, called "Logging_Service," to provide logging functionality to each of the business functions.
The process definitions described above are located in the /ProcessDefinitions/SAPReadinessValidator folder and /ProcessDefinitions/Services folder of the Windchill Enterprise Systems Integration EAI Windchill Simulation module repository, as illustrated.
BusinessWorks Process Definitions in the SAP Readiness Validator
To supply test data input, the SAP Readiness Validator uses a series of external XML document files (schema instances) matching the SAP API input schemas for the fields that are expected and used by the out-of-the-box Windchill Enterprise Systems Integration solution. Samples of these files are provided on the Windchill Enterprise Systems Integration CDs. The XML document files are as follows:
Business Function Test Scenario
Source Test Data XML Files Used
Create / Change Parts
BAPI_MATERIAL_SAVEREPLICA.xml
BAPI_TRANSACTION_COMMIT.xml
Create Part Revision
CALO_INIT_API.xml
CCAP_REV_LEVEL_MAINTAIN.xml
BAPI_TRANSACTION_COMMIT.xml
BAPI_TRANSACTION_COMMIT.xml
Update Consumption Information
/PTC/ZMATERIAL_COSTS_SPLIT_UPD
Create BOM
CALO_INIT_API.xml
BAPI_MATERIAL_BOM_GROUP_CREATE.xml
Change BOM
CALO_INIT_API.xml
CSAP_MAT_BOM_MAINTAIN.xml
Create Document
BAPI_DOCUMENT_CREATE2.xml
BAPI_TRANSACTION_COMMIT.xml
Create Document Revision plus Change Document plus, optionally, Add or Delete Document Links
BAPI_DOCUMENT_CREATENEWVRS2.xml
BAPI_TRANSACTION_COMMIT.xml
BAPI_DOCUMENT_CHANGE2.xml
Create CN
CALO_INIT_API.xml
CCAP_ECN_CREATE.xml
Change CN
CALO_INIT_API.xml
CCAP_ECN_MAINTAIN.xml
Create Tooling of type Fixture
ZRFC_CREATE_EQUIPMENT.xml
Change Tooling of type Fixture
ZRFC_MODIFY_EQUIPMENT.xml
Create ProcessPlan
BAPI_ROUTING_CREATE.xml
BAPI_TRANSACTION_COMMIT.xml
BAPI_TRANSACTION_ROLLBACK.xml
Change ProcessPlan
ZRFC_MODIFY_ROUTING.xml
Sample Source Test Data XML Files for SAP Readiness Validator
The SAP Readiness Validator closely imitates the API invocations of the actual Enterprise Systems Integration business logic, but simplifies some of the processing, for example, by not using BAPI_TRANSACTION_ROLLBACK and not re-attempting API invocations upon timeout errors. This allows you to focus your troubleshooting efforts on the expected, correct SAP API functionality rather than exception conditions or complex programming logic in TIBCO BusinessWorks.
The SAP Readiness Validator will create actual business objects in your SAP distribution target system based on the data you specify in the source test data XML files.
* 
Do not perform these steps with production or business-critical systems. Instead, use development or sandbox systems that replicate the production environment as closely as possible.
User’s Guide
To use the SAP Readiness Validator, use the following procedure.
1. If you haven’t already, install TIBCO BusinessWorks and the TIBCO Adapter for SAP per the Windchill Enterprise Systems Integration Installation and Configuration Guide, you do not have to configure these products yet. The SAP Readiness Validator does not require TIBCO Enterprise Message Server or Windchill PDMLink. TIBCO TurboXML is optional.
2. Start TIBCO Designer.
3. Open the EAI Windchill Simulation module repository, called ESISimulationWindchillRepository_vxxx.dat, where xxx is a version number. This repository contains the functionality for the SAP Readiness Validator and exists entirely separately from the ESIMasterRepository.
4. Configure the SAP Readiness Validator global variable values from their default settings if required; for example, you will need to change the ESIValidatorDirectory global variable value if you are using a UNIX system.
Variable Name
Description
Possible Values
Default Value
ESIValidatorDirectory
The directory in which the EAI Windchill Simulation module will look for the source test data XML files.
Any valid directory.
c:\tibco\esi\SAPValidator\
ESIValidatorLogRole
Label which appears next to TIBCO BusinessWorks process engine log messages issued by the SAP Readiness Validator.
Any text string.
APITEST
SAP Readiness Validator Global Variables
The SAP Readiness Validator does not re-attempt API invocations upon timeout errors. RequestTimeout defines the time (in milliseconds) the TIBCO BusinessWorks process engine should wait for a response from an adapter before raising a technical error.
* 
Changes to global variable values do not take effect until the TIBCO BusinessWorks process engine is started (or restarted if it is already running).
5. Save the EAI Windchill Simulation module repository as a server-based repository.
6. Create the subdirectory on your operating system indicated by the value of the ESIValidatorDirectory global variable.
7. Copy the source test data XML files, listed in the table Sample Source Test Data XML Filesfor SAP ReadinessValidator from the Windchill Enterprise Systems Integration CDs into the subdirectory on your operating system indicated by the value of the ESIValidatorDirectory global variable.
8. Deploy the TIBCO Adapter for SAP instances for PartConfiguration, BOMConfiguration, DocumentConfiguration, and ECNConfiguration. For more information refer to the “Setting Adapter Configuration Parameters” section, in the Windchill Enterprise Systems Integration Installation and Configuration Guide.
9. Deploy a TIBCO BusinessWorks process engine as described in the Enterprise Systems Integration Installation and Configuration Guide
10. Determine which Windchill Enterprise Systems Integration business function test scenario you are going to run, and edit the contents of the corresponding test data XML files, per the table Sample Source Test Data XML Filesfor SAP ReadinessValidator.
Your test data conditions will depend on your particular Windchill Enterprise Systems Integration deployment. You must hard-code field values that are normally defaulted or cross-referenced by the actual Enterprise Systems Integration business logic. For guidance, refer to the following documentation:
You may edit the XML files directly, or using any XML editor. However, be sure to save the files in UTF-8 format.
11. Start the TIBCO Adapter for SAP instances and the TIBCO BusinessWorks process engine as described in the Enterprise Systems Integration Installation and Configuration Guide.
12. Execute your business function test scenario. Each SAP Readiness Validator process definition begins with a Rendezvous subscriber activity. You can trigger a desired process to execute by issuing a simple Rendezvous message at the operating system command line. On UNIX platforms, you should first navigate to the <Tibco_Home>/tibrv/<version>/bin directory. The format of the command is as follows:
tibrvsend [Subject] [Message]
where [Subject] is constructed as follows:
[Domain].[Action].[Object]
and [Message] is any message text string you like, such as "start"
For example, the following command will execute the Create Part test scenario in a TIBCO BusinessWorks Administration Domain named, "ABCDomain."
tibrvsend ABCDomain.Create.Part "start"
Note the following:
The SAP Readiness Validator will ignore any Rendezvous message that does not strictly adhere to these subject naming conventions. If your tibrvsend command fails to trigger execution of the corresponding BusinessWorks process, double-check the format of the command and try again.
[Domain] is the name of your TIBCO BusinessWorks Administration Domain.
The valid [Action]-[Object] pairs are as follows:
Business Function Test Scenario
[Action]
[Object]
Create / Change Part
CreateChange
Part
Create Part Revision
Create
Revision
Create BOM
Create
BOM
Change BOM
Change
BOM
Create Document
Create
Document
Create Document Revision plus Change Document plus, optionally, Add or Delete Document Links
Change
Document
Create CN
Create
ECN
Change CN
Change
ECN
Create Tooling of type Fixture
Create
Equipment
Change Tooling of type Fixture
Change
Equipment
Create ProcessPlan
Create
ProcessPlan
Change ProcessPlan
Change
ProcessPlan
[Action]-[Object] Pairs for tibrvsend Trigger Command
13. Verify successful execution of the test scenario. The SAP Readiness Validator logs the results of each API invocation in the TIBCO BusinessWorks process engine log. The log messages indicate whether the TIBCO Adapter for SAP was able to invoke each API ("technical success"), and whether the test data processed by that API resulted in a "functional success" based on the guidelines specified in the "SAP API Response Characterization" section of this document. The SAP Readiness Validator also logs additional debugging data where appropriate, such as the API return message from SAP, or the TIBCO BusinessWorks stack trace.
For example, the following messages will be written to the TIBCO BusinessWorks process engine log upon successful execution of the Create Part scenario.
2003 Sep 03 12:12:05:989 GMT -4 Engine APITEST [] PE-APITEST Job-100
[ProcessDefinitions/Services/Logging_Service/Log]: Create Part Step 1: BAPI_MATERIAL_SAVEREPLICA technical success.
2003 Sep 03 12:12:06:340 GMT -4 Engine APITEST [] PE-APITEST Job-1000
[ProcessDefinitions/Services/Logging_Service/Log]: Create Part Step 2: BAPI_MATERIAL_SAVEREPLICA functional success. TYPE=S, ID=MM, NUMBER=356, MESSAGE=The material STUBTEST1 has been created or extended
2003 Sep 03 12:12:07:872 GMT -4 Engine APITEST [] PE-APITEST Job-1000
[ProcessDefinitions/Services/Logging_Service/Log]: Create Part Step 3: BAPI_TRANSACTION_COMMIT technical success.
2003 Sep 03 12:12:08:072 GMT -4 Engine APITEST [] PE-APITEST Job-1000
[ProcessDefinitions/Services/Logging_Service/Log]: Create Part Step 4: BAPI_TRANSACTION_COMMIT functional success. TYPE=, ID=, NUMBER=000, MESSAGE=
In the following example, the API invocation of BAPI_MATERIAL_SAVEREPLICA was successful, but the TIBCO BusinessWorks process encountered a technical error upon invoking BAPI_TRANSACTION_COMMIT.
2003 Sep 03 12:49:27:646 GMT -4 Engine APITEST [] PE-APITEST Job-6000
[ProcessDefinitions/Services/Logging_Service/Log]: Create Part Step 1: BAPI_MATERIAL_SAVEREPLICA technical success.
2003 Sep 03 12:49:27:977 GMT -4 Engine APITEST [] PE-APITEST Job-6000
[ProcessDefinitions/Services/Logging_Service/Log]: Create Part Step 2: BAPI_MATERIAL_SAVEREPLICA functional success. TYPE=S, ID=MM, NUMBER=356, MESSAGE=The material STUBTEST1 has been created or extended
2003 Sep 03 12:49:40:305 GMT -4 Engine APITEST [] PE-APITEST Job-6000
[ProcessDefinitions/Services/Logging_Service/Log]: Create Part Step 3: BAPI_TRANSACTION_COMMIT technical FAILURE. StackTrace=Error in [ProcessDefinitions/SAPReadinessValidator/RV_Part_SAPCreateChange_PD/ Invoke_BAPI_TRANSACTION_COMMIT_BAPI_MATERIAL_SAVEREPLICA] for Job- 6000
activity timed out
at com.tibco.pe.core.Task.eval(Unknown Source) at com.tibco.pe.core.Job.a(Unknown Source)
at com.tibco.pe.core.Job.if(Unknown Source)
at com.tibco.pe.core.JobDispatcher$a.a(Unknown Source) at com.tibco.pe.core.JobDispatcher$a.run(Unknown Source)
If a scenario fails, there is a chance that the API invoke activities may freeze upon subsequent execution attempts. This may be due to the lack of BAPI_TRANSACTION_ROLLBACK invocations in the SAP Readiness Validator. If this occurs, restart the relevant adapter instance and try again.
14. Verify that the business object corresponding to the data you specified in the source test data XML files exists in SAP with the correct attributes, using the SAP transactions indicated in the table SAP Transaction Codesto Verify BusinessObject Creation.
15. Repeat steps 10-14 of this procedure for each of your test scenarios and conditions.
這是否有幫助?