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 :
The main table for Customer in SAP SD is KNA1 for Master Data Centrally.
and The table KNVV handle the Sales Area opened for Customer.
The table KNVP is for function Partner.
Table | Description |
---|---|
KNA1 | General Data in Customer Master |
KNB1 | Customer Master (Company Code) |
KNVV | Customer Master Sales Data |
KNVP | Customer Master Partner Functions |
KNVP | Customer Master Partner Functions |
The VD0* and XD0* are the main tcode to maintain Customer.
Contact Persons are maintained through VAP*
Tcode | Description |
---|---|
XD01 | Create Customer (Centrally) |
XD02 | Change Customer (Centrally) |
XD03 | Display Customer (Centrally) |
VD01 | Create Customer (Sales) |
VD02 | Change Customer (Sales) |
VD03 | Display Customer (Sales) |
VAP1 | Create Contact Person |
VAP2 | Change Contact Person |
VAP3 | Display Contact Person |
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):
Table | Description |
---|---|
KNA1 | General Data in Customer Master |
KNB1 | Customer Master (Company Code) |
KNVV | Customer Master Sales Data |
KNVP | Customer Master Partner Functions |
KNVP | Customer Master Partner Functions |
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:
Table | Description |
---|---|
TKUPA | Business Partners: Customer Master Groups |
TPAR | Business Partner: Functions |
TPART | Business Partner Functions: Texts |
TPAER | Business Partner: Functions in Partner Determination Proceed. |
Check this book about SAP CRM Technical Principles and Programming.
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 ( difficult ).
Actually you have to manage the position of Cursor because the view is based on Tab component in the Customer DynPro.
This is a simple way to handle cursor:
perform bdc_dynpro using 'SAPMF02D' '0324'. perform bdc_field using 'BDC_CURSOR' '*RF02D-KTONR'. perform bdc_field using 'BDC_OKCODE' '=ENTR' . perform bdc_field using '*KNVP-PARVW' iv_parvw. perform bdc_field using '*RF02D-KTONR' iv_kunn2. perform bdc_dynpro using 'SAPMF02D' '0324'. perform bdc_field using 'BDC_CURSOR' 'KNVP-PARVW(01)'. perform bdc_field using 'BDC_OKCODE' '=LDEL' .
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
The 4th step to update contacts of customer is to to build the cursor position:
IF lv_last_numb LT 10. MOVE lv_last_numb TO pv_cursor_new. CONCATENATE '0' pv_cursor_new INTO pv_cursor_new. ELSE. MOVE lv_last_numb TO pv_cursor_new. ENDIF.
5- Scroll to the insertion page
DO lv_page_modif TIMES. perform bdc_field using 'BDC_OKCODE' '=P+'. ENDDO.
6- Set the Cursor and the value
set_cursor 'KNVP-PARVW' lv_cursor_modif lv_cursor. condense lv_cursor no-gaps. perform bdc_field using 'BDC_CURSOR' lv_cursor. perform bdc_field using 'BDC_OKCODE' '=ENTR' . perform bdc_field using lv_cursor iv_parvw. set_cursor 'RF02D-KTONR' lv_cursor_modif lv_cursor. condense lv_cursor no-gaps. perform bdc_field using 'BDC_CURSOR' lv_cursor. perform bdc_field using lv_cursor iv_kunn2.
CMD_EI_API is the SAP standard Class build as Customer Processing APIs.
It proposes by SAP as a replacement for the Batch Input of Customer handling.
The main methods for this class are:
A Sample example for uploading Contacts with CMD_EI_API Class is in this link Update Customer with CMD_EI_API
It is not the standard way to Update Contacts of Customer but it can be a solution for
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
SAP ISU Tables for Technical master data, for Billing Master Data, Billing and invoicing Tables?…
SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd…
Dunning is the business practice of informing a customer of past due payment. Dunning letters…
SAP AP Tcodes & SAP AR Tcodes: House Banks Tcodes, Advance Payments or Down Payments,…
What are the main SAP Payment Terms Tables ? What are the related Tables in…
Work center consists of master data related to routing of products. It contains data related…