Learn how to generate your first document using the dox42 Integration for SAP® Solutions.
Steps
Execute the transaction
/CADAXO/D42_CUSTin order to open the Integration.Go to the dox42 Server node and ensure that at least one dox42 Server is defined. If no server is defined, see the system requirements.
On YourServer, store the ‘HelloWorld.docx’ template in the folder of the dox42 Server installation, for example:
dox42Server/templates/HelloWorld/HelloWorld.docxNote
The ‘HelloWorld.docx’ template is supplied with the dox42 Integration for SAP® Solutions. It is a simple Word document containing just a single line of text: <Screenshot HelloWorld.docx>
Remember the path where you stored the template, as it will be needed in the next step.
Configure the path to the template in the Template Path subnode:
Parameter
Description
Logical systemLogical system ID of your SAP system.
If both dox42 Server and dox42 Online are used within the same logical system, the template path can be differentiated using the dox42 Server ID.Template PathFolder path on the dox42 Server where the templates are stored.
Template paths must begin with “/”. This refers to the root directory of the dox42 Server installation. For example:
/templates/HelloWorld/
ActiveSet your Template Path as active by selecting the checkbox.
Configure the template in the Templates node:
Parameter
Requirement
Description
Template Idmandatory
Identification used for internal purposes only. In this case:
HELLO_WORLD
Template Namemandatory
Name of the template file stored on the dox42 Server. In this case:
HelloWorld.docx
dox42 Server IDmandatory
Choose a dox42 Server as defined in the dox42 Server node
Operationmandatory
Choose what kind of document will be generated. In this case:
GENDOC - Generate Document
Activemandatory
Set your template as active by selecting the checkbox.
Make sure your newly configured template is selected in the Templates node.
Configure the ReturnAction in the ReturnAction subnode:
Parameter
Requirement
Description
ReturnAction Idmandatory
Identifier for internal use. In this case:
RETURN_ACTION1
Defaultoptional
When checked, this ReturnAction is set to default.
Formatmandatory
Defines how the generated document should be returned. In our case:
doc (the document will be returned in a DOC file format)
Activeoptional
Set your configuration as active by selecting the checkbox.
You can now generate your first ‘Hello World’ document. In order to do so,
go back to SAP,
create a Z_HELLO_WORLD report (e.g., as a local object: $TMP) and
execute the following code:
REPORT Z_HELLO_WORLD. TRY. " Create a dox42 template instance with Template ID 'HELLO_WORLD' DATA(dox42_template) = /cadaxo/cl_d42_manager=>create_template_instance( 'HELLO_WORLD' ). " Create a document instance DATA(dox42_document) = dox42_template->create_document( ). CATCH /cadaxo/cx_d42_rest_api INTO DATA(lx_error). WRITE: lx_error->get_text( ). RETURN. ENDTRY. " Display the document in SAP GUI dox42_document->display_gui( ).
Result
You have successfully generated your first document and returned it to your SAP system.