3.1.3 Printing program

Obligatory sections of printing program:

·        declaration of a variable (context), using ABAP-dictionary type;

·         implementation of logic for filling the variable (context);

·         call a function module 'ZXLWB_CALLFORM', passing the variable (context) and form name as importing-parameters.

Example of a simplest printing program:

REPORT  z_shipping_label.

* declare a context
DATA gs_context   TYPE zcontext_shipping_label .

* fill the context
gs_context-to_name    = 
'Dan Tedford' .
gs_context-to_street  = 
'811 Alworth Avenue.
gs_context-to_town    = 
'Middlefield' .
gs_context-to_state   = 
'CA' .
gs_context-to_zip     = 
'98567' .

* call the form
    iv_formname    = 
    iv_context_ref = gs_context
OTHERS         = 2.
IF sy-subrc NE .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 .

Result of the printing program execution:

We see a screen of the viewer containing an application toolbar and a container in which is inscribed OLE-object Excel.