Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

How to Hide VPRS Condition Record in SAP

$
0
0

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.





h.jpg


 


Transactions Included VF01, VF02, and VF03.


The sameUSER 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 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.




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 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


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.


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>