2006 Oct 17 8:43 AM
Hi
I have a requirement in which I need to check whether a user has the authorization to change a sales document or not .
If he has,then I need to call transaction VA02(Change mode) else VA03(Display Mode).
Now I am clear with the Call transaction part.
But for the authorization part, how will I come to know that a user has a authorization to change a document or not?
Thank You
2006 Oct 17 9:06 AM
Hi Subash
Please try with the below authorization objects:
<b>V_VBAK_VKO Sales Document: Authorization for Sales Areas
V_VBAK_AAT Sales Document: Authorization for Sales Document Types</b>
First one is w.r.t Sales Area
Second One w.r.t Sales Document Type
Hope this helps you to proceed with your coding.
Kind Regards
Eswar
2006 Oct 17 9:52 AM
Hi,
goto tcode su21.In the object class column double click on SD.When you do that you will c various authorization objects.The most relevant ones for your scenario is
V_VBAK_AAT(document type)
In the report u will make use of the statement.
AUTHORITY-CHECK OBJECT 'V_VBAK_AAT'
ID AUART FIELD (here you specify the sales order type)
ID ACTVT FIELD (02 for change and 03 for display.
check the sy-subrc condtion and accordingly call the tcode.
Hope this helps.
Reward useful answers.
Regards,
Shrita.
Message was edited by: shrita sharma
2006 Oct 17 10:00 AM
To check the authorization of the user of an ABAP program, use the AUTHORITY-CHECK statement:
AUTHORITY-CHECK OBJECT '<object>'
ID '<name1>' FIELD <f1>
ID '<name2>' FIELD <f2>
.............
ID '<name10>' FIELD <f10>.
<b>if sy-subrc = 0.
***authotised
else
not</b>
2006 Oct 17 10:33 AM
Hi subhash,
here a short code:
REPORT ZGRO_TEST.
*
DATA: I_VA02 LIKE SY-TCODE VALUE 'VA02'.
DATA: I_VA03 LIKE SY-TCODE VALUE 'VA03'.
*
*
START-OF-SELECTION.
*
AUTHORITY-CHECK OBJECT 'S_TCODE' ID 'TCD' FIELD I_VA02.
*
IF SY-SUBRC = 0.
CALL TRANSACTION I_VA02.
ELSE.
CALL TRANSACTION I_VA03.
ENDIF.
*
END-OF-SELECTION.
Hope it helps
Regards, Dieter
2006 Oct 17 10:38 AM
Hi,
AUTHORITY-CHECK OBJECT 'S_TCODE'
ID 'TCD' FIELD 'VA01'.
if sy-subrc eq 0 .
call transaction 'VA02'
else.
call transaction 'VA03'
endif.
Regards
Amole