Show TOC

Copy Customer Master Fields Into The Sales Document

Procedure for copying customer master fields to a sales document

Copying customer master fields to a sales document is carried out in two steps:

1. A field in the customer master table (KNA1 or KNVV) is first copied by INCLUDE (KUAGVZ, KUWEVZ, KURGVZ and KUREVZ) to the sold-to party, ship-to party or payer view(KUAGV, KUWEV, KURGV or KUREV). A value is assigned to the field via a user exit (V05...).
2. The field is copied to the sales order table (VBAK, VBKD or VBAP) from the respective customer view (KUAGV, KUWEV, KURGV or KUREVZ). A value is assigned to the field via a user exit in program MV45AFZZ (USEREXIT_MOVE_...).

Note
You can create new fields (ZZ...) in an existing table. This does not cause problems during puts because the additional fields are put at the end of the table and the name range cannot be overwritten. Make certain that field names begin with "ZZ"

Example:

The copied fields are placed at the end of the table (before the put)

vbak-standard1
vbak-standard2
vbak-standard3
vbak-zzmodif1 <<< additional fields
vbak-zzmodif2 <<< copied

The fields are not overwritten by the put; the new SAP fields are added (after the put)

vbak-standard1
vbak-standard2
vbak-standard3
vbak-zzmodif1 <<< additional fields
vbak-zzmodif2 <<< copied
vbak-standard4 <<< new
vbak-standard5 <<< standard fields

Overview of basics on copying data

The INCLUDE KUAGVZ contains the reserve fields from the customer master KUGR1-KUGR5, which are described in the step "Reserve fields in the customer master". If the fields are to be used, they no longer need to be included in the view.
Sold-to party data:
V05EA1AG (user exit for sold-to party when reading KNA1)
V05EZZAG (user exit for sold-to party when reading KNVV)
Ship-to party data:
V05EA1WE (user exit for ship-to party when reading KNA1)
V05EZZWE (user exit for ship-to party when reading KNVV)
Payer data:
V05EA1RG (user exit for payer when reading KNA1)
V05EZZRG (user exit for payer when reading KNVV)
Bill-to party data:
V05EA1RE (user exit for bill-to party when reading KNA1)
New fields defined with the same name are automatically transported there by MOVE CORRESPONDING. Otherwise they must be transported manually.
The routines for assigning values to the fields in the sales document can be found in the program MV45AFZZ. Enter the new field names here (beginning with "ZZ".
USEREXIT_MOVE_FIELD_TO_VBAK
USEREXIT_MOVE_FIELD_TO_VBAP
USEREXIT_MOVE_FIELD_TO_VBKD

Copy customer master fields to sales documents

Fields can be copied to the sales document from the master records of the sold-to party, ship-to party and payer. You have the following possibilities:

Case 1: KNA1 -> VBAK

You can include a field from the sold-to party (general data) in the sales document header.

Case 2: KNVV -> VBAK

You can include a field from the sold-to party (SD data) in the sales document header.

Case 3: KNA1 -> VBKD

You can include a field from the sold-to party (general data) in the sales document (business data).

Case 4: KNVV -> VBKD

You can include a field from the sold-to party (SD data) in the sales document (business data).

These possibilities exist for copying fields from the sold-to party to the sales document item (VBAP).

These possibilities exist for the ship-to party as well as for the payer.

Case 1: Copy sold-to party field (KNA1) -> sales document header (VBAK)

You want to use a sold-to party field (KNA1) in the sales document header (VBAK). There are two possibilities for copying fields. They are distinguished by the way in which values are assigned to fields.

Proceed as follows:

1. Make sure that the field exists in the sold-to party view KUAGV. If necessary, enter it in KUAGVZ (= INCLUDE in KUAGV).
2. Activate the structure.
3. The way in which a value is assigned to the new fields in the sold-to party view (KUAGV) depends on whether the names are the same.
4. Finally, you must assign a value to the field in the sales document header.
You do so in program MV45AFZZ in user exit USEREXIT_MOVE_FIELD_TO_VBAK. The statement is, for example:
FORM USEREXIT_MOVE_FIELD_TO_VBAK.
VBAK-ZZFELD3 = KUAGV-ZZFELD.
ENDFORM.

Proceed in the same way for cases 2-4:

Case 2: Copy sold-to party field KNVV -> sales document header VBAK

Include the field in KUAGVZ if it is not contained in KUAGV. Assign a value to the field in MV45AFZZ in USEREXIT_MOVE_FIELD_TO_VBAK. If the names are not the same, do so in V05EA1AG.

Case 3: Copy sold-to party field KNA1 -> sales document VBKD

Include the field in KUAGVZ if it is not contained in KUAGV. If the names are not the same, assign a value to the field in V05EA1AG and in MV45AFZZ in USEREXIT_MOVE_FIELD_TO_VBAP.

Case 4: Copy sold-to party field KNVV -> sales document VBKD

Include the field in KUAGVZ if it is not contained in KUAGV and assign a value to it in MV45AFZZ in USEREXIT_MOVE_FIELD_TO_VBAP. If the names are not the same assign a value to the field in V05EA1AG in USEREXIT_MOVE_FIELD_TO_VBAP.

Note

Proceed in the same way to copy fields from the ship-to party or the payer to the sales document. You will find the necessary information in the above basics on copying data.