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 field must be included in the
communication structure.
- The field is NOT included in the
form
- The field can be attached to an existing one
in the form.
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:
- the printing is to depend on requirements not
taken into account before
- the printing sequence is to differ in the MAIN
window
- the system must read additional data
Basics of
system modification for printing documents
- The following communication structures are
available for printing documents:
- VBDKA (Document header view for inquiry,
quotation, order)
- VBDPA (Document item view for inquiry,
quotation, order)
- VBDKL (Document header view for delivery
note)
- VBDPL (Document item view for delivery
note)
- VBDKR (Document header view for billing
document)
- VBDPR (Document item view for billing
document)
- You enter new fields for document printing in
the following INCLUDES:
- Sales order documents - header data: VBDKAZ
(in VBDKA)
- Sales order documents - item data: VBDPAZ (in
VBDPA)
- Delivery documents - header data: VBDKLZ (in
VBDKL)
- Delivery documents - item data: VBDPLZ (in
VBDPL)
- Billing documents - header data: VBDKRZ (in
VBDKR)
- Billing documents - item data: VBDPRZ (in
VBDPR)
- Values are assigned to fields in the
communication structures via the function modules. In the function modules,
there are three user exits available per document type to assign values to the
fields created.
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:
- Sales order documents - header
data:
V05DZZAK
- Sales order documents
(postprocessing):
V05DZZEN
- Sales order documents - item data:
V05DZZAP
- Delivery documents - header data:
V05OZZLK
- Delivery documents
(postprocessing)
V05OZZEN
- Delivery documents - item data:
V05OZZLP
- Billing documents - header data:
V05NZZRK
- Billing documents (postprocessing)
V05NZZEN
- Billing documents - item data:
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:
- In the case of identical field
name
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.
- In the case of a different field name
(starting with "ZZ"):
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:
- These texts must be created using S010 and
assigned to a text ID.
- These texts must be asigned to a sales
organization and sales office (see Customizing for output determination:
Output -> Form definition -> By sales organization and sales
office)
- The texts for the sales organization are read
automatically in the sales order, delivery and billing document.
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.
- The RETURN_CODE controls whether the print was
successful. It can take on the following values:
0 = successfully
processed
1 =
incorrect
3 = document
incomplete (VSTAT in NAST is not replaced)
- Parameter US_SCREEN controls where the
document is issued.
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:
- opening and closing of documents
- sequence in which document text elements are
called up
- general header fields issued (title, validity
period, header text)
- processing after the items (totals, text
supplements)