Tuesday, September 13, 2011

ABAP: Check if a customer is blocked for sales support

This is relatively simple, but it's best to keep it here for future use.

FORM check_if_customer_is_blocked USING a_cust_id TYPE kunnr.
DATA :
is_blocked TYPE cassd_x.

SELECT SINGLE cassd
INTO is_blocked
FROM kna1
WHERE kunnr = a_cust_id.

IF NOT is_blocked IS INITIAL.
MESSAGE e888(sabapdocu) WITH 'Customer is blocked!'.
ENDIF.

SELECT SINGLE cassd
INTO is_blocked
FROM knvv
WHERE kunnr = a_cust_id.

IF NOT is_blocked IS INITIAL.
MESSAGE e888(sabapdocu) WITH 'Customer is blocked!'.
ENDIF.
ENDFORM.

0 comments:

Post a Comment