Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Cocode check at PBO and PAI

Former Member
0 Kudos

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

2 REPLIES 2

Former Member
0 Kudos

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

0 Kudos

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