Show TOC

New Fields For Printing Documents

General procedure during printing

During the printing of forms, data retrieval and the editing of data are two separate steps. This allows you to distinguish between two areas of responsibility. One employee might define the possible fields of a form , while another edits the layout according to marketing criteria.

You can carry out the specific control of the printer using the SAPscript form which is independent of the print program. Fixed page elements (for example, company addresses, footnotes) can be issued using texts defined in the form.

Modifications when printing documents

There are two different types of modification in the area of document printing concerning the type and scope of modification.

1. 1st level modifications
Simple modifications that require no editing logic and do not enter new fields in a communication structure can be carried out directly in form processing using SAPscript. These are form modifications. They are carried out under the following circumstances:
The procedure is described for this type of modification using example 3 (see below).
Note
SAP recommends that you do not make changes to the standard forms and always use test forms for modifying forms.
For further information on how to define and edit forms, see the section "Processing output and forms". For further information on SAPscript, see the online documentation in Basis Components -> Basis-Services / Communication on word processing in the SAPscript editor as well as style and layout set maintenance.
2. 2nd level modifications
You must make more complex modifications if a field is neither included in the communication structure nor in the form. In these cases, the relevant field must be entered in the communication structure using the INCLUDES intended for this purpose. This type of printing modification is described in detail below.
Under certain circumstances it may be necessary to amend the data collection report or programs. This is the case if:

Basics of system modification for printing documents

The first two user exits run when the system reads the document header or the item . They contain a MOVE-CORRESPONDING, which automatically assigns values to all fields with identical names.
The third user exit (V05...EN) is executed at the end of the program for postprocessing the view data before leaving the function module. It is used to assign values to fields to which the user exits for header or item did not assign values.
The following user exits are relevant:
V05DZZAK
V05DZZEN
V05DZZAP
V05OZZLK
V05OZZEN
V05OZZLP
V05NZZRK
V05NZZEN
V05NZZRP

Example 1

The posting period (POPER) is to be printed in the billing document header. Depending on whether the field name is identical with the name of the SAP field, proceed as follows:

Enter field POPER in INCLUDE VBDKRZ (in communication table VBDKR) and assign data element POPER to it.
Since the field names are identical, a value is assigned to the field automatically using MOVE-CORRESPONDING.
Enter field ZZPOPER in INCLUDE VBDKRZ (in communication structure VBDKR) and assign data element POPER to it.
Since the field names are not identical, assign a value to the field using the following statement in user exit V05NZZRK:
MOVE VBRK-POPER TO VBDKR-ZZPOPER.

Example 2

If fields appear in both the item and header, you can define in the third user exit (V05...EN) of the relevant function module the logic according to which the header field is assigned a value from the item.

In this case, you must define the logic for issuing in the printing program or the document. In the document, the value assignment may, for example, be as follows:

/: IF NE
/ &'Different sales group' VBDPR-ZZVKGRP&
/: ENDIF.

In the second example, the sales group (ZZVKGRP) is to be printed in the billing document header. The sales groups which differ from the header, are to be issued at item level.

1. Enter field VKGRP in INCLUDE VBDPRZ (in communication structure VBDRK) and assign data element VKGRP to it.
2. Assign the following statement to the field in the user exit V05NZZRP:
MOVE VBRP-VKGRP TO VBDRP-ZZVKGRP.
3. Enter field ZZVKGRP in INCLUDE VBDKRZ (in communication structure VBDRK) and assign data element VKGRP to it.
4. To issue the sales group at header level you must assign a value to it at header level. To do this, enter the following statement in user exit V05NZZEN:
READ TABLE LVBDPR INDEX 1.
MOVE LVBDPR-ZZVKGRP TO VBDKR-ZZVKGRP.
Thus, the sales group is copied from the first item to the header.

Example 3

In the third example, new texts should be defined and used depending on the company structure:

1. Data collection
If texts vary according to the company structure (e.g. sales organization, sales office), they must be issued from the data collection report by INCLUDE using text numbers. If, for example, sales office texts are to be read and issued on the order confirmation (instead of the sales organization texts), data collection must be amended according.
This takes place in program RVADOR01 for the order confirmation. There the form routine SENDER receives the sales organization in the standard system. If the requested modification should be carried out, this should be done into the sales office OR sales organization AND sales office.
2. Editing data
The sequence of the output of text elements in the MAIN window is controlled by the program. If you require a different sequence, it should be amended in the printing program. Data is edited by means of the include
INCLUDE OBJECT TEXT ID SDVD PARAGRAPH XX
For further information on editing data, see the SAPscript documentation.

Procedure for entering new fields for printing documents

To print documents (sales documents, for example) proceed as follows:

1. SAPMV45A
The function code FCODE_DRCK initiates the procedure.
2. SAPLVMSG
You can call up the function code using RV_MESSAGE_PRINT_SINGLE, which selects a NAST record. The NAST record contains the control data necessary for the printing of a document at a particular time.
3. RVNAST00 (call by external PERFORM from RV_MESSAGE_PRINT_SINGLE)
In the form routine EINZELNACHRICHT_DIALOG, the table TNAPR is read which specifies for each output condition type which program, form routine and form are relevant.
4. RVADOR01 (printing report, call by external PERFORM)
Printing report RVADOR01 is called up from FORM routine EINZELNACHRICHT_DIALOG. The printing report controls the main transactions relevant for the printing of documents.
In the standard system FORM routine ENTRY is used to call up the print program. If other FORM routines are to be used, they have to be stored in table TNAPR. The call contains two USING parameters.
0 = successfully processed
1 = incorrect
3 = document incomplete (VSTAT in NAST is not replaced)
not blank = issued to the screen
blank = issued to the printer
5. PERFORM PROCESSING (call by FORM routine ENTRY in RVADOR01) controls the following transactions during the printing of documents: