资讯详情

SAPMSYST登录程序_2015年版本

program sapmsyst message-id 00. *07.12.1993 *19.04.1996 Dynpro D0025 (Anmeldung per ext. Programm GUI-API) *05.05.1997 Copyrightcheck & -textbeschaffung ausgelagert *13.06.1997 Copyrightcheck in Formroutinen                      (PDW) *18.06.1997 Anmeldung in SPA US2 speichern fuer Status-Popup *29.09.1997 Korrektur (Copyright kam immer in System-Default-Sprache) *21.01.1998 Parameter SPR wird nicht mehr immer gesetzt! *18.02.1998 Anmeldung mit SNC mit Listauswahl                    (FB) *25.03.1998 Mehrfachanmeldung verhindern                        (PDW) *13.11.1998 Logo/HTML auf Anmeldebild                            (FB) *10.02.1999 Dynpro 500 (Lizenzinfo bei Mehrfachanmeldung)        (WJ) *24.02.1999 Profileparameter 'login/disable_multi_gui_login' (neu) *           und 'login/multi_login_users' (modifiziert)          (WJ) *02.03.1999 TEXTPOOL: LOOP ==> READ TABLE                        (FB) *10.03.1999 Logo/HTML auf Anmeldebild deaktiviert                (FB) *10.03.1999 Login Screen Info                                    (FB) *01.04.1999 Kennwort?nderung per RFC überarbeitet                (FB) *12.05.1999 Mehrfachanmeldeprüfung in den Kernel vorverlegt      (WJ) *26.05.1999 Dynpro 500: OK-Code ==> RSYST-PF25, "CANC"           (WJ) *01.09.1999 LIST_COPYRIGHT: TIME=RSYST-TX22                      (WJ) *24.11.1999 Dynpro 500: MULTI_LOGON_CHECK_CALLED eingefuehrt     (WJ) *30.11.1999 SNC falsche Meldung "Kein Benutzer vorhanden..."     (FB) *07.08.2000 Aufruf von SUBST_INS_STAT entfernt, da obsolet       (WJ) *02.10.2001 MODULE D029_USER_EXIT                                (WJ) *30.10.2001 Dynpro 0042 (und 'login/password_change_for_SSO')    (WJ) *20.11.2001 Dynpro 0500 (HANDLE_MULTI_LOGON_DISABLED: Fehler)    (WJ) *26.11.2001 Dynpro 0043 (bzw. Transaktion PASSWORD) angelegt     (WJ) *29.01.2003 Unused forms of SUSR_LOGIN_CHECK_RFC deleted         (FB) *29.01.2003 Calls of DOCU_INIT/DOCU_READ replaced by own code    (FB) *04.03.2003 multiple logon check improved (check again at PAI)   (WJ) *04.03.2003 SNC logon with service user => don't raise E message (WJ) *04.03.2003 SNC selection screen - proper handling for scrolling (WJ) *02.09.2003 Enable SNC logon despite C_LOCKED_BY_FAILED_LOGON    (WJ) *07.10.2003 snc/force_login_screen : check on '1' instead of 'X' (WJ) *07.05.2004 SNC logon attempt to locked client (scroll handling) (WJ) *03.11.2004 password change dialogs: support long passwords      (WJ) *13.01.2005 SUSR_PASSWORD_CHANGE_DIALOG: enable to abort dynpro  (WJ) *19.04.2006 MODULE STATUS_0043: modify screen     (note 942001)  (WJ) *01.10.2007 Extension of login/multi_login_users  (note 1098186) (UB) *12.12.2007 Enhanced error handling for SU3 password changing    (WJ) *22.02.2008 Compare new passwords not case-sensitive if *           login/password_downwards_compatibility is set to 5   (UB) *17.01.2011 PAI module RFCAUTH calling new kernel function (ANDRONACHE) *17.01.2011 SET PARAMETER 'US2' removed (done by kernel)         (WJ) *22.02.2011 Enable password logon if no SNC mapping exists       (WJ) *03.03.2011 Display I-message if (previous) failed logons > 0    (WJ) *13.01.2015 Handling password_change_for_SSO (note 2112577)      (WJ)  tables: tline, thead, dokil, dsyst. tables: usr01, usr02, *usr02, ush02, usr03, rsyst, usr22.   "USR0340A tables: xu180.   * Konstante fuer Benutzertyp data: typcpic value 'C'. * Konstanten fuer Datenbank & Copyright jetzt in Forms Copyright_Check..  data: menueflag type i value 0,       text1(132),       text2(132),       text3 like dsyst-doktitle. data: z type i value 0,       fcode(4).  data: xcode like usr02-bcode,          "Hilfsfeld fuer codierte Passwort       xcodvn like usr02-codvn.         "Hilfsfeld fuer Codeversion  field-symbols: <text>.  * Copyright-Text data: copyright_lines type i.  data: begin of sap_copyright occurs 20.         include structure tline. data: end of sap_copyright.  data: begin of db_copyright occurs 20.         include structure tline. data: end of db_copyright.  data: begin of head.         include structure thead. data: end of head.  data: begin of nrtext occurs 10.         include structure textpool. data: end of nrtext.  data: id(2),       object like dokil-object,       state  like dokil-dokstate. data: langu like sy-langu.                                  "BINK104530  data: rfc_program_id like rs38l-include. "RFC-Berechtigungsprüfung data: rfc_function_id like sy-xform. "RFC-Berechtigungsprüfung data: rfc_indikator(1) type c value space.  "Indikator   *---------------------------------------------------------------------* * Felder die benoetigt werden fuer: *       Dynpro 0025: *---------------------------------------------------------------------* data:         d0025_transaction(132),        "Starttransaktion u. evtl.                                       "Parameter
        d0025_new_bcode like rsyst-bcode.    "Neues Passwort


*---------------------------------------------------------------------*
* Felder die benoetigt werden fuer:
*       Dynpro 0042 / 0043
*---------------------------------------------------------------------*
constants: session_info type x value 2.
data:      auth_type    type c.
data:      pwdstate     type XUPWDSTATE.
data:      password_change_for_SSO.
data:      password_downwards_comp.
data:      pwd_rc       like sy-subrc.
data:      FCODE_0043   like RSYST-FCODE.
data:      CANCEL_0043(1).
data:      INTROTEXT1(95),
           INTROTEXT3(50),
           ERRORTEXT(95).
data:      policy        type security_policy_name,
           l_sec_context type security_context,
           l_pwd_logon   type abap_bool.


*---------------------------------------------------------------------*
* Felder die benoetigt werden fuer:
*       Dynpro 0200:
*---------------------------------------------------------------------*

data:                                  "Funktionscode
        newcode(8),
        newcode1(8),
        newpassflag type p value 0.

data already_shown.

*---------------------------------------------------------------------*
* Felder fuer Lizenzinformation bei Mehrfachanmeldung (Dynpro 500)    *
*---------------------------------------------------------------------*
data: multi_logon_text(250),"User xxx, client xxx is already logged in
      multi_logon_text2(250), "add. info (replacing the table control)
      multi_logon_opt1,  "terminate all other sessions
      multi_logon_opt2,  "open another (parallel) session
      multi_logon_opt3,  "cancel this logon session
      multi_logon_dummy. "used to suppress empty lines when hide option2
controls: multi_logon_tc type tableview using screen 500.
* globale Daten (für PAI-/PBO-Module zu Dynpro 500)
data:  begin of multi_logon_tab occurs 0,
          terminal   like usr41-terminal,
          server     like usr41-server,
          termid     like usr41-termid,  "für CALL 'ThSndDelUser'
          logon_date like usr41-logon_date,
          logon_time like usr41-logon_time,
       end of multi_logon_tab.
data:  multi_logons         type i value 0.  " counter: other logons
data:  multi_logon_disabled type c.          " prof. param. value (0/1)
data:  multi_login_user     type i value 0.  " flag due to prof. param.
data:  multi_logon_check_called type c.

