Link Search Menu Expand Document

Template storage


tr. SMW0 is simple and convenient, the OAOR transaction is too complicated. Why is versioning of templates necessary?
Yes, we can partly agree with these statements.

When the template is pretty simple


Just look at him to understand:

  • on the SAP side we have a structure R which has a table field T
  • in addition, the structure has HEADER, DATE and TIME fields

Or after reading the ABAP code, it immediately becomes clear what we get on the output.

    " Load a template
    DATA(lo_xtt) = NEW zcl_xtt_word_docx(
        NEW zcl_xtt_file_smw0( iv_template_name ) ).

    lo_xtt->merge( VALUE #(
        " For printing
        footer = 'Footer'
        header = 'Header'
        " Date and time in header and footer
        date   = sy-datum
        time   = sy-uzeit

        " Main table
        t   = mt_alv[]
    ) ).

    " download & open in sap_tmp folder (For inplace mode use ->show( ) method)
    lo_xtt->download( ).

It doesn’t even matter what is the output format: word, excel or pdf (ZCL_XTT_WORD_DOCX, ZCL_XTT_EXCEL_XLSX or ZCL_XTT_PDF, respectively).
The main thing becomes clear the very structure of the output document. The rest can be understood by running the program.
More details here Example №02 Basic tables


But such cases are not always
For example when a template has many tables with groupings (level=0,1,2), with aggregation functions (func=SUM|AVG|COUNT|FIRST) and with conditional output (show_if & hide_if)
Just look at the template, and understand the report, probably already will not work

image More from Example №05 Tree (group by fields)


For this purpose, a new group of buttons has appeared in the editor menu for viewing and uploading templates
When downloading a new version of the template, you can add a small note (field Description)
If the file name does not match, you can select it in the drop-down list (Component name)


As in the case with the usual settings after reaching the maximum number of versions (default 5), previous versions will be deleted


The result can be seen in the OAOR transaction itself.


OAOR checks authority for a specific Class name (package in AQO), TODO ignore authorities?