Skip to Content
0
Former Member
Jul 28, 2008 at 01:39 PM

User Authorisations in Dialog Programming.

24 Views

Hi Friends,

I have a small requirement, I want to create user authorisations in dialog programming.

Actually client requirement is he want to enter absence details of each and every branch.

For that i have created a cusom table and i also i have developed a dialog program inorder to update the details

and to retrive all the data i have created a report program also.

Now the client requirement is he want user authorisations while updating the data through dialog programming, that means if a user loging in that particular branch he want to enter the absence details pertaining to that branch only, when he tries to enter the details of other employee pertaining to another branch an error should be raised.

Actually in the client place they are using authrisation object as 'Z_WERKS'. The basis person has created this and provided for me.

Actually i have created an Authority check in module pool program.Here iam attaching my prog,

Pls provide me the sample code if at all available.

&----


*& Include ZEMPTOP Module pool

*&

&----


PROGRAM ZEMP.

TABLES : ZABS,PA0001.

DATA : WA_PA0001 LIKE PA0001,

V_ANS.

DATA: BEGIN OF Z_WERKS OCCURS 0,

PERSA LIKE T500P-PERSA,

NAME1 LIKE T500P-NAME1,

END OF Z_WERKS.

&----


*

*& Include ZEMPI01

&----


&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE SY-UCOMM.

WHEN 'DISP'.

SELECT SINGLE * FROM ZABS WHERE PERNR = ZABS-PERNR.

IF SY-DBCNT <> 0.

*MESSAGE I000(Z00) WITH 'Details of' ZABS-PERNR .

else.

MESSAGE I000(Z00) WITH 'No Details Available to Display'.

ENDIF.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.

LEAVE TO SCREEN 0.

WHEN 'CLS'.

CLEAR ZABS.

WHEN 'INS'.

INSERT ZABS .

ZABS-ABWTG = ZABS-ENDDA - ZABS-BEGDA + 1.

IF SY-DBCNT <> 0.

MESSAGE I000(Z00) WITH 'Personnel No' ZABS-PERNR

'inserted successfully'.

ENDIF.

CLEAR ZABS.

WHEN 'MOD'.

UPDATE ZABS.

ZABS-ABWTG = ZABS-ENDDA - ZABS-BEGDA + 1.

IF SY-DBCNT <> 0.

MESSAGE I000(Z00) WITH 'Personnel No' ZABS-PERNR

'Modified Successfully'.

ENDIF.

CLEAR ZABS.

*WHEN 'DEL'.

*CALL FUNCTION 'POPUP_TO_CONFIRM_LOSS_OF_DATA'

  • EXPORTING

  • TEXTLINE1 = 'ARE YOU SURE'

  • TEXTLINE2 = 'YOU WANT TO DELETE'

  • TITEL = 'CONFIRMATION'

  • START_COLUMN = 25

  • START_ROW = 6

  • DEFAULTOPTION = 'N'

  • IMPORTING

  • ANSWER = V_ANS.

*

*IF V_ANS = 'J'.

*

*DELETE ZABS.

*IF SY-DBCNT <> 0.

*MESSAGE I000(Z00) WITH 'Personnel No' ZABS-PERNR

*'Deleted Successuflly'.

*ELSE.

*MESSAGE I000(Z00) with 'No Record to Delete'.

  • ENDIF.

*ENDIF.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module GET_REC INPUT

&----


  • text

----


MODULE GET_REC INPUT.

SELECT SINGLE * FROM PA0001 INTO WA_PA0001

WHERE PERNR = ZABS-PERNR.

MOVE: WA_PA0001-PERNR TO ZABS-PERNR,

WA_PA0001-ENAME TO ZABS-ENAME,

WA_PA0001-GSBER TO ZABS-GSBER,

WA_PA0001-WERKS TO ZABS-WERKS.

ZABS-ABWTG = ZABS-ENDDA - ZABS-BEGDA + 1.

ENDMODULE. " GET_REC INPUT

&----


*& Module CHECK_AUTH_WERKS INPUT

&----


  • text

----


MODULE CHECK_AUTH_WERKS INPUT.

*SELECT PERSA INTO TABLE _WERKS FROM T500P

  • WHERE PERSA = ZABS-WERKS.

AUTHORITY-CHECK OBJECT 'Z_WERKS'

ID 'PERSA' FIELD Z_WERKS-PERSA.