09-16-2011 5:13 AM
Hi
I should not allow Cocode AD01 records to update and Display when user has authorization for CoCode AD01.
i know in Event its possible, but we need to do it in PBO PAI of Screen.
PBO
*First statement
Module Authorictycheck.
Include LZXXXO01
module Authoritycheck
LOOP AT EXTRACT.
AUTHORITY-CHECK OBJECT 'ZCHECK_BUK'
ID 'BUKRS' FIELD ZTTL01-BUKRS.
IF sy-subrc <> 0.
*delete the record from EXTRACT table.
Append Extract.
ENDIF.
ENDLOOP.
endmodule
Does the above PBO code will work for display nonauthorized company code?
In PAI, No idea where to write and which table should i have to loop. Pls advice.
Regards
Prince
09-16-2011 6:48 AM
I think below code should allow me to display only authorized records.
But i dont know which table to use in place of t_comp_codes?
loop at t_comp_codes.
AUTHORITY-CHECK OBJECT 'F_LFA1_BUK'
ID 'BUKRS' FIELD T_COMP_CODES-BUKRS
ID 'ACTVT' FIELD '03'.
IF SY-SUBRC 0.
DELETE T_COMP_CODES index sy-tabix.
ENDIF.
ENDLOOP.
I tried Total and Extract tabel in loop but dont have BUKRS as field directly.
Pls advice
09-16-2011 7:52 AM
Hi
When the user tries to change the record in SM30, Authorization check
for the BUKRS has to be done and display error if no authority.
In PAI, under LOOP at Extract, i have added AUTHORITY_BUKRS module
and made below code. but the Authority check occurs when i click the edit button in SM30 screen.
but requirement is error should trigger only after change occurred for record.
Can you pls suggest how to handle this problem?
LOOP AT EXTRACT.
MODULE LISTE_INIT_WORKAREA.
CHAIN.
FIELD ZXXXX-COCODE .
FIELD ZXXXX-MATKL .
MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
ENDCHAIN.
FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
CHAIN.
FIELD ZXXXX-COCODE .
MODULE AUTH_CHECK_UPDATE. <-Added Module
MODULE LISTE_UPDATE_LISTE.
ENDCHAIN.
MODULE AUTH_CHECK_UPDATE INPUT.
Authority-check OBJECT 'Z_XXX_BUK'
ID 'BUKRS' FIELD ZTAUTH-COCODE.
If sy-subrc <> 0.
MESSAGE E105(ZSCM01).
ENDIF.
ENDMODULE.
Regards
prince
Edited by: princeck on Sep 16, 2011 3:33 PM
Edited by: princeck on Sep 16, 2011 3:42 PM