The API of the dox42 Integration for SAP® Solutions allows users to add, remove and modify customized data in ABAP, as well as to generate dox42 documents from templates within the ABAP environment.
For demonstration purposes, you can refer to the sample report /CADAXO/D42_DEMO_HELLO_WORLD or start with Generating a document.
Working with PrintActions
Add and edit a configured PrintAction
It is possible to add and edit an already configured PrintAction in ABAP code as well.
" Creation of dox42 instance with Template Id 'HELLO_WORLD'
DATA(dox42_template) =
/cadaxo/cl_d42_manager=>create_template_instance( 'HELLO_WORLD' ).
" Read Default Print Action into Variable
DATA(default_print_action) = dox42_template->get_print_action( ).
" Modify Default Action
default_print_action-print_action_printer_name = 'OFFICE'.
" Set Print Action for Document Creation
TRY.
dox42_template->set_print_action( i_print_action = default_print_action ).
CATCH /cadaxo/cx_d42_rest_api.
ENDTRY.
Set another PrintAction by ID
It is possible to set another PrintAction by ID. This PrintAction must already be configured.
" Creation of dox42 instance with Template Id 'HELLO_WORLD'
DATA(dox42_template) =
/cadaxo/cl_d42_manager=>create_template_instance( 'HELLO_WORLD' ).
" Set Another Print Action by Id
TRY.
dox42_template->set_print_action_by_id( i_print_action_id = 'PRINT_ACTION2' ).
CATCH /cadaxo/cx_d42_rest_api.
ENDTRY.
" Read Current Print Action into Variable
DATA(default_print_action) = dox42_template->get_print_action( ). Working with ReturnActions
Add and edit a configured ReturnAction
It is possible to add and edit an already configured ReturnAction in ABAP code as well.
" Creation of dox42 instance with Template Id 'HELLO_WORLD'
DATA(dox42_template) =
/cadaxo/cl_d42_manager=>create_template_instance( 'HELLO_WORLD' ).
" Read Default Return Action into Variable
DATA(default_return_action) = dox42_template->get_return_action( ).
" Modify Default Action
default_return_action-return_action_filename = 'EditedFileName'.
" Set Return Action for Document Creation
TRY.
dox42_template->set_return_action( i_return_action = default_return_action ).
CATCH /cadaxo/cx_d42_rest_api.
ENDTRY.Set Another ReturnAction By ID
It is possible to set another ReturnAction by ID. This ReturnAction must already be configured.
" Creation of dox42 instance with Template Id 'HELLO_WORLD'
DATA(dox42_template) =
/cadaxo/cl_d42_manager=>create_template_instance( 'HELLO_WORLD' ).
" Set Another Return Action By Id
TRY.
dox42_template->set_return_action_by_id( i_return_action_id = 'RETURN_ACTION2' ).
CATCH /cadaxo/cx_d42_rest_api.
ENDTRY.
" Read Current Return Action into Variable
DATA(default_return_action) = dox42_template->get_return_action( ). Working with SaveActions
Add and edit a configured SaveAction
It is possible to add and edit an already configured SaveAction in ABAP code as well.
" Creation of dox42 instance with Template Id 'HELLO_WORLD'
DATA(dox42_template) =
/cadaxo/cl_d42_manager=>create_template_instance( 'HELLO_WORLD' ).
" Read Default Save Action into Variable
DATA(default_save_action) = dox42_template->get_save_action( ).
" Modify Default Action
default_save_action-save_action_filename = 'C:\DOX42SERVER\TEMPLATES\EDITED_HELLOWORLD.PDF'.
" Set Save Action for Document Creation
TRY.
dox42_template->set_save_action( i_save_action = default_save_action ).
CATCH /cadaxo/cx_d42_rest_api.
ENDTRY.Set another SaveAction by ID
It is possible to set another SaveAction by ID. This SaveAction must already be configured.
" Creation of dox42 instance with Template Id 'HELLO_WORLD'
DATA(dox42_template) =
/cadaxo/cl_d42_manager=>create_template_instance( 'HELLO_WORLD' ).
" Set Another SaveAction by Id
TRY.
dox42_template->set_save_action_by_id( i_save_action_id = 'SAVE_ACTION2' ).
CATCH /cadaxo/cx_d42_rest_api.
ENDTRY.
" Read Current Save Action into Variable
DATA(default_save_action) = dox42_template->get_save_action( ). Working with input parameters
Add and edit a configured input parameters
It is possible to add and edit already configured input parameters in ABAP code as well.
" Creation of dox42 instance with Template Id 'HELLO_WORLD'
DATA(dox42_template) = /cadaxo/cl_d42_manager=>create_template_instance( 'HELLO_WORLD' ).
" Overwrite Value from Customizing with Edited Value
dox42_template->set_input_parameter(
i_input_parameter = VALUE #(
parameter_name = 'I_PARAMETER'
parameter_value = 'Edited Value' ) ).
" Set New Input Parameter
dox42_template->set_input_parameter(
i_input_parameter = VALUE #(
parameter_name = 'I_SECOND_PARAMETER'
parameter_value = 'Another Value' ) ).