*---------------------------------------------------------------------*
* Felder fuer Anmeldung mit externer ID                               *
*---------------------------------------------------------------------*
data: fatal_error    value ' '.

*---------------------------------------------------------------------*
*       MODULE D020_COPYRIGHT                                         *
*---------------------------------------------------------------------*
* Popup mit Copyright ausgeben, falls noch nicht gezeigt              *
*---------------------------------------------------------------------*
data installations_status like sy-subrc.
*
module d020_copyright.

* Zun?chst Zahl der Anmeldungen prüfen (Dynpro SAPMSYST/0500)
* PERFORM CHECK_MULTI_LOGON.  "wird ab sofort vom Kernel gerufen!

  perform get_copyright_text
                    tables   sap_copyright
                             db_copyright.
  perform copyright_check
                    tables   sap_copyright
                             db_copyright
                    using    rsyst-mandt rsyst-bname
                    changing already_shown.
  if already_shown = ' '.
    call screen 021 starting at 32 1 ending at 77 18.
  else.
    call dialog 'SYSTEMNACHRICHTEN'.  "Dynpro SAPMSEM1/0700
    perform set_spr.
    set screen 040.
  endif.
*
*  07.08.2000 - laut Robert Voelkel ist Aufruf überflüssig
*
*  call function 'SUBST_INS_STAT'
*       importing
*            status = installations_status.
*  if installations_status = 1.
*    message i735.
**   Ihr System ist nicht korrekt installiert
*  endif.
endmodule.


*---------------------------------------------------------------------*
*       MODULE D021_SUPPRESS                                          *
*---------------------------------------------------------------------*
* Popup mit Copyright unterdruecken                                   *
*---------------------------------------------------------------------*
module d021_suppress output.
  set pf-status 'RGHT'.
  set titlebar  'RGH'.
  suppress dialog.
endmodule.


*---------------------------------------------------------------------*
*       MODULE D021_FUNCT                                             *
*---------------------------------------------------------------------*
* Functionscode fuer Popup bei Copyright                              *
*---------------------------------------------------------------------*
module d021_funct.
  if menueflag = 1.
    set screen 040.
  else.
* Feststellen, ob es sich um einen CPIC-Benutzer handelt, dann kein
* Copyrightbild bringen.
    perform set_spr.
    select single * from usr02
           where bname = sy-uname.
    if usr02-ustyp = typcpic.
      set screen 040.
    else.
* Das Copyrightbild anzeigen.
      menueflag = 1.
      leave to list-processing.
      new-page no-title no-heading.
      perform list_copyright.
    endif.
  endif.
endmodule.


*---------------------------------------------------------------------*
*       MODULE LIST_COPYRIGHT                                         *
*---------------------------------------------------------------------*
* Liste mit Copyright ausgeben.                                       *
*---------------------------------------------------------------------*
form list_copyright.
  data: date like sy-datum,
        time like sy-uzeit.
*
  set pf-status 'RGHT'.
  set titlebar  'RGH'.
*
* Da waehrend der Anmeldung die Sprache veraendert werden kann, muss
* ich hier die Meldungstexte sicherheitshalber in der SY-LANGU Sprache
* lesen.
*
  read textpool 'SAPMSYST' into nrtext language sy-langu.
*
  skip.
  summary.
  read table nrtext with key id  = 'I' key = '003'.
  if sy-subrc = 0.
    write: nrtext-entry(25), sy-uname.
  endif.
  date = rsyst-tx21.
  if not date is initial.
*   WRITE:   'Letzte Anmeldung am'(001), DATE.
    read table nrtext with key id  = 'I' key = '001'.
    if sy-subrc = 0.
      write: nrtext-entry(25), date.
    endif.
*   WRITE: / '                 um'(002), TIME.
    read table nrtext with key id  = 'I' key = '002'.
    if sy-subrc = 0.
      time = rsyst-tx22.
      write: nrtext-entry(25), time.
    endif.
  else.
*   WRITE: 'Es erfolgte die erste Anmeldung am System'(004).
    read table nrtext with key id  = 'I' key = '004'.
    if sy-subrc = 0.
      write: nrtext-entry(60).
    endif.
  endif.

  uline.
  skip.
  detail.
*
* SAP-Copyright lesen und ausgeben
*
  call function 'SLIC_GET_LICENCE_DATE'
       importing
            licence_date = date.

* Copyright-Text in richtiger Sprache holen;
* beim Lesen für copyright_check ist sy-langu noch nicht richtig.
  perform get_copyright_text
                    tables   sap_copyright
                             db_copyright.
  describe table sap_copyright lines copyright_lines.
  if copyright_lines > 0.
    loop at sap_copyright.
      if sap_copyright-tdline = space.
        skip.
      else.
        write: / sap_copyright-tdline.
      endif.
    endloop.
    format intensified.
    if date < '99990000'.
      read table nrtext with key id  = 'I' key = '010'.
      if sy-subrc = 0.
        write: nrtext-entry(30), date.
        skip.
      endif.
    else.
      read table nrtext with key id  = 'I' key = '011'.
      if sy-subrc = 0.
        write: nrtext-entry(30).
        skip.
      endif.
    endif.
    format intensified off.
  endif.

  describe table db_copyright lines copyright_lines.
  if copyright_lines > 0.
    loop at db_copyright.
      if db_copyright-tdline = space.
        skip.
      else.
        write: / db_copyright-tdline.
      endif.
    endloop.
  endif.
endform.


at user-command.

************************************************************************
* Login-Lastverteil-Algorithmus aufrufen
* Wirkung: in jedem fünften Login wird der Login-Lastverteil-Algorithmus
* ausgefuehrt und fuehrt dadurch zu einer besseren Verteilung der
* angemeldeten Benutzer auf die Applikationsserver, insbesondere wenn
* sich viele Benutzer innerhalb kurzer Zeit anmelden
* 21.3.1995  Guenter Zachmann
************************************************************************
* submit rsrzllg0 and return.

  case sy-ucomm.
    when 'WEIT'.
      set screen 000.
      leave.
    when 'WEI2'.
      set screen 000.
      leave.
  endcase.

*&---------------------------------------------------------------------*
*&      Module  RFCPBO  OUTPUT
*&---------------------------------------------------------------------*
*       Uebernahme von Default-Werten                                  *
*----------------------------------------------------------------------*
module rfcpbo output.
  if ( rfc_indikator is initial ) and not ( sy-xprog is initial ).
    rfc_program_id = sy-xprog.
    rfc_function_id = sy-xform.
    rfc_indikator = 'X'.
  endif.
endmodule.                             " RFCPBO  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  RFCPAI  INPUT
*&---------------------------------------------------------------------*
*       text                                                           *
*----------------------------------------------------------------------*
module rfcpai input.
  set screen 0.
  leave screen.
endmodule.                             " RFCPAI  INPUT

*&---------------------------------------------------------------------*
*&      Form  ASK_FOR_USERNAME
*&---------------------------------------------------------------------*
*       text                                                           *
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form ask_for_username.
  data: systemtype(10).
*
  call 'C_SAPGPARAM'
       id 'NAME' field 'transport/systemtype'
       id 'VALUE' field systemtype.                              "#EC CI_CCALL
  if systemtype = 'SAP' and sy-uname <> 'SAP*' and sy-uname <> 'DDIC'.
    call function 'SUSR_USER_ADDRESS_READ'
         exporting
              user_name              = sy-uname
         importing
              user_usr03             = usr03
         exceptions
              user_address_not_found = 1
              others                 = 2. "USR0340A

*   select single * from usr03
*          where bname = sy-uname.
    if usr03-name1 = space or usr03-name2 = space.  "USR0340A
      xu180-prevname = usr03-name1.    "USR0340A
      xu180-famname = usr03-name2.     "USR0340A
      xu180-abteilung = usr03-abtlg.   "USR0340A
      call screen 70 starting at 25 10 ending at 79 18.
    endif.
  endif.
