The 3 ways to Mass Update Contacts of Customer in SAP

Update Contacts of Customer: One of recurrent business requirement in SAP ECC is mass update Contacts for Customer in SAP.
The Standard way with Batch input is tricky and has low performance. In this post, I will give a technical overview of Customer’s Contacts then go through different method to Update Contacts of Customer.

This article covers :

Overview of Customer’s Contacts

Technical Side of Customer’s Contacts

Important Tables and tcodes for Customer’s Contact

The main table for Customer in SAP SD is KNA1 for Master Data Centrally.
and The table KNVV handle the Sales Area openend for Customer.

The table KNVP is for function Partner.

TableDescription
KNA1General Data in Customer Master
KNB1Customer Master (Company Code)
KNVVCustomer Master Sales Data
KNVPCustomer Master Partner Functions
KNVPCustomer Master Partner Functions

The VD0* and XD0* are the main tcode to maintain Customer.
Contact Persons are maintained through VAP*

TcodeDescription
XD01Create Customer (Centrally)
XD02Change Customer (Centrally)
XD03Display Customer (Centrally)
VD01Create Customer (Sales)
VD02Change Customer (Sales)
VD03Display Customer (Sales)
VAP1Create Contact Person
VAP2Change Contact Person
VAP3Display Contact Person


Important Tables and tcodes for Partner Function

The Partner Function (PARVW) pilots the type of Relation between Customer and Partner.
The main table for Function Partner Type are: TPAR.
In this table TPAR, Partner function are defined and typed ( NRART ).

The whole list of Partner function Type are (TVPA):

TypeDescriptionrelated table
AWork centerPLOGI
APContact PersonsKNVK
KUCustomerKNA1
LIVendorLFA1
LSLogical systemTBDLS
MAMail Address
MPMail Partner
OOrganizational UnitPLOGI
PEPersonnel NumberPREL
SPositionPLOGI
USUserUSR03
VSShipping PointTVST
WKPlantT001W

Once the Partner Function are defined, it has to be maintain and associated to Partner Determination Procedure.
To access the Partner Determination Procedure with SPRO, go to
Sales and Distribution > Basic Functions > Partner Determination > Set Up Partner Determination.
Select the activity Set Up Partner Determination for Customer Master

If you want to retrieve the allowed Function Partner from A Customer Account Group follows these steps:
1- Retrieve the Customer Account Group KTOKD from KNA1.
2- Retrieve the Partner Determination Procedure PARGR from TKUPA
3- Retrieve the list of Partner Function PARVW from TPAER
4- the description of functions are in TPART.

The main tables for Function Partner configuration are:

TableDescription
TKUPA Business Partners: Customer Master Groups
TPARBusiness Partner: Functions
TPARTBusiness Partner Functions: Texts
TPAERBusiness Partner: Functions in Partner Determination Proced.

Mass Update Contacts of Customer

Batch-Input

Batch Input is the most standard way to Update Contacts of Customer in ECC including updating Partner functions.
Use SHDB to make a Transaction Record from XD02/01 or VD01/02
Then generate the Program and updated to your need.

Cons
When it comes to manage multiple partner function with Batch Input, it becomes harsh ( difficile ).
Actually you have to manage the position of Cursor because the view is based on Tab componant in the Customer DynPro.

This is a simple way to handle cursor:

Manage Cursor for Deleting

Manage Cursor for Inserting

1- Count of existing function partners for Customer/ Sales Area
DESCRIBE TABLE pt_knvp LINES lv_count.

2- Get Number of last page when you can add the Relation
pv_page_new = lv_count DIV 15.

Why 15 ?

Because, in the standard dynpro used in Batch Input for Update Contacts of Customer, the table control has 15 lines.

3- Get the position of inserting within this page
lv_last_numb = lv_count MOD 15.
ADD 1 TO lv_last_numb.

4- Build the cursor position

5- Scroll to the insertion page

6- Set the Cursor and the value

CMD_EI_API

CMD_EI_API is the SAP standard Class build as Customer Processing APIs.
It proposes by SAP as a remplacement for the Batch Input of Customer handling.

The main methods for this class are:
– cmd_ei_api=>initialize( ) : initialise the class API
– cmd_ei_api=>lock( iv_kunnr) : Lock the customer.
– cmd_ei_api=>maintain_bapi : Create/Update/Delete Customer General Data/Sales Data.
– cmd_ei_api=>unlock(iv_kunnr): Unlock the customer.

A Sample example for uploading Contacts with CMD_EI_API Class is in this link
Update Customer with CMD_EI_API

Direct Table Update ( not recommended )

It is not the standard way to Update Contacts of Customer but it can be a solution for
– mass uploading contacts
– improving performance
– bypassing standard control.

This method stands on direct update the KNVP table.
MODIFY KNVP FROM TABLE LT_KNVP_NEW[].

First, the data must be prepared in order to prevent errors.
a Special care goes to PARZA field ( Partner counter ). Actually, if the function partner appears more than one time for KUNNR/VKORG
( Customer / Commercial Organization), the counter of this role must be incremented.

Here a sample Code to to mass upload “Personnel Numbers” (PERNR) for customer:
Mass Update Personal Numbers of Customer KNVP

Sab125

Hi. I have been working as SAP Technical and functional for a decade. Through this blog, I am trying to share with you my experience. Hopefull, it makes your ways easier path ...Sab