REPORT ZTSTPOOL.
************************************************************************
* Customized dynamic login screen for 3.1 and 4.0 systems
* (SAPMSST can not be edited any more)
* To make it work:
* - Create a 83X11 subscreen area TESTSCR on the bottom of SAPMSYST/0020
* - In the flow logic at the end of the PBA insert:
*            CALL SUBSCREEN TESTSCR INCLUDING 'ZTSTPOOL' '0010'.
* - Create the subscreen type screen 0010 with module pool ZTSTPOOL
* - Create the output type fields line1 ... line9 for 0010/ZTSTPOOL
* - Call DISPLAY_DATA from the PBO of 0010/ZTSTPOOL
* - Create a UNIX file with the system description, important messages
*   on a shared directory like /usr/sap/trans with the following format:
*        Z|SID|Description
*        M|SID|System message line1
*        M|SID|System message line2
************************************************************************
*
* Data for the communication between the screen and the modules
DATA: MESSAGE(20), LINE1(81), LINE2(81), LINE3(81), LINE4(81),
      LINE5(81), LINE6(81), LINE7(81), LINE8(81), LINE9(81).
* The PBO of the subscreen
MODULE DISPLAY_DATA OUTPUT.
* Local data
  DATA: L(200), A1(81), A2(81), A3(81).
  DATA: DESRCIPTION(6) VALUE 'Z|   |',
        SYSTEM_MESSAGE(6) VALUE 'M|   |'.
  DATA: BEGIN OF A.
          INCLUDE STRUCTURE RFCSI.
  DATA: END OF A.
  DATA: BEGIN OF LINE_TBL OCCURS 100.
          INCLUDE STRUCTURE SPFLIST.
  DATA: END OF LINE_TBL.
*
* Only for testing: run it only for a specific terminal
* CALL FUNCTION 'RFC_SYSTEM_INFO' DESTINATION 'SAPGUI'
* IMPORTING RFCSI_EXPORT = A.
* IF A CS 'RCHEN'.
* End of Only for testing
*
* Create the SID specific search patterns
  DESRCIPTION+2(3) = SY-SYSID.
  SYSTEM_MESSAGE+2(3) = SY-SYSID.
* Trick to avoid OPEN DATASET (no user->no authorization->open fails)
    CALL FUNCTION 'RZL_READ_FILE_LOCAL'
         EXPORTING
              DIRECTORY = '/usr/sap/trans'
              NAME      = 'system_descriptions'
         TABLES
              LINE_TBL  = LINE_TBL
         EXCEPTIONS
              NOT_FOUND = 1.
* If the file is missing: do not display anything
IF SY-SUBRC = 1.
  EXIT.
ENDIF.
* Get the system description and important messages from the file
    LOOP AT LINE_TBL.
      L = LINE_TBL-LINE.
      IF L CS DESRCIPTION.
        SPLIT L AT '|' INTO A1 A2 A3.
        LINE1 = A3.
      ENDIF.
      IF L CS SYSTEM_MESSAGE.
        SPLIT L AT '|' INTO A1 A2 A3.
        IF LINE3 IS INITIAL.
          LINE3+6 = A3.
        ELSE.
          IF LINE4 IS INITIAL.
            LINE4+6 = A3.
          ELSE.
            IF LINE5 IS INITIAL.
              LINE5+6 = A3.
            ELSE.
              LINE6+6 = A3.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
* Some hardcoded information added here
      LINE8 = 'For more information visit:'.
      LINE9 = 'http://company_web_server/basis_support.htm'.
    ENDLOOP.
* ENDIF.           "Only for testing
ENDMODULE.