endform.                               " ASK_FOR_USERNAME

*&---------------------------------------------------------------------*
*&      Module  D070_SET_STATUS  OUTPUT
*&---------------------------------------------------------------------*
*       text                                                           *
*----------------------------------------------------------------------*
module d070_set_status output.
  set pf-status '0070'.
  set titlebar  '070'.
endmodule.                             " D070_SET_STATUS  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  D070_CONTINUE  INPUT
*&---------------------------------------------------------------------*
*       text                                                           *
*----------------------------------------------------------------------*
module d070_continue input.
  if fcode = 'CONT'.
    if xu180-prevname <> space and xu180-famname <> space.
      usr03-bname = sy-uname. "USR0340A
      usr03-name1 = xu180-prevname. "USR0340A
      usr03-name2 = xu180-famname. "USR0340A
      if xu180-abteilung <> space.
        usr03-abtlg = xu180-abteilung. "USR0340A
      endif.
      modify usr03.  "USR0340A    " nur in SAP - Systemen
*     hier muss ZAV noch eingebunden werden (MS)
    else.
      message e173.
    endif.
  endif.
  set screen 000.
endmodule.                             " D070_CONTINUE  INPUT

*&---------------------------------------------------------------------*
*&      Module  D020_USER_EXIT  INPUT
*&---------------------------------------------------------------------*
*       text                                                           *
*----------------------------------------------------------------------*
module d020_user_exit input.
************************************************************************
* Login-Lastverteil-Algorithmus aufrufen
* Wirkung: in jedem fünften Login wird der Login-Lastverteil-Algorithmus
* ausgefuehrt und fuehrt dadurch zu einer besseren Verteilung der
* angemeldeten Benutzer auf die Applikationsserver, insbesondere wenn
* sich viele Benutzer innerhalb kurzer Zeit anmelden
* 21.3.1995  Guenter Zachmann
************************************************************************
  submit rsrzllg0 and return. "#EC CI_SUBMIT

* Check if there have been (previous) failed password logon attempts
* (if there have, then display an informational message)
  DATA: BEGIN OF last_logon,
          date LIKE sy-datum,
          time LIKE sy-uzeit,
          date_now LIKE sy-datum,
          time_now LIKE sy-uzeit,
          pwdlgndate LIKE usr02-pwdlgndate,
          pwdlocnt(3),
        END OF last_logon,
        pwd_counter TYPE i.
  GET PARAMETER ID 'US2' FIELD last_logon.
  pwd_counter = last_logon-pwdlocnt.
  IF pwd_counter > 0.
* Display number of failed logon attempts only if password logon is possible
    CALL FUNCTION 'SUSR_USER_PASSWORD_STATUS_GET'
      EXCEPTIONS
        password_logon_disabled = 1
        user_has_no_password    = 2
        OTHERS                  = 0.
    IF sy-subrc = 0.
      MESSAGE i788(00) WITH pwd_counter.
    ENDIF.
  ENDIF.

* In SAP-Systemen ggf. den ausfuehrlichen Benutzernamen erfragen
* perform ask_for_username.
* Weitere Benutzer Exits
  call function 'SUSR_LOGON_USER_EXIT'
       exceptions
            others = 1.
* Event. eine Transaktion starten
  clear usr01.
  select single * from usr01
         where bname = sy-uname.
  if usr01-strtt <> space.
    leave to transaction usr01-strtt.
  endif.
endmodule.                             " D020_USER_EXIT  INPUT

************************************************************************
* Dynpro 0025 wird prozessiert, wenn eine Anmeldung per
* externem Programm (z.B. GUI-API) ans SAP-System durchgeführt wird
* 19.4.1996  Christian Jendel
************************************************************************
module d0025_pai input.
************************************************************************
* Login-Lastverteil-Algorithmus aufrufen
* Wirkung: in jedem fünften Login wird der Login-Lastverteil-Algorithmus
* ausgefuehrt und fuehrt dadurch zu einer besseren Verteilung der
* angemeldeten Benutzer auf die Applikationsserver, insbesondere wenn
* sich viele Benutzer innerhalb kurzer Zeit anmelden
* 21.3.1995  Guenter Zachmann
************************************************************************
  submit rsrzllg0 and return. "#EC CI_SUBMIT

* Weitere Benutzer Exits
* call function 'SUSR_LOGON_USER_EXIT'
*      exceptions
*           others  = 1.

  perform d0025_password.
  perform d0025_transaction.
endmodule.


*&---------------------------------------------------------------------*
*&      Module  D029_USER_EXIT  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE D029_USER_EXIT INPUT.
* customer exit (SUSR001, ZXUSRU01)
  call function 'SUSR_LOGON_USER_EXIT'
       exceptions
            others = 1.

ENDMODULE.                 " D029_USER_EXIT  INPUT


*---------------------------------------------------------------------*
*       FORM D0025_PASSWORD                                           *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form d0025_password.
endform.

*---------------------------------------------------------------------*
*       FORM D0025_TRANSACTION                                        *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form d0025_transaction.
  data: tcode like sy-tcode.

  tcode = d0025_transaction.
  if tcode <> space.
    leave to transaction tcode.
  else.
    clear usr01.
    select single * from usr01
           where bname = sy-uname.
    if usr01-strtt <> space.
      leave to transaction usr01-strtt.
    endif.
  endif.
endform.
*&---------------------------------------------------------------------*
*&      Module  RFCAUTH  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
data: rfcauth_param(8) value space,
      fugr like rs38l-area value space,
      trace(80) type c,
      text(128) type c,
      rfc_login_complete like sy-debug,
      dialog_user_type   like sy-debug,
      abap_trace_active(1) type c.
*
MODULE rfcauth INPUT.
* program_id = sy-xprog. wird in RFCPBO gesetzt !
  CLEAR: text, abap_trace_active.
*
* Systemcall composes all necessary actions which are required after a
* successful RFC logon: These are an authority check and preparation of
* (ext-) debugging.
* Systemcall 'h' will be obsolotete by this new system call.

  CALL 'RFCControl' ID 'CODE' FIELD '5'
                    ID 'PROGRAM_ID' FIELD rfc_program_id
                    ID 'FUNCTION_ID' FIELD rfc_function_id.                 "#EC CI_CCALL

  if sy-subrc = 0.     " authority check successful
* everthing o.k.

  elseif sy-subrc = 4. " authority check unsuccessful
      CONCATENATE sy-mandt '/' rsyst-bname ' (' rfc_function_id ') ' INTO text.
      MESSAGE a719 WITH text.

  else. " system call not available -> old behavior

* RFC-Authority-Check nur wenn Profileparameter gesetzt
    CALL 'C_SAPGPARAM'
         ID    'NAME'
         FIELD 'auth/rfc_authority_check'
         ID    'VALUE'
         FIELD rfcauth_param.                             "#EC CI_CCALL
* Ruechgabewert
    IF ( rfcauth_param > 0 ).
* OLD: fugr = sy-xprog+4(4).                "Name der Funktionsgruppe
*  message s000(sr) with rfc_program_id. "Progmramname als Trace
      CALL FUNCTION 'FUNCTION_INCLUDE_CONCATENATE'
        CHANGING
          program                  = rfc_program_id
          complete_area            = fugr
        EXCEPTIONS
          not_enough_input         = 1
          no_function_pool         = 2
          delimiter_wrong_position = 3
          OTHERS                   = 4.

      IF sy-subrc <> 0.                  "and sy-subrc <> 2.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

* Ist Abap-Trace aktiv -> Ausgabe vonb Zusatzinformationen
      CALL 'RFCControl' ID 'CODE' FIELD '2'.              "#EC CI_CCALL
      IF sy-subrc = 2. "Abap-Trace aktiv -> Ausgabe der Zusatzinfo
