sd--如何控制定价条件根据用户不同而操作不同(有的可以输入有的不可以)

Often there is a requirement for making a condition type (price, discount etc) non-modifiable for some-users and modifiable for others using the same SAP system or modifiable for certain document types (say OR ie Standard Sales Order) and non-modifiable in another order type (say CR ie Credit Memo Request). In standard SAP this is not possible. Using the controls for the condition-type (V/06 transaction) we can either make a condition type 

1.       No Limitations

2.       A : Free

3.       B : Automatic Entry has Priority

4.       C : Manual Entry has Priority

5.       D : Not possible to process manually 

Selecting any one of this option makes the condition type uniform across all document type and for users. Often the requirements are like for a group of users the condition type should behave like C option, for another group like D or for a specific document type it should be A and for others D. 

One of the easiest way to achieve this is through the user-exit USEREXIT_PRICING_PREPARE_TKOMP in the include MV45AFZZ. 

The following code will make the condition type PR00 modifiable for user ABAP1 and non-modifiable for all other users. 


FORM USEREXIT_PRICING_PREPARE_TKOMP.
 
DATA : i_T685A TYPE STANDARD TABLE OF T685A WITH HEADER LINE.
 
IF SY-UNAME = 'ABAP1'.
LOOP AT XKOMV.
IF XKOMV-KSCHL = 'PR00'.
SELECT * FROM T685A INTO TABLE I_T685A WHERE KSCHL = 'PR00'.
READ TABLE I_T685A WITH KEY KSCHL = XKOMV-KSCHL.
I_T685A-KMANU = 'C'.
MODIFY I_T685A INDEX SY-TABIX.
MODIFY T685A FROM TABLE I_T685A.
REFRESH I_T685A.
ENDIF.
 
ENDLOOP.
 
ELSE.
LOOP AT XKOMV.
IF XKOMV-KSCHL = 'PR00'.
SELECT * FROM T685A INTO TABLE I_T685A WHERE KSCHL = 'PR00'.
READ TABLE I_T685A WITH KEY KSCHL = XKOMV-KSCHL.
I_T685A-KMANU = 'D'.
MODIFY I_T685A INDEX SY-TABIX.
MODIFY T685A FROM TABLE I_T685A.
REFRESH I_T685A.
ENDIF.
ENDLOOP.
 
ENDIF.
 
ENDFORM.

 url: https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/7879

你可能感兴趣的:(header,table,SAP,System,include,Types)