Dear Friends,


Client Requirement :



I came across a requirement once in my company . I thought I should share some points which we need to consider achieving this requirement. Although some points have already been discussed in many threads for different requirements . There is an SAP note 105621. All process has been described step by step in this note.


Just I am sharing the piece of code that i have hided VPRS condition at header & Item level .


SU20.jpg

Create two authorization fields with following inputs


ZKALSM.jpg



ZSTUNR.jpg



Create Authorization Object

Run Tcode SU21 and Click on this icon and select Authorization Object

Objec.jpg





Enter object name, text, class and field names. Field ACTVT is not necessary. I have added in screenshot but you can create without this field too. It works fine without this field. Only add two fields ZKALSM and ZSTUNR.





/wp-content/uploads/2015/06/h_726823.jpg



Transactions Included VF01, VF02, and VF03.


The same USER EXIT we can use for VA01, VA02, and VA03 also steps are same.


Using ABAP Code we have achieve this functionality.






USER EXIT: LV69AFZZ.


Go to SE38 à Provide program name LV69AFZZ & Click on change.



Now you can find here



Header.jpg

FORM userexit_field_modific_kopf. “These Subroutine is for Header Level hiding VPRS or Any Condition type


“I Have included HEADER & Item Screen Fields to hide VPRS condition types  here.



DATA : dummy TYPE c.
IF sytcode = ‘VF01’ OR sytcode = ‘VF02′ OR sytcode = ‘VF03′.

  AUTHORITY-CHECK OBJECT ‘Z_KONH_KLS’
ID ‘ZKALSM’ FIELD komkkalsm
ID ‘ZSTUNR’ FIELD komvstunr
ID ‘ACTVT’ FIELD dummy.


IF sysubrc NE 0.
CASE screenname.
WHEN ‘KOMV-KWERT’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.
WHEN ‘KOMV-KBETR’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.
WHEN ‘KOMV-KWERT’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.
WHEN ‘KOMV-KWERT_K’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘KOMV-KSCHL’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘T685T-VTEXT’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘XKOMV_WAERK’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘RV61A-LED_KINAK’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘KOMV-KWAEH’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.
WHEN ‘RV61A-KOEIN’.

        IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘KOMV-KPEIN’.

        IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘KOMV-KMEIN’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘KOMV-KUMZA’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘RV61A-MEINS’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘KOMV-KUMNE’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘RV61A-KMEI1’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

ENDCASE.

ENDIF.

ENDFORM.




Itemsss.jpg


FORM userexit_field_modification. These Subroutine is for Item Level hiding VPRS or Any Condition type

*I Have included HEADER & Item Screen Fields to hide VPRS condition types

DATA : dummy TYPE c.
IF sytcode = ‘VF01’ OR sytcode = ‘VF02′ OR sytcode = ‘VF03′.

  AUTHORITY-CHECK OBJECT ‘Z_KONH_KLS’
ID ‘ZKALSM’ FIELD komkkalsm
ID ‘ZSTUNR’ FIELD komvstunr
ID ‘ACTVT’ FIELD dummy.


IF sysubrc NE 0.
CASE screenname.
WHEN ‘KOMV-KWERT’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.
WHEN ‘KOMV-KBETR’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.
WHEN ‘KOMV-KWERT’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.
WHEN ‘KOMV-KWERT_K’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘KOMV-KSCHL’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘T685T-VTEXT’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘XKOMV_WAERK’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘RV61A-LED_KINAK’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘KOMV-KWAEH’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.
WHEN ‘RV61A-KOEIN’.

        IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘KOMV-KPEIN’.

        IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘KOMV-KMEIN’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘KOMV-KUMZA’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘RV61A-MEINS’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘KOMV-KUMNE’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

WHEN ‘RV61A-KMEI1’.
IF xkomvkschl = ‘VPRS’.
screenactive = 0.
ENDIF.

ENDCASE.

ENDIF.




Before Implementing User Exit for Header level:

I have been created Billing Document and showing the cost is included for HEADER Level


before header.jpg


After Implementing User Exit for Header level:


Output :

After header.jpg


Before Implementing User Exit for ITEM level:


I have been created Billing Document and showing the cost is included for ITEM Level.





Before Item.jpg



After Implementing User Exit for ITEM level:

Output:


AFter Item.jpg


Logic used as Authorization for entering/displaying manual condition in Sale order.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Naimesh Patel

    Better way to do it using the BADI PRICING_AUTHORITY_CHECK_UI.

    • All generic advantages of BADI over Userexit
    • Example implementation has good logic to improve the performance by having local buffering of the condition and its authorization status

    Regards,
    Naimesh Patel

    (0) 

Leave a Reply