* LOGIN = Y o.k. and = N error, and dialog_user_type = 'Y' and 'N'
        CALL FUNCTION 'RFC_LOGON_INFO'
          IMPORTING
            rfc_login_complete = rfc_login_complete
            dialog_user_type   = dialog_user_type
          EXCEPTIONS
            OTHERS             = 1.
        abap_trace_active = 'X'.
      ENDIF.

      IF ( ( rfcauth_param = 1 OR rfcauth_param = 2 ) AND
             ( fugr NE 'SRFC' ) ) OR ( rfcauth_param > 2 ).
        AUTHORITY-CHECK OBJECT 'S_RFC'
           ID 'RFC_TYPE' FIELD 'FUGR'
           ID 'RFC_NAME' FIELD fugr
           ID 'ACTVT' FIELD '16'.
        IF sy-subrc NE 0.
          IF abap_trace_active = 'X'.
            CONCATENATE rsyst-bname '(' fugr ',' rfc_program_id ','
            rfc_function_id ',' rfc_login_complete dialog_user_type ')'
                                                             INTO text.
          ELSE.
            CONCATENATE rsyst-bname '(' fugr ')' INTO text
                                                 SEPARATED BY space.
          ENDIF.
*  Keine RFC-Berechtigung für Benutzer &.
*        MESSAGE E719 WITH RSYST-BNAME.
          MESSAGE a719 WITH text.
        ENDIF.

        IF abap_trace_active = 'X'.
          CONCATENATE rsyst-bname '(' fugr ',' rfc_program_id ','
          rfc_function_id ',' rfc_login_complete dialog_user_type ')'
                                                           INTO text.
          MESSAGE s000(sr) WITH text.
        ENDIF.
      ENDIF.

    ENDIF.

*   Aktivierung des HTTP/external Debuggings nach RFC-Anmeldung und
*   RFC-Berechtigungsprüfung
    CALL 'RFCControl' ID 'CODE' FIELD 'h'.                "#EC CI_CCALL
  endif.

ENDMODULE.                             " RFCAUTH  INPUT

*---------------------------------------------------------------------*
*       FORM GET_COPYRIGHT_TEXT                                       *
*---------------------------------------------------------------------*
*       Liefert Copyright-Text in aktueller sy-langu-Sprache          *
*---------------------------------------------------------------------*
*  <--  SAP_COPYRIGHT  STRUCTURE  TLINE                               *
*  <--  DB_COPYRIGHT   STRUCTURE  TLINE                               *
*---------------------------------------------------------------------*
form get_copyright_text
                        tables sap_copyright db_copyright.

  data: db_oracle(3)   value 'ORA',
        db_db6(3)      value 'DB6',
        db_informix(3) value 'INF',
        db_sql_db(3)   value 'SQL',
        db_adabas(3)   value 'ADA',
        db_allbase(3)  value 'ALL',
        db_sybase(3)   value 'SYB',
        db_mssql(3)    value 'MSS',
        db_db4(3)      value 'DB4',
        db_db2(3)      value 'DB2',

        copyright_oracle(20)    value 'COPYRIGHT_ORACLE',
        copyright_db6(20)       value 'COPYRIGHT_DB6',
        copyright_informix(20)  value 'COPYRIGHT_INFORMIX',
        copyright_sql_db(20)    value 'COPYRIGHT_SQL-DB',
        copyright_adabas(20)    value 'COPYRIGHT_ADABAS',
* 03/09 mit Version 7.5 wird SAP DB in MaxDB umbenannt
        copyright_mysql(20)     value 'COPYRIGHT_MYSQL',
        copyright_sybase(20)    value 'COPYRIGHT_SYBASE',
        copyright_allbase(20)   value 'COPYRIGHT_ALLBASE',
        copyright_mssql(20)     value 'COPYRIGHT_MSSQL',
        copyright_db4(20)       value 'COPYRIGHT_DB4',
        copyright_db2(20)       value 'COPYRIGHT_DB2'.

* Ende der Konstantendefinition.

  data: copyright_docu(60).

  data: begin of head.
          include structure thead.
  data: end of head.

  data: text3 like dsyst-doktitle.

  data: state like dokil-dokstate.

* 09/03: version of SAP DB / MaxDB
  data: dbvers(10)   TYPE c.


  call function 'DOCU_GET'
       exporting
            id                = 'TX'
            object            = 'COPYRIGHT_SAP'
            langu             = sy-langu
            typ               = 'E'
       importing
            dokstate          = state
            doktitle          = text3
            head              = head
       tables
            line              = sap_copyright
       exceptions
            ret_code          = 1
            no_docu_on_screen = 2
            no_docu_self_def  = 3
            no_docu_temp      = 4.
  if sy-subrc <> 0.
    clear sap_copyright.
    refresh sap_copyright.
  endif.
*
* Bei neuen DB-Plattformen muss hier die Case-Leiste entsprechend
* verlaengert werden, damit jeweils der richtige Copyrighttext bei
* der Anmeldung erscheint. Wichtig ist auch, dass der entsprechende
* Text als Dokubaustein 'COPYRIGHT_...' vorliegt und oben im Header
* dieses Modulpools die Konstanten DB_... und COPYRIGHT_... gepflegt
* werden.
*
  clear copyright_docu.
  case sy-dbsys(3).
    when db_db6.
      copyright_docu = copyright_db6.
    when db_oracle.
      copyright_docu = copyright_oracle.
    when db_informix.
      copyright_docu = copyright_informix.
    when db_sql_db.
      copyright_docu = copyright_sql_db.
    when db_adabas.
      call 'DB_GET_REL' id 'DBRELEASE' field dbvers.
      if dbvers >= '7.5'.   "#EC NOTEXT
        copyright_docu = copyright_mysql.
      else.
        copyright_docu = copyright_adabas.
      endif.
    when db_sybase.
      copyright_docu = copyright_sybase.
    when db_allbase.
      copyright_docu = copyright_allbase.
    when db_mssql.
      copyright_docu = copyright_mssql.
    when db_db4.
      copyright_docu = copyright_db4.
    when db_db2.                       " BINK107016
      copyright_docu = copyright_db2.  " BINK107016
*     :
*     :
*     :
  endcase.
  if copyright_docu <> space.
    call function 'DOCU_GET'
         exporting
              id       = 'TX'
              object   = copyright_docu
              langu    = sy-langu
              typ      = 'E'
         importing
              dokstate = state
              head     = head
         tables
              line     = db_copyright
         exceptions
              ret_code = 1.
    if sy-subrc <> 0.
      clear db_copyright.
      refresh db_copyright.
    endif.
  endif.

endform.


*---------------------------------------------------------------------*
*       FORM COPYRIGHT_CHECK                                          *
*---------------------------------------------------------------------*
*       Bildet Prüfsumme des SAP- und DB-Copyright-Textes, vergleicht *
*       sie mit der in USR22 hinterlegten und speichert sie ggf. dort *
*---------------------------------------------------------------------*
*  -->  SAP_COPYRIGHT            STRUCTURE  TLINE                     *
*  -->  DB_COPYRIGHT             STRUCTURE  TLINE                     *
*  -->  VALUE(MANDANT)           LIKE  RSYST-MANDT                    *
*  -->  VALUE(USER)              LIKE  RSYST-BNAME                    *
*  <--  ALREADY_SHOWN            TYPE  C                              *
*---------------------------------------------------------------------*
form copyright_check
                     tables sap_copyright db_copyright
                     using value(mandant) value(user)
                     changing already_shown.

  data: checksum type i.

  translate user to upper case.
  already_shown = ' '.                 " Default: Copyright zeigen!

  checksum = 0.                 " erster Aufruf, daher auf 0 setzen
  perform copyright_checksum tables sap_copyright
                             changing checksum.
  perform copyright_checksum tables db_copyright
                             changing checksum.

  if checksum > 0.           " Zumindest ein DOCU_GET war erfolgreich
