Skip to Content
Author's profile photo Mehmet Ozgur Unal

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

1.JPG2.JPG

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.

3a.JPG

3b.JPG


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 .


3c.JPG

3d.JPG


Step 3 : Create a access sequence –> ZVAD –> SPRO -> Sales and Distribution -> Basic Functions -> Pricing -> Pricing Control -> Define Access Sequences


4.JPG


* 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.


3e.JPG

3f.JPG


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 vbkdzterm,

                ls_vbpa TYPE vbpa.


*/  BREAK OUNAL.


     IF us_posnr NE ‘000000’.

       CLEAR: wa_vbap, wa_zterm, ls_vbpa.

       IF vbapposnr = 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_vbapvbeln

                                              posnr = wa_vbapposnr

                                              parvw = ‘RE’.

       IF sysubrc NE 0.

         READ TABLE xvbpa INTO ls_vbpa WITH KEY vbeln = wa_vbapvbeln

                                                parvw = ‘RE’.

       ENDIF.

       SELECT SINGLE konp~zterm INTO wa_zterm

                FROM a929

          INNER JOIN konp ON a929~knumh = konp~knumh

               WHERE a929~vkorg EQ vbakvkorg

                 AND a929~vtweg EQ vbakvtweg

                 AND a929~kschl EQ ‘ZVAD’

                 AND a929~kunnr EQ ls_vbpakunnr

                 AND a929~zzmatk1 EQ wa_vbapmatkl(1)

                 AND a929~datab LE vbkdprsdt

                 AND a929~datbi GE vbkdprsdt

                 AND konp~loevm_ko EQ space.

        IF wa_zterm IS NOT INITIAL.

           vbkdzterm = 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 vbakvkorg

                 AND a928~vtweg EQ vbakvtweg

                 AND a928~kschl EQ ‘ZVAD’

                 AND a928~kunrg EQ ls_vbpakunnr

                 AND a928~zzmatk1 EQ wa_vbapmatkl(1)

                 AND a928~datab LE vbkdprsdt

                 AND a928~datbi GE vbkdprsdt

                 AND konp~loevm_ko EQ space.

        IF wa_zterm IS NOT INITIAL.

           vbkdzterm = 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’.


5.JPG


* In customer master record , ZTERM equals to ‘Z006’.


6.JPG

* Create sales order and check the results.

8.JPG

7.JPG

  Payment terms is modified in the userexit of program SAPMV45A.

  Oss note –> 178328 – Problems due to incorrect user exits in SD

  M.Ozgur Unal

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Lakshmipathi Ganesan
      Lakshmipathi Ganesan

      In the condition record itself, when you have the option to maintain different payment terms, why were you going for an enhancement ? 

      Author's profile photo Mehmet Ozgur Unal
      Mehmet Ozgur Unal
      Blog Post Author

      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