Modify customer terms of payment in sales order
In standard way , you can define terms of payment in sales area data of customer masters. This document gives an alternative method to define terms of payment.
Symptom : Sometimes , you can want to modify customer terms of payment in sales order although it is copied from customer master data (KNVV-ZTERM).
Solution method : To sum up , steps of this method is explained like belowed.
- Create a condition type –> ZVAD
- Create a conditon tables .
- Create a access sequence –> ZVAD
- If you need your defined or other fields to define conditions for terms of payment , you have to add fields to pricing field catalog. For zz fields , you can benefit from this thread –> https://scn.sap.com/thread/1876750
- Also –> SAP SD – Add a Field To New Condition Table in Pricing
- Modify terms of payment in sales order –> Include : MV45AFZZ –> FORM USEREXIT_MOVE_FIELD_TO_VBKD
Step 1 : ZVAD condition type definition –> SPRO -> Sales and Distribution -> Basic Functions -> Pricing -> Pricing Control -> Define Condition Types
Step 2 : Create a access sequence –> ZVAD –> SPRO -> Sales and Distribution -> Basic Functions -> Pricing -> Pricing Control -> Define Condition Tables
In this example : 928 and 929 number of tables are created.
Note : ZZMATK1 -> First character of material group . This field is appended KOMP table / Pricing Communication Item , if you append to pricing communication header , you would append to KOMK ,after that you have to add this field KOMG / Allowed Fields for Condition Structures for this you can follow this path -> SPRO -> Sales and Distribution -> Basic Functions -> Pricing -> Pricing Control -> Define Condition Tables -> Conditions: Allowed fields .
Step 3 : Create a access sequence –> ZVAD –> SPRO -> Sales and Distribution -> Basic Functions -> Pricing -> Pricing Control -> Define Access Sequences
* Access number 10 contains 929 number of table , access number 20 contains 928 number of table that they are defined exclusive condition access without any requirement.
Step 4 : Modify terms of payment in sales order –> SE38 –> Program: MV45AFZZ –> FORM USEREXIT_MOVE_FIELD_TO_VBKD
Sample code :
*/ Terms of payment will be modified with ZVAD where sales order items
*/ M.Ozgur Unal – 16.07.2015
**********************************************************************
DATA: wa_vbap LIKE vbap,
wa_zterm LIKE vbkd–zterm,
ls_vbpa TYPE vbpa.
*/ BREAK OUNAL.
IF us_posnr NE ‘000000’.
CLEAR: wa_vbap, wa_zterm, ls_vbpa.
IF vbap–posnr = us_posnr.
wa_vbap = vbap.
ELSE.
READ TABLE xvbap INTO wa_vbap WITH KEY posnr = us_posnr.
ENDIF.
READ TABLE xvbpa INTO ls_vbpa WITH KEY vbeln = wa_vbap–vbeln
posnr = wa_vbap–posnr
parvw = ‘RE’.
IF sy–subrc NE 0.
READ TABLE xvbpa INTO ls_vbpa WITH KEY vbeln = wa_vbap–vbeln
parvw = ‘RE’.
ENDIF.
SELECT SINGLE konp~zterm INTO wa_zterm
FROM a929
INNER JOIN konp ON a929~knumh = konp~knumh
WHERE a929~vkorg EQ vbak–vkorg
AND a929~vtweg EQ vbak–vtweg
AND a929~kschl EQ ‘ZVAD’
AND a929~kunnr EQ ls_vbpa–kunnr
AND a929~zzmatk1 EQ wa_vbap–matkl(1)
AND a929~datab LE vbkd–prsdt
AND a929~datbi GE vbkd–prsdt
AND konp~loevm_ko EQ space.
IF wa_zterm IS NOT INITIAL.
vbkd–zterm = wa_zterm.
ENDIF.
IF wa_zterm IS INITIAL.
SELECT SINGLE konp~zterm INTO wa_zterm
FROM a928
INNER JOIN konp ON a928~knumh = konp~knumh
WHERE a928~vkorg EQ vbak–vkorg
AND a928~vtweg EQ vbak–vtweg
AND a928~kschl EQ ‘ZVAD’
AND a928~kunrg EQ ls_vbpa–kunnr
AND a928~zzmatk1 EQ wa_vbap–matkl(1)
AND a928~datab LE vbkd–prsdt
AND a928~datbi GE vbkd–prsdt
AND konp~loevm_ko EQ space.
IF wa_zterm IS NOT INITIAL.
vbkd–zterm = wa_zterm.
ENDIF.
ENDIF.
ENDIF.
**********************************************************************
Lets go to trial of this development :
VK11 : Define a condition record for a special customer to modify terms of payment.
If material group first character equals to ‘I’ , ZTERM is ‘Z009’.
If material group first character equals to ‘U’,ZTERM is ‘Z001’.
* In customer master record , ZTERM equals to ‘Z006’.
* Create sales order and check the results.
Payment terms is modified in the userexit of program SAPMV45A.
Oss note –> 178328 – Problems due to incorrect user exits in SD
M.Ozgur Unal
In the condition record itself, when you have the option to maintain different payment terms, why were you going for an enhancement ?
Hi G Lakshmipathi ;
I benefit from a special condition to modify terms of payment , there are a lot of advantage.
* Custumer can demand their special fields. For example : First character of material group. It can be enlarged.
* It is simple to manage terms of payments few records.
* It is flexible to manage terms of payment a lot of fields. On the otherhand , you have to define terms of payments all of material prices.
* Customer can create sales order with bapi. It is not changed manually.
*It is independent of material prices.
Regards.
M.Ozgur Unal