Foro -Documentación -Código fuente -Contacto -Empleo

Buscar

Traducir

Amazon

ZU53 PDF Imprimir E-mail
Usar puntuación: / 0
MaloBueno 
Código fuente - Utilidades varias
Sábado, 28 de Febrero de 2004 01:06
Sends results of tcode SU53 to spool and informs Basis-Administrator(s) with a popup message
* Print results of last authority-check to SAP-spool
* and inform Basis Administrators about this with a popup

REPORT zu53 message-id 26.

DATA::
   device(4) VALUE 'Z404',                  "SAP printer

   V_COVER1 LIKE TSP01_SP0R-RQTITLE_V, "Título de una orden SPOOL
   V_MANDT LIKE T000-MANDT, "Mandante
   TH_POPUP LIKE TFDIR-FUNCNAME, "Nombre del módulo de funciones
   cnt1 TYPE i,
   cnt2 TYPE i,

  BEGIN OF usr07key,
     OBJCT LIKE USR07-OBJCT, "Actualizar maestro de usuario: Objeto de au
     FIEL0 LIKE USR07-FIEL0, "Nombre de campo para autorizaciones
     FIEL1 LIKE USR07-FIEL0, "Nombre de campo para autorizaciones
     FIEL2 LIKE USR07-FIEL0, "Nombre de campo para autorizaciones
     FIEL3 LIKE USR07-FIEL0, "Nombre de campo para autorizaciones
     FIEL4 LIKE USR07-FIEL0, "Nombre de campo para autorizaciones
     FIEL5 LIKE USR07-FIEL0, "Nombre de campo para autorizaciones
     FIEL6 LIKE USR07-FIEL0, "Nombre de campo para autorizaciones
     FIEL7 LIKE USR07-FIEL0, "Nombre de campo para autorizaciones
     FIEL8 LIKE USR07-FIEL0, "Nombre de campo para autorizaciones
     FIEL9 LIKE USR07-FIEL0, "Nombre de campo para autorizaciones
  END OF usr07key.

*nclude zbc_admins.
CONSTANTS::
* Please replace these values with your BC-Admins User-IDs:
   bc_adm1 LIKE SY-UNAME VALUE 'BC_ADM1'  "Basis-Admin 1
 , bc_adm2 LIKE SY-UNAME VALUE 'BC_ADM2'  "Basis-Admin 2
.
*-----------------------------------------------------------------------
INITIALIZATION.
  PERFORM init.

*-----------------------------------------------------------------------
START-OF-SELECTION.
  PERFORM get_data.

END-OF-SELECTION.

*-----------------------------------------------------------------------
FORM init.
   th_popup = 'Z_TH_POPUP'. 
  SELECT SINGLE funcname FROM tfdir
                         INTO th_popup
                         WHERE funcname = th_popup.
  IF SY-SUBRC <> 0.  th_popup = 'TH_POPUP'.  ENDIF.

  CONCATENATE '* ===== ACCESS DENIED ===>'  SY-UNAME
                              INTO v_cover1 SEPARATED BY space.
  CONDENSE v_cover1.
ENDFORM. "INIT
*-----------------------------------------------------------------------
FORM submit_su53_to_spool.
   submit sapms01g TO sap-spool
          destination              device
          copies                   1
          list name               'ADMINFO: SU53 list' 
*        list dataset v_dsn
          cover text               v_cover1
*        list authority           v_auth
          immediately             ' ' 
          keep in spool           'X' 
         NEW list identification 'X' 
*        dataset expiration       v_days
          line-count               65
          line-size                255
*        layout                   v_layout
          sap cover page          ' ' 
          cover page              ' ' 
          receiver                 bc_adm1
*        department               v_dep
*        archive mode             v_armode
*        archive parameters       v_arparams
          without spool dynpro AND return.

ENDFORM. "SUBMIT_SU53_TO_SPOOL
*-----------------------------------------------------------------------
FORM POPUP_TO_ADMIN USING L_MANDT LIKE USR02-MANDT"Mandante
                           L_BNAME LIKE USR02-BNAME"Nombre de usuario se
                 CHANGING cnt.

  DATA: MSG LIKE SM04DIC-POPUPMSG,  UZEIT(8). "Texto ventana diálogo

  WRITE SY-UZEIT TO uzeit USING edit mask '__:__:__'. 
  CONCATENATE
    'SP01: spool for failed authority-check received -'(010) 
     uzeit SY-UNAME
    INTO msg SEPARATED BY space.

  CALL FUNCTION th_popup
       EXPORTING
             client = l_mandt
             user = l_bname
             message = msg
             cut_blanks = 'X' 
       EXCEPTIONS
             user_not_found = 1.

  IF SY-SUBRC EQ 0. ADD 1 TO cnt. ENDIF.
ENDFORM. "POPUP_TO_ADMIN
*-----------------------------------------------------------------------
 define send_once.
  IF NOT &1 ge 1.
    PERFORM popup_to_admin USING v_mandt &2 CHANGING &1.
  ENDIF.
 end-of-definition. "SEND_ONCE
*-----------------------------------------------------------------------
FORM inform_admins.
* check sy-uname ne bc_adm1 and sy-uname ne bc_adm2.

  CLEAR: cnt1,  cnt2.
  SELECT mandt FROM t000 INTO v_mandt.
     send_once cnt1 bc_adm1. "Send to admin 1
     send_once cnt2 bc_adm2. "Send to admin 2 too (always)
*   send_once cnt1 bc_adm2. "Send to admin 2 (only if admin 1 not found)
  ENDSELECT.

  IF cnt1 EQ 0 AND cnt2 EQ 0.
*--'Your request sent to spool (for details see help on this message)'
     MESSAGE I000 WITH "&
 'Your request sent to spool. For details see help on this message'(001). 
  ELSE.
*--'Your request has been sent to System Administrator'
     MESSAGE I000 WITH "&
       'Your request has been sent to System Administrator'(002). 
  ENDIF.
ENDFORM. "INFORM_ADMINS
*-----------------------------------------------------------------------
FORM get_data.
  DATA ans.

   get parameter ID 'XU1' field usr07key.
* get parameter id 'XU2' field usr07val1.
* get parameter id 'XU7' field usr07val2.

  IF usr07key-objct = space. "and sy-uname ne bc_adm1. "<--on DEBUG only
     MESSAGE S000 WITH "&
       'All of the checks performed were successful'(003). 
  ELSE.

    CLEAR ans.
    CALL FUNCTION 'POPUP_TO_DECIDE' 
         EXPORTING
            defaultoption =  1        "Set default to button 1
            textline1 =
              'Prerequisites: you just have received system message'(007) 
            textline2 =
              'with explanation on missing authorizations.'(005) 
            textline3 =
              'Do you want to send info to system administrator?'(004) 
            text_option1 = 'Yes, send!'(008) 
            text_option2 = 'No, view only'(009) 
            titel = 'Send info to system administrator'(006) 
            start_column =  10       "X-position on screen
            start_row =  5        "Y-position on screen
*          cancel_display = 'X'        "space for hide 'CANCEL'
         IMPORTING answer =  ans.      "Pressed button here

    CASE ans.
      WHEN '1'. 
        PERFORM submit_su53_to_spool.
        PERFORM inform_admins.
      WHEN '2'.  CALL transaction 'SU53'. 
*     when 'A'.
      WHEN others.
    ENDCASE.

  ENDIF.

ENDFORM. "GET_DATA
Comentarios
Buscar
¡Sólo los usuarios registrados pueden escribir comentarios!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

 
home search