You are on page 1of 17

How to Hide VPRS Condition

Record in SAP

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 .

Create two authorization fields with following inputs

Create Authorization Object

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

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.

Transactions Included VF01, VF02, and VF03.

The same USER


same.

EXIT we can use for VA01, VA02, and VA03 also steps are

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

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 sy-tcode = VF01 OR sy-tcode = 'VF02' OR sy-tcode = 'VF03'.

AUTHORITY-CHECK OBJECT 'Z_KONH_KLS'


ID 'ZKALSM' FIELD komk-kalsm
ID 'ZSTUNR' FIELD komv-stunr
ID 'ACTVT' FIELD dummy.

IF sy-subrc NE 0.
CASE screen-name.
WHEN 'KOMV-KWERT'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KBETR'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KWERT'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KWERT_K'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.

WHEN 'KOMV-KSCHL'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'T685T-VTEXT'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'XKOMV_WAERK'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'RV61A-LED_KINAK'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KWAEH'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'RV61A-KOEIN'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.

WHEN 'KOMV-KPEIN'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KMEIN'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.

WHEN 'KOMV-KUMZA'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'RV61A-MEINS'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KUMNE'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'RV61A-KMEI1'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
ENDCASE.
ENDIF.
ENDFORM.

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 sy-tcode = VF01 OR sy-tcode = 'VF02' OR sy-tcode = 'VF03'.

AUTHORITY-CHECK OBJECT 'Z_KONH_KLS'


ID 'ZKALSM' FIELD komk-kalsm

ID 'ZSTUNR' FIELD komv-stunr


ID 'ACTVT' FIELD dummy.

IF sy-subrc NE 0.
CASE screen-name.
WHEN 'KOMV-KWERT'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KBETR'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KWERT'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KWERT_K'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KSCHL'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.

WHEN 'T685T-VTEXT'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'XKOMV_WAERK'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'RV61A-LED_KINAK'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KWAEH'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'RV61A-KOEIN'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.

WHEN 'KOMV-KPEIN'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KMEIN'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KUMZA'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.

WHEN 'RV61A-MEINS'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'KOMV-KUMNE'.
IF xkomv-kschl = 'VPRS'.
screen-active = 0.
ENDIF.
WHEN 'RV61A-KMEI1'.
IF xkomv-kschl = 'VPRS'.
screen-active = 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

After Implementing User Exit for Header level:


Output :

Before Implementing User Exit for ITEM level:

I have been created Billing Document and


showing the cost is included for ITEM Level.

After Implementing User Exit for ITEM level:


Output:

Document Finished Thanks .

You might also like