cancel
Showing results for 
Search instead for 
Did you mean: 

How to avoid, that a CPD-Customer will used in Sales ORDER?

Former Member
0 Kudos

Hi,

i will avoid, that the user inserts an CPD-Customer in sales orders.

It's only in quotation allowed.

Therefore i use include MV45AFZB with following code.


FORM USEREXIT_CHECK_VBAK USING US_DIALOG.

DATA: WA_KTOKD TYPE KTOKD.
IF VBAK-VBTYP <> 'B'.
  SELECT SINGLE KTOKD FROM KNA1 INTO WA_KTOKD
         WHERE KUNNR = VBAK-KUNNR.
  IF WA_KTOKD = 'CPD'.
    MESSAGE E010(ZZ) WITH
            'CPD-cutomer is not allowed!'.
    MOVE 'ENT1' to FCODE.
    EXIT.
  ENDIF.
ENDIF.

My problem is, that the user cannot chage the customer numer when error appears.

Is there another way to realize what i need, or is there a way to make the customer-Number

changeable in this case?

Hope anyone can help-

Regards, Dieter

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dieter

Have you tried using order block?

Firstly define an order blocking reason for CPDs and assign it to all relevant order types in config.

SPRO/IMG/Sales and Distribution/Sales/Sales Documents/Define And Assign Reason For Blocking

And then block all CPD customers using VD05 ( there will not be many, so it shouldn't take time).

Alternately

make it a warning in the code you wrote and copy the same code as an error while saving the order using

MV45AFZZ - USEREXIT_SAVE_DOCUMENT_PREPARE or USEREXIT_SAVE_DOCUMENT

Hope this helps.

Former Member
0 Kudos

Hi Chandrasekhar,

thats exactly where i'm looking for. I use order blocking reason. I create a new reason, and

block the customers via VD05 and it works like i need.

I have the EXIT, which i tried at first, deleted.

Many thanks

Regards, Dieter

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Can you please elaborate the issue?

Thanks

Sudhir

Former Member
0 Kudos

hi Sud,

i simple will avoid, that the users uses CPD-customers (one-time customer) in sales orders.

I have mentioned how i do this, but i'm not satified with my way (Customer number is not changeable).

Now i ask for a better way to avoid using CDP-Customer or make the Customer number changeable

when error apprears.

regards, Dieter