*   Letzte Copyright-Checksumme aus USR22 holen.
    select single * from  usr22
           where  bname = user.
    if sy-subrc = 0.                   " Eintrag zum User gefunden
      if checksum = usr22-copyrtsum.   " Checksumme wie gehabt
        already_shown = 'X'.           " -> Copyright nicht zeigen!
      else.                            " Checksumme veraendert
        select single for update *     " -> Copyright zeigen!
               from usr22
               where  bname = user.
        usr22-copyrtsum = checksum.
        update usr22.                  " neue Checksumme speichern
      endif.
    else.
      if sy-dbcnt = 0.                 " Noch kein Eintrag zum User
        usr22-mandt     = mandant.     " -> Copyright zeigen!
        usr22-bname     = user.
        usr22-copyrtsum = checksum.
        insert usr22.                  " Checksumme zum User speichern
      endif.
    endif.
  endif.
endform.

*---------------------------------------------------------------------*
*       FORM COPYRIGHT_CHECKSUM                                       *
*---------------------------------------------------------------------*
*       Bildet Checksumme einer internen Text-Tabelle                 *
*---------------------------------------------------------------------*
*  -->  LINES       STRUCTURE  TLINE                                  *
*  <->  CHECKSUM    TYPE I                                            *
*---------------------------------------------------------------------*
form copyright_checksum tables lines structure tline
                        changing checksum.

  types: begin of convtype,
          hex1 type x,
          hex2 type x,
          hex3 type x,
          hex4 type x,
        end of convtype.
  field-symbols <conv> type convtype.
  data: convc(4) type c,
        i type i,
        length type i.

  loop at lines.
    length = strlen( lines-tdline ).
    i = 0.
    do length times.
      convc = lines-tdline+i(1).
      assign convc to <conv> casting.
      add <conv>-hex1 to checksum.
      add <conv>-hex2 to checksum.
      add <conv>-hex3 to checksum.
      add <conv>-hex4 to checksum.
      subtract 96 from checksum.
      add 1        to i.
    enddo.
  endloop.
endform.


*---------------------------------------------------------------------*
*       FORM SET_SPR                                                  *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form set_spr.
  data: langu like sy-langu.
  langu = space.
  get parameter id 'SPR' field langu.
  if langu = space.
    set parameter id 'SPR' field sy-langu.
  endif.
endform.


*---------------------------------------------------------------------*
*       MODULE SELTX_...                                              *
*---------------------------------------------------------------------*
*                                                                     *
*---------------------------------------------------------------------*
data: ret.
*
module seltx_o0 output.
  call 'C_SAPGPARAM'
     id 'NAME' field 'dynpro/select_tx'
     id 'VALUE' field ret.                                       "#EC CI_CCALL
  if sy-subrc eq 0 and ret eq 'X'.
    set screen '0100'.
    leave screen.
  endif.
endmodule.
*---------------------------------------------------------------------*
*       MODULE SELTX_O1 OUTPUT                                        *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
module seltx_o1 output.
*  submit startmen.
endmodule.
*---------------------------------------------------------------------*
*       MODULE SELTX_O2 OUTPUT                                        *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
module seltx_o2 output.
  submit startmen. "#EC CI_SUBMIT
endmodule.
*---------------------------------------------------------------------*
*       MODULE SELTX_I1                                               *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
module seltx_i1.
*  submit startmen.
endmodule.
*---------------------------------------------------------------------*
*       MODULE SELTX_I2                                               *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
module seltx_i2.
* if sy-ucomm = 'XXSESSION_MANAGER'.
*   call transaction 'SESS'.
* endif.
* submit startmen.
endmodule.



*&---------------------------------------------------------------------*
*&      Module  D020_LOGON_WITH_SNC  OUTPUT
*&---------------------------------------------------------------------*
*       Anmeldung mit SNC                         18.2.98 Frank Buchholz
*----------------------------------------------------------------------*
* Globale Daten
include user_constants.

tables: usracl.
*tables: usr02.

** Tabelle USRACLEXT wird bei Dialoganmeldung nicht berücksichtigt
** Die entsprechenden Programmstellen sind mit ** auskommentiert
** tables: usraclext.
** data with_usraclext value 'X'.

constants: true  value 'X',
           false value space.

controls tc_iusracl type tableview using screen '0020'.
data: tc_iusracl_sel,
      begin of iusracl occurs 0,
        mandt   like usracl-mandt,
        bname   like usracl-bname,
*       snc_sid like usracl-snc_sid,
*       guiflag like usracl-guiflag,
*       hname   like usracl-pname,
*       pname   like usracl-pname,
        client_locked(1),
        user_locked(1),
        user_deactive(1),
        user_nodialog(1),
      end of iusracl.
data: tc_old_top_line like tc_iusracl-top_line value 1,
      tc_has_been_scrolled,
      old_rsyst_mandt like rsyst-mandt.

data: login_type like snc_fields-login_type,
      iusracl_cnt type i,
      snc_active value '-',
      force_login_screen value '-',
      pname_appl like rfcdessecu-pname_appl,
      pname_user like usracl-pname,
      hname like usracl-hname,
      user_input value 'X',
      passwd_required,
      direct_logon.

data: extid_restart_counter type i value 0,
      extid_need_mandt     value ' ',
      extid_need_langu     value ' ',
      extid_need_bname     value ' '.
data: rc type i.

*
module d020_logon_with_snc output.
  CONSTANTS: SET_FLAG_NO_SNC_SSO  TYPE X  VALUE  7.


* SNC-Felder zun?chst ausblenden
  perform deactivate_snc_fields.

* SNC-Daten lesen
  if snc_active = '-'.
    snc_active = false.
    call function 'SNC_GET_MY_INFO'
         importing
              pname_appl     = pname_appl
*             SNC_QOP_MIN    =
*             SNC_QOP_MAX    =
*             snc_qop_use    =
              pname_user     = pname_user
*             PNAME_CPIC     =
*             GUI_CONN_TYPE  =
              login_type     = login_type
              rc             = rc
         exceptions
              internal_error = 1
              snc_not_active = 2
              others         = 3.
    case sy-subrc.
      when 0.
        if rc = 0.
*         SNC aktiv
          snc_active = true.
        else.
          message s766(00).            "Allgemeiner SNC Fehler
          exit.
        endif.
      when 1.
        message s766(00).              "Allgemeiner SNC Fehler
        exit.
      when 2.
*       SNC nicht aktiv
        exit.
      when others.
        message s766(00).              "Allgemeiner SNC Fehler
        exit.
    endcase.
*   login_type = 'SS'.                 "######## TEST ######

*   Profileparameter snc/force_login_screen lesen
    call 'C_SAPGPARAM'
      id 'NAME'  field 'snc/force_login_screen'
      id 'VALUE' field force_login_screen.                       "#EC CI_CCALL
    if sy-subrc = 0.
      case force_login_screen.
        when '0' or '1'. "do nothing
        when 'X'.        "downwards-compatibility
                          force_login_screen = '1'.
        when others.     "set default value
                          force_login_screen = '0'.
      endcase.
    else.
*     assume default value (0) if parameter is not set
      force_login_screen = '0'.
    endif.

  endif.
  case login_type.
    when 'SL'.
      perform snc_login_sl.
    when 'SS'.
      perform snc_login_ss.
  endcase.

endmodule.                             " D020_LOGON_WITH_SNC  OUTPUT

*---------------------------------------------------------------------*
*       FORM SNC_LOGIN_SL                                             *
*       SNC-Anmeldung mit Listauswahl nur für Anmeldeart SL           *
*---------------------------------------------------------------------*
form snc_login_sl .

data: cctemplock like t000-cctemplock.

if tc_has_been_scrolled is initial.
  clear: rsyst-mandt, rsyst-bname.
else.
  clear: tc_has_been_scrolled.
  rsyst-mandt = old_rsyst_mandt.
endif.

