How to check whether a field in word template is filled correctly by web service
Requirement: when you create a attachment based on a web service enabled word template for a business transaction for example service contract:
In case you don’t know how to create a web service enabled document, please refer to these two blogs:
- Create Webservice enabled word document in attachment assignment block
- Create Webservice enabled Adobe PDF attachment in CRM Application
You click button “With Template” and choose one template from pop up window:
when the final rendered document is opened, some field is empty which is not what you expect. You need to analyze whether the field is correctly filled by your web service or not.
This document describes the step how you could check it by yourself.
Step1: identify the web service which is assigned to document template. In this example, the technical name of document is SERVICE_CONTRACT_TEMPLATE1.
Work center “Service Operations”->Click Search: Document Templates:
Find the document by name, and click Edit button:
write down the web service name ZWS_SERCONTRACT for further usage. Click button “Start Designer” to identify the binding path of the empty node.
And here we identified the path of empty field in document template is： -crmost_-zwsSercontractReadResponse-Output-ZwsSercontract-Administrativeheaderoforder-itemsofheader-Allitemsoforder-Guid
Step2: go to SAPGUI, use transaction code SE80 to open package $WS_BOL_GEN:
find the automatically generated function module for your web service. The technical name of web service you identified in step1 will behave as a part of function module description. Click tab “Source code” to view the function module source code:
Set a breakpoint on method “CALL METHOD lr_bsdm_runtime
->read_get_nested_data”. The data source of your word document is stored in variable lr_output_ref( line 88 in below screenshot ).
Step3: Create a new attachment in UI. The breakpoint will be triggered.
Check according to the path identified in step2.
In this example, we can find that the guid field is correctly filled by web service read operation.