Enhancing Output Determination
Enhancing Output Determination
Enhancing Output Determination
SAP and R/3 are the trademarks or registered trademarks of SAP AG in Germany and in several other countries.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
Enhancing Output Determination
Enhancing Output Determination ............................................................................................. 3
Condition Usage Code .............................................................................................................. 3
Application Area....................................................................................................................... 4
Application Areas Relevant for Output Determination ........................................................ 4
Communication Structures........................................................................................................ 6
Communication Structures by Application Area.................................................................. 8
The Field Catalog.................................................................................................................... 10
Field Catalog Structure ....................................................................................................... 10
Maintaining the Field Catalog ............................................................................................ 12
Building Condition Tables.................................................................................................. 14
Processing Function Modules ................................................................................................. 15
Relevant OSS Notes................................................................................................................ 15
Process Flow ........................................................................................................................... 15
Step 1 Filling the Header Structure................................................................................ 17
Step 2 Call Function COMMUNICATION_AREA_KOMKBV1 ................................ 18
Step 3 Call Function KOMKBV1_FILL ....................................................................... 19
Step 4 Filling the Item Structure .................................................................................... 20
Step 5 Call Function COMMUNICATION_AREA_KOMPBV1................................. 21
Step 6 Call Function KOMPBV1_FILL ........................................................................ 22
Step 7 Call Function MESSAGING .............................................................................. 23
Sales Order Confirmation Output Enhancement Example ..................................................... 24
Business Requirement......................................................................................................... 24
Solution ............................................................................................................................... 24
Step 1 Create a new field for use in Output Determination ........................................... 25
Step 2 Make ZZ_RTI_ORDER available to the field catalog ....................................... 27
Step 3 Populating the ZZ_RTI_ORDER indicator ........................................................ 29
Step 4 Adding ZZ_RTI_ORDER to the field catalog.................................................... 31
Step 5 Building the new condition table ........................................................................ 32
Step 6 Adding the new condition table to the access sequence ..................................... 33
Step 7 Creating a Sales Rep customer master................................................................ 34
Step 8 Maintaining the condition record........................................................................ 35
Billing Output Enhancement Example ................................................................................... 37
Business Requirement......................................................................................................... 37
Solution ............................................................................................................................... 37
Step 1 Create a new field for use in Output Determination ........................................... 38
Step 2 Populating the AUART field .............................................................................. 40
Step 3 Build the Requirement Routine .......................................................................... 42
Step 4 Assigning the routine to an output type .............................................................. 44
Step 5 Testing the process.............................................................................................. 45
Step 6 Running the VOFM regeneration ....................................................................... 46
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Enhancing Output Determination
Output Determination is one of several functions that use the R/3 condition technique. The
purpose of this document is to demonstrate how to enhance output determination using the
standard user exits built into R/3. In many cases, designing a successful enhancement
requires both functional configuration and program logic. This document explains the user
exit functionality, and then details two sample enhancements taken from actual projects. The
examples were built on a 4.6C system.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Application Area
The Application Area subdivides the condition usage of the condition technique (for
example, sales order, billing, purchase order). The communication structures and processing
functions for output determination are built separately for each application area. Table
T681A contains all application areas defined in R/3. Table T681Z contains the subset of
those application areas that are relevant for output determination. The following list is from
T681Z.
Area Description
CF Error control
CV Document administration
DB Customers
E1 Inbound delivery
EA Purchasing RFQ
EF Purchase Order
EL Purchasing Scheduling Agreement Release
ES Data entry sheet
EV Purchasing Outline Agreement
K1 Sales activities
M1 Rough Goods Receipt
MD Direct buying
ME Inventory management
MR Invoice verification
NF Nota fiscal
P1 Direct Manufacturing
PA JIT call
RS Automotive
V1 Sales
V2 Shipping
V3 Billing
V4 Shipping (Special case)
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Area Description
V5 Groups
V6 Handling units
V7 Transport
W0 All. table Group
W1 Sales promotion group
WA Allocation table
WB Retail promotion
WE Labeling
WN Free Sett. Rel. Del.
WR Agency Business
WS Free Sett. Agreement
WT Trading contract
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Communication Structures
R/3 uses work areas called communication structures to pass data from the calling
application to the output determination functions. There are separate structures for header
and item data (when relevant). In many cases, the communication structures contain special
includes for customer specific enhancements. Only these special includes should be modified
by the customer. The following example is the delivery header communication structure. The
first screen displays the top portion of the structure.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Towards the bottom of the structure, the include for customer enhancements is found
(KOMKBZ4). These includes always contain the field DUMMY. This field exists because in
earlier versions of R/3, the data dictionary did not allow structures that contained no fields.
SAP put the DUMMY field into these structures just to get around this requirement. When
customer specific fields are added to these structures, the DUMMY field should be deleted.
On several occasions, we have seen programmers actually leave the DUMMY field as is, but
use it as an indicator for some purpose. We strongly recommend that this practice not be
used. If a field is required, it should be created with a relevant name and data element.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Area Header Structure Item Structure
W1
WA KOMKBWA KOMPBWA
WB KOMKBWB KOMPBWB
WE KOMKBWE
WN KOMKBWN
WR KOMKBWR KOMPBWR
WS KOMKBWS
WT KOMKBWT KOMPBWT
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
In this example, the KOMBZ include has been modified with several new fields. The
DUMMY field was removed.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
The field catalog maintenance program is a standard SM30 screen that maintains table
T681F. All field catalogs used in the condition technique are contained in T681F. The high
order keys of this table are the condition usage code and application area. Since this
transaction maintains the field catalog for sales orders, the T681F entries maintained are from
condi t
ionus ag ec ode‘ B’a nda ppl i
c at
iona rea‘V1’ .Whi l
ea ddi
ngf ields,theva lidf ie
ldl ist
consists of the fields in the field catalog structure (KOMB).
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Note Description
32662 User name added to new condition table
39462 Expand field catalog in message determination
159684 Not all fields are displayed in condition table
Process Flow
The following diagram and screen shots illustrate how the processing functions are called
using sales order output as an example.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Program SAPMV45A
FUNCTION COMMUNICATION_AREA_KOMKBV1
FUNCTION COMMUNICATION_AREA_KOMPBV1
FUNCTION MESSAGING
Executes the condition techniique routines for output
determination using the filled data areas.
FUNCTION KOMKBV1_FILL
FUNCTION KOMPBV1_FILL
Form Routines
FORM USEREXIT_KOMKBV1_FILL.
* ........
END FORM.
FORM USEREXIT_KOMPBV1_FILL.
* .......
END FORM.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Business Requirement
During order entry, the system has been configured to generate an order confirmation using
the standard configuration. The order confirmation is sent to the customer. The company has
introduced a new product line and wants to re-direct the order confirmations to an internal
sales person for all orders that contain at least one of the new products. All of these
confirmations are to be emailed to the same sales person.
Solution
To solve this problem, a new condition table will be added to the access sequence for the
order confirmation. A condition record will be found only if one of the new products is
contained in the order. The table will be positioned first in the access sequence and when
accessed successfully, the remaining tables will not be processed. A field will be created to
denote that one of the new products is present on the order. A user exit will be written to
examine the materials on the order, and set the indicator accordingly.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Using the customer modification structure KOMKBZ3, new field ZZ_RTI_ORDER was
added. This field is an indicator that will be set if the sales order contains an item for the
special subset of materials.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Using the customer modification structure KOMBZ, new field ZZ_RTI_ORDER was added.
This field is an indicator that will be set if the sales order contains an item for the special
subset of materials.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
In this user exit, the new logic loops thru the items (COM_VBAP_TAB) and using the
product hierarchy, determines if any of the new products exist on the order. If any are found,
the ZZ_RTI_ORDER indicator i ssett o‘X’ .
Note that no data base selects are required for this. The most common error made with these
enhancements is the programmer redundantly selecting data that already resides in memory.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Business Requirement
Thec ustome rha sde finedas pe cial‘Noc ha rge’or dertypet hatisused to ship sample
products. For these orders, billing output is to be suppressed. The billing type associated with
these orders is the standard F2.
Solution
To solve this problem, an output requirement routine will be coded and assigned to the output
type within the relevant output determination procedure. Within this routine, we need to
examine the sales order type associated with the invoice. Unfortunately, the order type is not
included in the communication structures used for billing output. Therefore, a user exit will
be coded to provide it.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Using the customer modification structure KOMKBZ5, the order type field AUART was
added.
There are many who debate whether or not a standard field name (i.e. AUART) should be
specifiedi naus ere xitstruc t
ure.Eve nSAPwoul dproba blyre comme ndus inga‘ Z’f ield( i
.e.
ZZAUART). They will argue that if SAP were to add the standard field in a future release, a
syntax error would result. While true, we feel that ending up with redundant fields is worse
than fixing a syntax error. To correct the error would simply require that the field be deleted
from the user exit structure.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
In this user exit, the new logic determines the sales order type and moves it to the
KOMKBV3 communication structure.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
One line of code was added to each form routine to check the sales order type. When it is
ZNC, the return code will be set to 4 and the output will not be sent.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
Note: This is a critical step that should not be overlooked. If this step is not executed, short
dumps can be the result.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com
Enhancing Output Determination
The RV80HGEN completed.
Copyright © 2004 The Smith Consulting Group, Inc. All Rights Reserved.
SAPtechsolutions.com