**if with_usraclext = true.
*** Eingabefelder ?ffnen wenn *-Eintrag aus USRACLEXT ausgew?hlt wurde
**  if user_input = true or passwd_required = true.
**    perform display_usr_fields.
**    loop at screen.
**      if user_input = true
**        and screen-name = 'RSYST-BNAME'.
**        screen-input     = 1.
**        modify screen.
**      endif.
**      if passwd_required = true
**        and screen-name = 'RSYST-BCODE'.
**        screen-input     = 1.
**        modify screen.
**      endif.
**    endloop.
**  endif.
**endif.                               "WITH_USRACLEXT

* Read data
  if tc_iusracl-lines = 0.

*   Hashwert zum SNC-Namen bestimmen
    call function 'SNC_CONVERT_PNAME_TO_KNAME'
       exporting
            pname          = pname_user
       importing
*           KNAMELEN       =
*           KNAME          =
            hname          = hname
            rc             = rc
       exceptions
            internal_error = 1
            others         = 2.
    if sy-subrc <> 0 or rc <> 0.
      message s766(00).                "Allgemeiner SNC Fehler
    endif.

*   Benutzer zum SNC-Namen (HNAME) lesen (über Index)
    select mandt bname                 "snc_sid guiflag hname pname
      from usracl
      client specified
      into table iusracl
      where  hname = hname
      order by mandt bname.                                      "EC CI_SGLSELECT
*   Nur aktive, nicht gesperrte Dialoguser akzeptieren
    loop at iusracl.
      clear:  iusracl-client_locked, iusracl-user_locked,
              iusracl-user_deactive, iusracl-user_nodialog.

*     Ignore inactive clients
      select single mandt cctemplock from t000 into (iusracl-mandt, cctemplock)
        where mandt = iusracl-mandt.
      if sy-subrc ne 0.
        delete iusracl.
*       Tables are inconsistent: We have USRACL but no T000
        continue.
      endif.

*     Check: client locked? (only DDIC/SAP* can logon)
      if not cctemplock is initial and
         iusracl-bname ne 'SAP*' and iusracl-bname ne 'DDIC'.
        iusracl-client_locked = 'X'.
        modify iusracl.
      endif.

      select single gltgv gltgb ustyp uflag from usr02
        client specified
        into (usr02-gltgv, usr02-gltgb, usr02-ustyp, usr02-uflag)
        where mandt = iusracl-mandt
          and bname = iusracl-bname
          and zbvmaster = space.
      if   sy-subrc    ne 0.
        delete iusracl.
*       Tables are inconsistent: We have USRACL but no USR02
*       Use checkprogram RSSNCCHK to repair.
        continue.
      endif.
      data usr02flag type x.
      usr02flag = usr02-uflag.
      if   usr02flag o  c_locked_by_admin
        or usr02flag o  c_locked_by_global_admin.
*       Notice: SNC logon despite C_LOCKED_BY_FAILED_LOGON
*               should be granted (see note 498889)!
        iusracl-user_locked = 'X'.
        modify iusracl.
      endif.
      if   ( not usr02-gltgv is initial and usr02-gltgv >  sy-datum )
        or ( not usr02-gltgb is initial and usr02-gltgb <  sy-datum ).
        iusracl-user_deactive = 'X'.
        modify iusracl.
      endif.
      if usr02-ustyp ne c_usertype_dialog AND
         usr02-ustyp ne c_usertype_service.
        iusracl-user_nodialog = 'X'.
        modify iusracl.
      endif.
    endloop.

*   Anzahl aktive User in USRACL
    describe table iusracl lines iusracl_cnt.

**  if with_usraclext = true.
***   USRACLEXT lesen und in Auswahlliste eintragen
**    data: begin of iusraclext occurs 0,
**            mandt     like usraclext-mandt,
**            bname     like usraclext-bname,
***           snc_sid   like usraclext-snc_sid,
***           hname     like usraclext-hname,
***           pname     like usraclext-pname,
**          end of iusraclext.
**    clear: user_input, passwd_required.
**    select mandt bname "snc_sid hname pname
**      from usraclext
**      client specified
**      into table iusraclext
**      where hname = hname.
**    select mandt bname snc_sid hname pname from usraclext
**      client specified
**      appending table iusraclext
**      where hname = '*'.
**    loop at iusraclext.
**      if iusraclext-bname ne '*'.
**        clear: IUSRACL.
***       Nur aktive, nicht gesperrte Dialoguser akzeptieren
**        select single gltgv gltgb ustyp uflag from usr02
**          client specified
**          into (usr02-gltgv, usr02-gltgb, usr02-ustyp, usr02-uflag)
**          where mandt = iusraclext-mandt
**            and bname = iusraclext-bname.
**        IF   SY-SUBRC    NE 0
**          continue.
**        endif.
**        if   USR02-UFLAG O  C_LOCKED_BY_ADMIN
**          OR USR02-UFLAG O  C_LOCKED_BY_FAILED_LOGON.
**          iusracl-locked = 'X'.
**        endif.
**        if  ( NOT USR02-GLTGV IS INITIAL AND USR02-GLTGV >  SY-DATUM )
**        OR ( NOT USR02-GLTGB IS INITIAL AND USR02-GLTGB <  SY-DATUM ).
**          iusracl-deactive = 'X'.
**        endif.
**        if USR02-USTYP NE C_USERTYPE_DIALOG.
**          continue.
**        endif.
**      endif.
***     Benutzer in Auswahlliste eintragen
**      read table iusracl
**      with key mandt = iusraclext-mandt
**               bname = iusraclext-bname
**      binary search
**      TRANSPORTING NO FIELDS.
**      check sy-subrc ne 0.
**      move-corresponding iusraclext to iusracl.
**      insert iusracl index sy-tabix.
**    endloop.
**  endif.                             "WITH_USRACLEXT

  endif.                               "if tc_iusracl-lines = 0.

* Anmeldung zugelassen?
  describe table iusracl lines tc_iusracl-lines.
  if tc_iusracl-lines = 0.
*   No SNC logon possible -> fallback to password logon
    login_type = 'SD'.
    CALL 'LOGIN_INFO' ID 'OPCODE' FIELD SET_FLAG_NO_SNC_SSO.
*   Kein Benutzer vorhanden mit SNC Name "&"
    MESSAGE s768(00) DISPLAY LIKE 'W' WITH pname_user.
    PERFORM restart_dynpro.
  endif.
  read table iusracl index 1.
  if iusracl_cnt = 1 and tc_iusracl-lines = 1
    and iusracl-client_locked is initial
    and iusracl-user_locked   is initial
    and iusracl-user_deactive is initial
    and iusracl-user_nodialog is initial.

*   Direkte Anmeldung
    direct_logon = true.
    read table iusracl index 1.
    rsyst-mandt = iusracl-mandt.
    rsyst-bname = iusracl-bname.
*   SNC-Anmeldung von &1 &2 für &3
    message s009(snc) with rsyst-mandt rsyst-bname pname_user.
    if force_login_screen = '1'.
      perform display_sncuser_fields.
    else.
      perform activate_snc_fields.
      suppress dialog.
      exit.
    endif.

  else.
*   Auswahl
    user_input = true.
    perform activate_snc_fields.
    message s008(snc). "Bitte R/3-Benutzer eingeben oder ausw?hlen
    exit.
  endif.

endform.                               "snc_login_sl

*---------------------------------------------------------------------*
*       FORM SNC_LOGIN_SS                                             *
*       SNC-Anmeldung Server (login_type='SS')                        *
*                                                                     *
*       Vor erster Dynproausgabe: Keine Mussfelder  im Servermode     *
*       Bei Dynprorestart: Eingabefelder nach Wunsch                  *
*---------------------------------------------------------------------*
form snc_login_ss .
  if extid_restart_counter = 0.
* Keine Musseingaben im ServerMode
    loop at screen.
      if screen-group1 = 'USR' and screen-group2 ne 'SPR'.
        screen-active    = 1.
        screen-input     = 1.
        screen-output    = 1.
        screen-required  = 0.
        modify screen.
      endif.
    endloop.
  else.                                "extid_restart_counter ist > 0
