Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://go.sap.com/community.html
Thank you,
The SAP Community team.
The SAP Community wiki will be closed to new content submissions from December 7 6:00 p.m. CET to December 11 6:00 p.m. CET.
We apologize for the inconvenience, but we need to take the system offline while we improve the platform. Please plan your tasks accordingly.
Skip to end of metadata
Go to start of metadata

Making Manual Entry for a Condition-type Possible for Selected Users in Sales order

 
 

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.