cancel
Showing results for 
Search instead for 
Did you mean: 

SD:Item category wise authorization

Former Member
0 Kudos

Hi,

I want to give authorization as per the item category of Sales document.

I did the following steps

SU21 created the object with the following field

pstyv item category

vkorg sales organisayion

and the obejct in a role with PFCG transaction.

What else i need to do ?

Regards,

SATYA

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Satya,

Write a small code as mentioned below:

AUTHORITY-CHECK OBJECT 'ZSD_PSTYV'

ID 'PSTYV' FIELD XVBAP-PSTYV

at MV45AFZZ, form UserExit_Save_Document_Prepare : In case you want to check authorization at the time of save, this would allow users to manually change item category if required and will stop saving sales order.

Or

you can write at USEREXIT_CHECK_VBAP in MV45AFZB.

One of this should work.

Regards,

Naveen Aggarwal

Former Member
0 Kudos
  • AUTHORIZATION CHECK ON ITEM CATEGORY

  • SD Functional Analyst Adi Mogilevsky

  • www.sapist.com

DATA: lv_PSTYY TYPE VBAP-PSTYY.

IF SVBAP-TABIX GT 0 AND

*VBAP-PSTYY NE VBAP-PSTYY.

AUTHORITY-CHECK OBJECT 'Z_SO_IC_AUT'

ID 'ZPSTYY' FIELD VBAP-PSTYY

ID 'ACTVT' FIELD '02'.

IF sy-subrc NE 4.

  • *VBAP-PSTYY = LF_PSTYY.

ELSE.

MESSAGE 'You do not have authorization to change Item Category' .' TYPE 'I'.

VBAP-PSTYY = *VBAP-PSTYY.

ENDIF.

ENDIF.

Former Member
0 Kudos

>

> * AUTHORIZATION CHECK ON ITEM CATEGORY

> * SD Functional Analyst Adi Mogilevsky

> * www.sapist.com

> DATA: lv_PSTYY TYPE VBAP-PSTYY.

>

> IF SVBAP-TABIX GT 0 AND

> *VBAP-PSTYY NE VBAP-PSTYY.

>

> AUTHORITY-CHECK OBJECT 'Z_SO_IC_AUT'

> ID 'ZPSTYY' FIELD VBAP-PSTYY

> ID 'ACTVT' FIELD '02'.

> IF sy-subrc NE 4.

> * *VBAP-PSTYY = LF_PSTYY.

> ELSE.

> MESSAGE 'You do not have authorization to change Item Category' .' TYPE 'I'.

> VBAP-PSTYY = *VBAP-PSTYY.

> ENDIF.

> ENDIF.

That is wrong. An authority check is satisfied if sy-subrc = 0. All other return codes need to be reacted to.

Very bad habit and programming technique! (in addition to the fact that it makes little sense...)

Cheers,

Julius

@ SATYA: You need to find where you want this AUTHORITY-CHECK (and how to react to it).

Answers (1)

Answers (1)

Former Member
0 Kudos

Little tip: An object without coding using it is a mime in a forest.

Former Member
0 Kudos

Hi,

Thats a wondeful direction.

But could you please tell me in detail:

what kind of coding i need to do and where i need to do that coding.

Becasue this is the first time i am doing this kind of stuff.

i am a sd consultant.

Regards,

Satya