*   Dynprorestart bei Bearbeitung externer ID, weil nur
*   ganz bestimmte Eingabefelder angezeigt werden sollen
*   Bei fatal_error : AGate will Dynpro ohne Eingabefelder !
    loop at screen.
      if fatal_error = true.
        screen-active    = 0.
      else.
        check screen-group1 = 'USR'.
        if screen-name = 'RSYST-BNAME' and extid_need_bname = true
        or screen-name = 'RSYST-MANDT' and extid_need_mandt = true
        or screen-name = 'RSYST-LANGU' and extid_need_langu = true.
          screen-active    = 1.
          screen-input     = 1.
          screen-output    = 1.
          screen-required  = 0.
        else.
          screen-active    = 0.
        endif.
      endif.                           " fatal_error = true
      modify screen.
    endloop.
  endif.                               "extid_restart_processing = 0
endform.                               "snc_login_ss

*---------------------------------------------------------------------*
*       FORM ACTIVATE_SNC_FIELDS                                      *
*---------------------------------------------------------------------*
form activate_snc_fields.
  set pf-status '0020' excluding 'RESE'.
* Benutzerfelder aktivieren
  if user_input = true.
    loop at screen.
      if screen-group1 = 'USR'.
        screen-active    = 1.
        screen-input     = 1.
        screen-output    = 1.
        screen-invisible = 0.
        screen-required  = 0.
        modify screen.
      endif.
    endloop.
  endif.
* Kennwortfelder deaktivieren
  if passwd_required = false.
    loop at screen.
      if screen-group2 = 'PWD'.
        screen-active   = 0.
        screen-required = 0.
        modify screen.
      endif.
    endloop.
  endif.
* SNC-Felder aktivieren
  loop at screen.
    if screen-group1 = 'SNC'.
      screen-active    = 1.
      screen-output    = 1.
      screen-invisible = 0.
      modify screen.
    endif.
  endloop.
  tc_iusracl-invisible = false.
endform.

*---------------------------------------------------------------------*
*       FORM DISPLAY_SNCUSER_FIELDS
*---------------------------------------------------------------------*
form display_sncuser_fields.
  set pf-status '0020' excluding 'RESE'.
* Benutzerfelder aktivieren
* if user_input = true.
  loop at screen.
    if screen-group1 = 'USR' and screen-group2 ne 'SPR'.
      screen-active    = 1.
      screen-input     = 0.
      screen-output    = 1.
      screen-invisible = 0.
      screen-required  = 0.
      modify screen.
    endif.
  endloop.
* endif.
* Kennwortfelder deaktivieren
  if passwd_required = false.
    loop at screen.
      if screen-group2 = 'PWD'.
        screen-active   = 0.
        screen-required = 0.
        modify screen.
      endif.
    endloop.
  endif.
* SNC-Felder aktivieren
  loop at screen.
    if screen-group1 = 'SNC'.
      screen-active    = 1.
      screen-output    = 1.
      screen-invisible = 0.
      modify screen.
    endif.
  endloop.
  tc_iusracl-invisible = true.
endform.

*---------------------------------------------------------------------*
*       FORM DEACTIVATE_SNC_FIELDS
*---------------------------------------------------------------------*
form deactivate_snc_fields.
* SNC-Felder deaktivieren
  loop at screen.
    if screen-group1 = 'SNC'.
      screen-active    = 0.
      modify screen.
    endif.
  endloop.
  tc_iusracl-invisible = true.
endform.

*---------------------------------------------------------------------*
*       FORM RESTART_DYNPRO                                           *
*---------------------------------------------------------------------*
form restart_dynpro.
  if login_type = 'SS'.
    extid_restart_counter = extid_restart_counter + 1.
  endif.
  set screen sy-dynnr.
  leave screen.
endform.

*&---------------------------------------------------------------------*
*&      Module  D020_GET_USER_DATA  OUTPUT
*&---------------------------------------------------------------------*
*       Weitere Benutzerdaten lesen
*----------------------------------------------------------------------*
module d020_get_user_data output.
  check login_type = 'SL'.
  check snc_active = true.
* Erste Zeile der Benutzerauswahlliste markieren
* Deaktiviert da beim Bl?ttern mit markierter Zeile bereits die
* Anmeldung ausgel?st wird.
* if  TC_IUSRACL-CURRENT_LINE = 1.
*   TC_IUSRACL_SEL = 'X'.
* endif.


endmodule.                             " D020_GET_USER_DATA  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  D020_SNC_SELECT_USER  INPUT
*&---------------------------------------------------------------------*
*       Auswahl des R/3-Benutzers
*----------------------------------------------------------------------*
data: cursor_line type i,
      cursor_area(30).
*
module d020_snc_select_user input.
  check login_type = 'SL'.
  check snc_active = true.
  check direct_logon = false.
* Markierspalte ersetzt durch einzelne Drucktasten

  if tc_old_top_line <> tc_iusracl-top_line.
*   table control has been scrolled ...
    tc_old_top_line = tc_iusracl-top_line.
    old_rsyst_mandt = rsyst-mandt.
    tc_has_been_scrolled = 'X'.
    perform restart_dynpro.
  endif.

  get cursor
    line   cursor_line
    area   cursor_area.
  check cursor_area = 'TC_IUSRACL'.

  cursor_line = cursor_line + tc_iusracl-top_line - 1.
  read table iusracl index cursor_line.
  check sy-subrc = 0.
* check TC_IUSRACL_SEL = TRUE.

* Dismiss locked and deactive users
  if iusracl-client_locked = 'X'.
    message e166(00). "Mandant ist gesperrt
  endif.
  if iusracl-user_locked = 'X'.
    message e158(00). "Benutzer ist gesperrt
  endif.
  if iusracl-user_deactive = 'X'.
    message e148(00). "Benutzer ist nicht im Gültigkeitsdatum.
  endif.
  if iusracl-user_nodialog = 'X'.
    message e156(00). "Bitte mit einem Dialogbenutzer anmelden
  endif.

    rsyst-mandt = iusracl-mandt.
    rsyst-bname = iusracl-bname.
    clear: user_input, passwd_required, rsyst-bcode.

**  if with_usraclext = true and
**    ( iusracl-bname = '*' or iusracl-hname = '*' ).
*
**    if rsyst-bname = '*'.
**      clear rsyst-bname.
**      user_input      = true.
**    endif.
**    passwd_required = true.
**    perform restart_dynpro.
*
**  else.                              "WITH_USRACLEXT
*
*     Nochmals Tabelle lesen
    select single mandt bname          "snc_sid guiflag hname pname
      from usracl
      client specified
      into (iusracl-mandt, iusracl-bname)
      where  hname = hname
        and  mandt = rsyst-mandt
        and  bname = rsyst-bname.
    if sy-subrc ne 0.
*       Tabelle ge?ndert Anmeldung nicht mehr m?glich
      clear: tc_iusracl-lines, rsyst-mandt, rsyst-bname.
      perform restart_dynpro.
    endif.

*     Direkte Anmeldung
    direct_logon = true.
*     SNC-Anmeldung von &1 &2 für &3
    message s009(snc) with rsyst-mandt rsyst-bname pname_user.
**  endif.                             "WITH_USRACLEXT


endmodule.                             " D020_SNC_SELECT_USER  INPUT

*&---------------------------------------------------------------------*
*&      Module  D020_SNC_CHECK_SELECTED_USER  INPUT
*&---------------------------------------------------------------------*
module d020_snc_check_selected_user input.
  check login_type = 'SL'.
  check snc_active = true.
  check direct_logon = false.

* Kein Benutzer zugeordnet
  if tc_iusracl-lines = 0.
    clear: rsyst-bname.
*   Kein Benutzer vorhanden mit SNC Name "&"
    message e768(00) with pname_user.
  endif.

