2006 Aug 25 1:57 PM
Hi
All
I have following code
start-of-selection.
authority-check object 'V_VBAK_VKO'
ID 'VKORG' FIELD P_VKORG
ID 'VTWEG' FIELD P_VTWEG
ID 'SPART' FIELD P_SPART
id 'VKORG' field s_vkorg
id 'VTWEG' field s_vtweg
id 'SPART' field s_spart
if sy-subrc ne c_0.
Message e999 with "No Authorization"
Endif
previously iwas using a single value(P_VKORG,P_VTWEG,P_SPART) in fields
but now my req has been changed to multiple values.
so plz tell whether my code will work correctly or not.
What i have to do,whether i should use loop and passes single value or there is any other way to check the Authorization.
Thanks
Saurabh
Hi
All
I have following code
start-of-selection.
authority-check object 'V_VBAK_VKO'
ID 'VKORG' FIELD P_VKORG
ID 'VTWEG' FIELD P_VTWEG
ID 'SPART' FIELD P_SPART
id 'VKORG' field s_vkorg
id 'VTWEG' field s_vtweg
id 'SPART' field s_spart
if sy-subrc ne c_0.
Message e999 with "No Authorization"
Endif
previously iwas using a single value(P_VKORG,P_VTWEG,P_SPART) in fields
but now my req has been changed to multiple values.
so plz tell whether my code will work correctly or not.
What i have to do,whether i should use loop and passes single value or there is any other way to check the Authorization.
Thanks
Saurabh
2006 Aug 25 1:59 PM
2006 Aug 25 2:01 PM
Hi ,
first u have to get the list of Sales Org based on the Input , after that u have to loop like this.
SELECT VKGRP
INTO TABLE I_AUTH_VKGRP
FROM TVKGR
WHERE VKGRP IN S_VKGRP.
*
LOOP AT I_AUTH_VKGRP.
AUTHORITY-CHECK OBJECT ''V_VBAK_VKO'
ID 'ACTVT' FIELD '03'
ID 'VKGRP' FIELD I_AUTH_VKGRP-VKGRP.
*
IF SY-SUBRC NE 0 .
MESSAGE E398(00) WITH
'User'SY-UNAME'not authorised for Sales Group : ' I_AUTH_VKGRP-VKGRP.
ENDIF.
ENDLOOP.
*
Regards
Prabhu
2006 Aug 25 2:01 PM
HI,
Your code works fine if ur select-options are with no extensions no -intervals.
AUTHORITY-CHECK OBJECT object
ID name1 FIELD f1
ID name2 FIELD f2
...
ID name10 FIELD f10.
REGARDS,
sAILAJA.
2006 Aug 25 2:04 PM
Hi,
Usually in this case WE query the Check table of each field and make an internal table of it and then pass it to authority-check.
For ex: VKORG check table TVKO, similary for VTWEG and SPART it is TVTW and TSPA.
Hence do a select on these tables.
Select VKORG from TVTW
where VKORG in S_VKORG
into table t_vkorg.
Similarly store others in T_VTWEG and T_SPART.
Loop at T_VKORG.
Loop at T_VTWEG.
Loop at T_SPART.
Authority Check----
Store only the valid ones in another internal table.
endloop.
endloop.
endloop.
2006 Aug 25 2:35 PM
Hi Saurabh,
You can code something similar to this
SELECT * FROM MARA INTO ITAB_MARA
WHERE MATNR IN S_MATNR
AND ERDAT IN S_ERDAT.
AUTHORITY-CHECK 'M_MATNR'
ID 'MATNR' FIELD ITAB_MARA-MATNR
ID 'ERDAT' FIELD ITAB_MARA-ERDAT.
IF SY-SUBRC NE 0.
MESSAGE e000 WITH 'BLAH BLAH'.
ELSE.
APPEND ITAB_MARA.
ENDIF.
ENDSELECT.
This way the system will check all the values in the loop and you can also reterive the data in the same pass of the loop.
Cheers
VJ
Some points would be nice if it helped