REPORT ZZBGS002 MESSAGE-ID Z1 NO STANDARD PAGE HEADING LINE-COUNT 65 LINE-SIZE 132. *---------------------------------------------------------------------* * Emne: Program Mananager, showing directory list from Unix* * and posibility to select and do things with the * * selected file * * * * Beskrivelse: With an C-call you have access to UNIX. thes is * * used to call standad unix operating system calls * * 'ls'. * * Remember that you have SAP authorization on Unix * * so be careful out there. * * * * Autorisation: None * * * * Customisering: No customizing * * * * Parametre: Filename incl. path * * * * Releaseskifte: Check you are alowed to use C calls * * * * Programmør: Benny G. Sørensen * * * * SAP Release: 3.0x * *---------------------------------------------------------------------* *---------------------------------------------------------------------* * Global Variables. * *---------------------------------------------------------------------* DATA: BEGIN OF TABL OCCURS 0, LINE(132), END OF TABL. DATA: PARCOM_LOC(100) TYPE C. * DATA: NAME(45) TYPE C, SIZE(10) TYPE C, DATE(12) TYPE C, OFFSET LIKE SY-FDPOS, LINE LIKE TABL-LINE, SUM(16) TYPE C. DATA: FILE(45) TYPE C. FIELD-SYMBOLS: <FIELD>. *-------------------------------------------------------------------* * Parameters. * *-------------------------------------------------------------------* SELECTION-SCREEN SKIP 2. PARAMETERS: PARCOM(45) TYPE C LOWER CASE. *-------------------------------------------------------------------* * Validate parameter. * *-------------------------------------------------------------------* AT SELECTION-SCREEN. CONDENSE: PARCOM NO-GAPS. *-------------------------------------------------------------------* * TOP-OF-PAGE. * *-------------------------------------------------------------------* TOP-OF-PAGE. PERFORM WRITE_PAGE_HEADING. *-------------------------------------------------------------------* * INITIALIZATION. * *-------------------------------------------------------------------* INITIALIZATION. PARCOM = '/usr/sap/tmp/*'. "Only default value *-------------------------------------------------------------------* * START-OF-SELECTION. * *-------------------------------------------------------------------* START-OF-SELECTION. PERFORM MAKE_LOC. PERFORM COLLECT_DATA. PERFORM FILE_LIST. *-------------------------------------------------------------------* * AT LINE-SELECTION. * *-------------------------------------------------------------------* AT LINE-SELECTION. DATA: PATH(255) TYPE C. CLEAR FILE. FILE = SY-LISEL+55. REPLACE '|' WITH SPACE INTO FILE. IF SY-LISEL+1(1) = 'd'. PATH = FILE. PATH+200 = '/*'. CONDENSE PATH NO-GAPS. SUBMIT ZZBGS002 WITH PARCOM = PATH AND RETURN. ENDIF. IF SY-LISEL+1(1) NE '-' . EXIT. ENDIF. * SUBMIT < your own file browser, not included on this Web page > * WITH PARCOM = FILE * AND RETURN. *---------------------------------------------------------------------* * FORM MAKE_LOC. * *---------------------------------------------------------------------* FORM MAKE_LOC. CLEAR: PARCOM_LOC. PARCOM_LOC(7) = 'ls -ld '. PARCOM_LOC+7(45) = PARCOM. ENDFORM. *---------------------------------------------------------------------* * FORM COLLECT_DATA. * *---------------------------------------------------------------------* FORM COLLECT_DATA. REFRESH TABL. CALL 'SYSTEM' ID 'COMMAND' FIELD PARCOM_LOC ID 'TAB' FIELD TABL-*SYS*. ENDFORM. *-------------------------------------------------------------------* * FORM FILE_LIST. * *-------------------------------------------------------------------* FORM FILE_LIST. FORMAT RESET. CLEAR SUM. LOOP AT TABL. CLEAR LINE. LINE = TABL-LINE. WRITE /2 LINE. PERFORM VERTICAL_LINES. SUM = SUM + SIZE. ENDLOOP. WRITE:/1(132) SY-ULINE. ENDFORM. *-------------------------------------------------------------------* * FORM WRITE_PAGE_HEADING. * *-------------------------------------------------------------------* FORM WRITE_PAGE_HEADING. WRITE:/1(132) SY-ULINE. PERFORM VERTICAL_LINES. FORMAT INTENSIFIED. WRITE: /2(131) SPACE COLOR 1. WRITE: 2 SY-DATUM COLOR 1. WRITE: 35 'File Manager' COLOR 1. PERFORM VERTICAL_LINES. WRITE:/1(132) SY-ULINE. PERFORM VERTICAL_LINES. FORMAT INTENSIFIED. WRITE: /2(131) SPACE COLOR 3. PERFORM VERTICAL_LINES. FORMAT RESET. WRITE:/1(132) SY-ULINE. ENDFORM. *-------------------------------------------------------------------* * FORM VERTICAL_LINES. * *-------------------------------------------------------------------* FORM VERTICAL_LINES. PERFORM WRITE_VLINE USING ' ' 1. PERFORM WRITE_VLINE USING ' ' 132. ENDFORM. *-------------------------------------------------------------------* * WRITE_VLINE. * *-------------------------------------------------------------------* FORM WRITE_VLINE USING MODE POS. IF MODE NE 'T'. FORMAT INTENSIFIED. ENDIF. POSITION POS. WRITE: SY-VLINE. IF MODE NE 'T'. FORMAT RESET. ENDIF. ENDFORM.