* Gültiger R/3-Benutzer eingegeben?
  if not rsyst-mandt is initial and not rsyst-bname is initial.
    read table iusracl
      with key mandt = rsyst-mandt
               bname = rsyst-bname
      transporting no fields.
*   Nochmals Tabelle lesen
    if sy-subrc = 0.
      select single mandt bname        "snc_sid guiflag hname pname
        from usracl
        client specified
        into (iusracl-mandt, iusracl-bname)
        where  hname = hname
          and  mandt = rsyst-mandt
          and  bname = rsyst-bname.
      if sy-subrc ne 0.
*       Tabelle ge?ndert Anmeldung nicht mehr m?glich
        clear tc_iusracl-lines.
      endif.
    endif.
    if sy-subrc ne 0.
      clear: rsyst-bname.              "Krücke, da das Mandantenfeld
                                       "sowieso zurückgesetzt wird.
                                       "E-Message geht nicht, da Table
                                       "Control nicht aktiviert wird.
    endif.
  endif.
* R/3-Benutzer eingegeben?
  if user_input = true and rsyst-bname is initial.
    message s008(snc). "Bitte gült. R/3-Benutzer eingeben oder ausw?hlen
  endif.
* Kennwort erforderlich?
  if passwd_required = true and rsyst-bcode is initial.
    message s010(snc).                 "Bitte Kennwort eingeben
  endif.
* Dynpro erneut anzeigen, wenn kein R/3-Benutzer ausgew?hlt
  if rsyst-mandt is initial or rsyst-bname is initial.
    perform restart_dynpro.
  endif.
endmodule.                 " D020_SNC_CHECK_SELECTED_USER  INPUT

*&---------------------------------------------------------------------*
*&      Module  D020_SNC_CHECK_EXTID  INPUT
*&---------------------------------------------------------------------*
*       Bearbeitung Login mit externer Info:
*       - RFC, um externe Info zu holen
*       - Abbildung auf R/3 User
*       Falls Eingabedaten fehlen, erneutes senden des Anmeldedynpros
*       (nur fehlende Felder offen -> geht nur ueber "Restart")
*----------------------------------------------------------------------*
* Valid values for extid_type :
constants: certificate_base64      type i   value 1,
           max_cert_base64_length  type i   value 8400 .

data: extid_length   like extid_info-length
    , extid_type     like extid_info-type
    .
data: extid_data_table type extid_tab .

data: msg_text(80) type c.             "Message text

data: extid_bname like rsyst-bname     "bname aus der Abbildung
    , extid_dname(1024) type c         "not: like usrextid-extid
    .

*---------------------------------------------------------------------*
*       MODULE D020_SNC_CHECK_EXTID INPUT                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
data: extid_data_string  like extid_strg.   "type x
*
module d020_snc_check_extid input.
  check login_type = 'SS' .

  case rsyst-fcode.
    when 'EXTD'.
      if fatal_error = true .
        call 'SYST_LOGOFF'.                                      "#EC CI_CCALL
      endif.
*     Verarbeitung mit externer Id gewuenscht.
*     Zuerst: Externe Id (Zertifikat) abholen.
      if extid_restart_counter = 0.
        call function 'SNC_GET_EXTERNAL_ID'  destination  'SAPGUI'
          importing
            extid_length          = extid_length
            extid_type            = extid_type
          tables
            extid_data            = extid_data_table
          exceptions
            no_data_available     = 1
            internal_error        = 2
            communication_failure = 3 message msg_text
            system_failure        = 4 message msg_text
            others                = 5 .
        if sy-subrc <> 0.
          fatal_error = true.
*         message a012(snc) with sy-subrc msg_text .
          perform snc_jcb_msg using 12 sy-subrc msg_text .
        endif.

*       Externe Id formal pruefen
        perform snc_check_extid
          using extid_length extid_type
          changing rc.
        case rc.
          when 1.
            fatal_error = true.
*           message a017(snc) with extid_length .
            perform snc_jcb_msg using 17 extid_length ' '.
          when 2.
            fatal_error = true.
*           message a016(snc) with extid_type .
            perform snc_jcb_msg using 16 extid_type ' '.
        endcase.
      endif .                          "  extid_restart_counter = 0

*     Pruefen: mindestens Mandant muss da sein.
*     message s800(snc) with rsyst-mandt extid_dname.       "### test
*     perform snc_jcb_msg using 12 extid_type rsyst-mandt . "### test
      if rsyst-mandt is initial.
*       perform snc_jcb_msg using 12 extid_type 'MAND-INI'.  " ### test
        if rsyst-bname is initial.
          rsyst-bname = '*' .
        endif.
        extid_need_mandt      = true.
        extid_need_bname      = true.
        extid_need_langu      = true.
        perform restart_dynpro.
      endif.                           " rsyst-mandt is initial.

*     Der abgeholten externen Id einen R/3-User zuordnen.
      extid_bname = rsyst-bname.
      case extid_type.
        when certificate_base64 .
          perform snc_conv_cert_base64
            tables    extid_data_table
            using     extid_length
            changing  extid_data_string .

          perform snc_map_cert_base64_to_user
*           tables   extid_data_table
            using    rsyst-mandt extid_data_string extid_length
            changing extid_bname extid_dname rc .
        when others.                   " Nicht unterstützer Typ
          fatal_error = true.
*          message a014(snc) with extid_type.
          perform snc_jcb_msg using 14 extid_type ' '.
      endcase.                         " extid_type.

      case rc.
        when 0.                        "alles ok, einfach weiterlaufen
        when 1.                        "Extid nicht gefunden
          if rsyst-bname is initial.   "bname war nicht spezifiziert
            fatal_error = true.
            message s800(snc) with rsyst-mandt extid_dname.
            perform restart_dynpro.
          else.                        "bname war spezifiziert
            extid_need_mandt      = true.
            extid_need_bname      = true.
            extid_need_langu      = true.
            message s013(snc) with rsyst-mandt extid_dname rsyst-bname.
            perform restart_dynpro.
          endif.
        when 2.                        "Benutzer nicht eindeutig
          if rsyst-bname is initial.
            rsyst-bname = '*' .
          endif.
          extid_need_bname      = true.
          extid_need_langu      = true.
          perform restart_dynpro.
      endcase.

*     Benutzer Blank nicht zulassen
      if extid_bname is initial.
        message s800(snc) with rsyst-mandt extid_dname.
        perform restart_dynpro.
      endif.

*     wenn Benutzer ok: Anmeldung aufrufen.
      perform snc_login_from_server
        using      rsyst-mandt  extid_bname rsyst-langu  'D'
        changing   rc .

      case rc.
        when 0.                        "Das war ok
        when 3.                        "Keine SNC Verbindung
          call 'LOGIN_FOR_SNC_SERVER'  "Abbruch message
          id  'MSG_NR'      field 21 .                           "#EC CI_CCALL
        when 4.                        "Keine Server Anmeldung
          call 'LOGIN_FOR_SNC_SERVER'  "Abbruch message
          id  'MSG_NR'      field 22 .                           "#EC CI_CCALL
        when 6.      "Server Login nicht per Profil aktiviert
          call 'LOGIN_FOR_SNC_SERVER'  "Abbruch message
          id  'MSG_NR'      field 19 .                           "#EC CI_CCALL
        when others.                   "Das sollte nicht auftreten ..
          perform snc_jcb_msg using 20 rc ' '.
      endcase.
*
*     rsyst-fcode loeschen, sonst fm: Transaktion EXTD unbekannt.
      rsyst-fcode = '        '.

    when others.                       "case rsyst-fcode
*     Musseingaben pruefen.
*     (Bei Server-Anmeldung ohne FCODE=/EXTD )
      if rsyst-mandt is initial
      or rsyst-bname is initial

标签: bzw04p26抑制二极管bzw04p17抑制二极管bzw04p64抑制二极管bzw04p128抑制二极管bzw22二极管bzw04p16b抑制二极管

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台