Report  for downloading the source code of a Program

Hi.
Need a code to download the source code of a Program in a text file and all the includes of that program in a separate coressponding files. <b>This should be with scan and read report statements.It should be with classe CL_GUI_FRONTEND_SERVICES  but not with function modules.</b>
Thanks in advance.
Regards,
Asha

Hi Asha
Use the below program for your purpose.
Report: ZKBPROGS             *
Function   : Up/Download ABAP reports complete with texts            *
Change Log :                 *
July 5, 1999         *
   - Combined existing programs that did the upload and download into*
   - one program.            *
   - Changed format that the reports are saved in to be compatible   *
     with Wolfgang Morgenthaler's upload/download program(YSTRASN00  *
     at www.antarcon.de).  Major differences between this program and*
     Wolfgang's are:
        - this program does not update TRDIR with the                *
          TRDIR entries that are in the program uploaded.  Instead,  *
          current users stats are used.          *
        - this program allows selection of reports from a list or    *
          a single report can be tuped in and uploaded               *
        - this program also updates TADIR so that a development class*
          is assigned to the program             *
        - this program checks to see if the program already has a    *
          TRDIR entry, and if it does, warns the user                *
        - this program will save/restore the program documenation too*
REPORT ZKBPROGS
       NO STANDARD PAGE HEADING
       LINE-SIZE  255.
Declare Database Objects     *
tables:
  DOKIL,
  TRDIR.
Constants*
CONSTANTS:
  MC_TRDIR_IDENTIFIER(72)  TYPE C VALUE '%&%& RDIR',
  MC_REPORT_IDENTIFIER(72) TYPE C VALUE '%&%& REPO',
  MC_TEXT_IDENTIFIER(72)   TYPE C VALUE '%&%& TEXP',
  MC_THEAD_IDENTIFIER(72)  TYPE C VALUE '%&%& HEAD',
  MC_DOC_IDENTIFIER(72)    TYPE C VALUE '%&%& DOKL',
  MC_TRDIR_SHORT(4)        TYPE C VALUE 'RDIR',
  MC_REPORT_SHORT(4)       TYPE C VALUE 'REPO',
  MC_TEXT_SHORT(4)         TYPE C VALUE 'TEXP',
  MC_THEAD_SHORT(4)        TYPE C VALUE 'HEAD',
  MC_DOC_SHORT(4)          TYPE C VALUE 'DOKP'.
Declare Module level data structures             *
DATA: BEGIN OF MTAB_PROGRAM_SOURCE OCCURS 0,
        LINE(72) TYPE C,
      END OF MTAB_PROGRAM_SOURCE.
DATA: MTAB_PROGRAM_TRDIR LIKE TRDIR OCCURS 0 WITH HEADER LINE.
DATA: MTAB_PROGRAM_TEXTS LIKE TEXTPOOL OCCURS 0 WITH HEADER LINE.
DATA: MSTR_THEAD LIKE THEAD.
DATA: BEGIN OF MTAB_PROGRAM_FILE OCCURS 0,
        LINE(275) TYPE C,
      END OF MTAB_PROGRAM_FILE.
DATA: BEGIN OF MTAB_DIRECTORY OCCURS 0,
        NAME LIKE TRDIR-NAME,
        DESC(72) TYPE C,
        SAVENAME LIKE RLGRAP-FILENAME,
      END OF MTAB_DIRECTORY.
DATA: BEGIN OF MTAB_PROGRAM_DOCUMENTATION OCCURS 0,
        LINE(255) TYPE C,
      END OF MTAB_PROGRAM_DOCUMENTATION.
Selection Screen             *
*-- Options for upload/download of programs
SELECTION-SCREEN BEGIN OF BLOCK FRM_OPTIONS WITH FRAME TITLE TEXT-UDL.
PARAMETERS:
  RB_DOWN RADIOBUTTON GROUP UDL DEFAULT 'X'.       " Download reports
SELECTION-SCREEN BEGIN OF BLOCK FRM_TRDIR WITH FRAME TITLE TEXT-DIR.
SELECT-OPTIONS:
  S_NAME  FOR TRDIR-NAME,              " Program Name
  S_SUBC  FOR TRDIR-SUBC               " Program Type
          DEFAULT 'F' OPTION EQ SIGN E," Exclude Functions by default
  S_CNAM  FOR TRDIR-CNAM               " Created by
          DEFAULT SY-UNAME,
  S_UNAM  FOR TRDIR-UNAM,              " Last Changed by
  S_CDAT  FOR TRDIR-CDAT,              " Creation date
  S_UDAT  FOR TRDIR-UDAT.              " Last update date
SELECTION-SCREEN END OF BLOCK FRM_TRDIR.
*-- Options for uploading programs
PARAMETERS:
  RB_UP   RADIOBUTTON GROUP UDL.       " Upload reports
SELECTION-SCREEN BEGIN OF BLOCK FRM_UPLOAD WITH FRAME TITLE TEXT-UPL.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(29) TEXT-SNG.
PARAMETERS:
  RB_FILE RADIOBUTTON GROUP HOW DEFAULT 'X'.
SELECTION-SCREEN COMMENT 33(42) TEXT-FNA.
SELECTION-SCREEN END OF LINE.
PARAMETERS:
  RB_LIST RADIOBUTTON GROUP HOW.
SELECTION-SCREEN END OF BLOCK FRM_UPLOAD.
SELECTION-SCREEN END OF BLOCK FRM_OPTIONS.
*-- Options for up/downloading programs
SELECTION-SCREEN BEGIN OF BLOCK FRM_FILEN WITH FRAME TITLE TEXT-FIL.
PARAMETERS:
  RB_DOS  RADIOBUTTON GROUP FIL DEFAULT 'X', " Save to local
  RB_UNIX RADIOBUTTON GROUP FIL,       " Save to UNIX
  P_PATH  LIKE RLGRAP-FILENAME         " Path to save files to
        DEFAULT 'c:\temp\'.
SELECTION-SCREEN END OF BLOCK FRM_FILEN.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_NAME-LOW.
  CALL FUNCTION 'F4_PROGRAM'
       EXPORTING
            OBJECT             = S_NAME-LOW
            SUPPRESS_SELECTION = 'X'
       IMPORTING
            RESULT             = S_NAME-LOW
       EXCEPTIONS
            OTHERS             = 1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_NAME-HIGH.
  CALL FUNCTION 'F4_PROGRAM'
       EXPORTING
            OBJECT             = S_NAME-HIGH
            SUPPRESS_SELECTION = 'X'
       IMPORTING
            RESULT             = S_NAME-HIGH
       EXCEPTIONS
            OTHERS             = 1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_UNAM-LOW.
  PERFORM GET_NAME USING 'S_UNAM-LOW'
                CHANGING S_UNAM-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_UNAM-HIGH.
  PERFORM GET_NAME USING 'S_UNAM-HIGH'
                CHANGING S_UNAM-HIGH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNAM-LOW.
  PERFORM GET_NAME USING 'S_CNAM-LOW'
                CHANGING S_CNAM-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNAM-HIGH.
  PERFORM GET_NAME USING 'S_CNAM-HIGH'
                CHANGING S_CNAM-HIGH.
TOP-OF-PAGE.
  IF RB_LIST = 'X'.
    FORMAT COLOR COL_HEADING.
    NEW-LINE.
    WRITE: AT 3 TEXT-H01,
           AT 15 TEXT-H03.
    FORMAT COLOR OFF.
  ENDIF.
AT LINE-SELECTION.
  CHECK RB_LIST = 'X'.                 " only do in list mode
  READ LINE SY-CUROW FIELD VALUE MTAB_DIRECTORY-SAVENAME.
*-- Read file into an internal table
  PERFORM READ_REPORT_FROM_DISK TABLES MTAB_PROGRAM_FILE
            USING  MTAB_DIRECTORY-SAVENAME.
*-- Split table into TADIR entry, report lines, and report text
  PERFORM SPLIT_INCOMING_FILE TABLES MTAB_PROGRAM_FILE
                 MTAB_PROGRAM_SOURCE
                 MTAB_PROGRAM_TEXTS
                 MTAB_PROGRAM_DOCUMENTATION
        CHANGING TRDIR
                 MSTR_THEAD.
*-- Save all of the data
  PERFORM INSERT_NEW_REPORT TABLES MTAB_PROGRAM_SOURCE
               MTAB_PROGRAM_TEXTS
               MTAB_PROGRAM_DOCUMENTATION
        USING  TRDIR
               MSTR_THEAD.
Start of processing          *
START-OF-SELECTION.
  FORMAT COLOR COL_NORMAL.
  IF RB_DOWN = 'X'.
    PERFORM DOWNLOAD_REPORTS.
  ELSEIF RB_UP = 'X'.
    PERFORM UPLOAD_REPORTS.
  ENDIF.
END-OF-SELECTION.
  IF RB_DOWN = 'X'.
    CONCATENATE P_PATH
                'directory.txt'
      INTO P_PATH.
    PERFORM SAVE_TABLE_TO_FILE TABLES MTAB_DIRECTORY
           USING  P_PATH.
  ENDIF.
      FORM UPLOAD_REPORTS   *
FORM UPLOAD_REPORTS.
*-- Can upload a reports entered in selection criteria or
*-- select from a list.  List can be from index.txt in same directory
*-- (created by the download) or by reading the first line of each file
*-- in the directory.
  IF RB_FILE = 'X'. " Upload single program from a file
*-- Read file into an internal table
    PERFORM READ_REPORT_FROM_DISK TABLES MTAB_PROGRAM_FILE
              USING  P_PATH.
*-- Split table into TADIR entry, report lines, and report text
    PERFORM SPLIT_INCOMING_FILE TABLES MTAB_PROGRAM_FILE
                   MTAB_PROGRAM_SOURCE
                   MTAB_PROGRAM_TEXTS
                   MTAB_PROGRAM_DOCUMENTATION
          CHANGING TRDIR
                   MSTR_THEAD.
*-- Save all of the data
    PERFORM INSERT_NEW_REPORT TABLES MTAB_PROGRAM_SOURCE
                 MTAB_PROGRAM_TEXTS
                 MTAB_PROGRAM_DOCUMENTATION
          USING  TRDIR
                 MSTR_THEAD.
  ELSEIF RB_LIST = 'X'. " Show list for user to choose from
*-- get list of report names/descriptions from directory text
    CONCATENATE P_PATH
                'directory.txt'
    INTO P_PATH.
    PERFORM READ_REPORT_FROM_DISK TABLES MTAB_DIRECTORY
              USING  P_PATH.
    SORT MTAB_DIRECTORY.
*-- Write out list of report names/descriptions
    LOOP AT MTAB_DIRECTORY.
      WRITE:
        / MTAB_DIRECTORY-NAME UNDER TEXT-H01,
          MTAB_DIRECTORY-DESC UNDER TEXT-H03,
          MTAB_DIRECTORY-SAVENAME.
    ENDLOOP.
*-- Process user selections for reports to upload.
  ENDIF.
ENDFORM.           " upload_reports
      FORM DOWNLOAD_REPORTS *
      From the user selections, get all programs that meet the      *
      criteria, and save them in ftab_program_directory.            *
      Also save the report to disk.             *
FORM DOWNLOAD_REPORTS.
  DATA:
    LC_FULL_FILENAME LIKE RLGRAP-FILENAME.
*-- The table is put into an internal table because the program will
*-- abend if multiple transfers to a dataset occur within a SELECT/
*-- ENDSELCT (tested on 3.1H)
  SELECT * FROM  TRDIR
         INTO TABLE MTAB_PROGRAM_TRDIR
         WHERE  NAME  IN S_NAME
         AND    SUBC  IN S_SUBC
         AND    CNAM  IN S_CNAM
         AND    UNAM  IN S_UNAM
         AND    CDAT  IN S_CDAT
         AND    UDAT  IN S_UDAT.
  LOOP AT MTAB_PROGRAM_TRDIR.
*-- Clear out text and source code tables
    CLEAR:
      MTAB_PROGRAM_FILE,
      MTAB_PROGRAM_SOURCE,
      MTAB_PROGRAM_TEXTS,
      MTAB_PROGRAM_DOCUMENTATION.
    REFRESH:
      MTAB_PROGRAM_FILE,
      MTAB_PROGRAM_SOURCE,
      MTAB_PROGRAM_TEXTS,
      MTAB_PROGRAM_DOCUMENTATION.
*-- Get the report
    READ REPORT MTAB_PROGRAM_TRDIR-NAME INTO MTAB_PROGRAM_SOURCE.
*-- Get the text for the report
    READ TEXTPOOL MTAB_PROGRAM_TRDIR-NAME INTO MTAB_PROGRAM_TEXTS.
*-- Get the documentation for the report
    CLEAR DOKIL.
    SELECT * UP TO 1 ROWS FROM DOKIL
           WHERE  ID          = 'RE'
           AND    OBJECT      = MTAB_PROGRAM_TRDIR-NAME
           AND    LANGU       = SY-LANGU
           AND    TYP         = 'E'
           ORDER BY VERSION DESCENDING.
    ENDSELECT.
*-- Documentation exists for this object
    IF SY-SUBRC = 0.
      CALL FUNCTION 'DOCU_READ'
           EXPORTING
                ID      = DOKIL-ID
                LANGU   = DOKIL-LANGU
                OBJECT  = DOKIL-OBJECT
                TYP     = DOKIL-TYP
                VERSION = DOKIL-VERSION
           IMPORTING
                HEAD    = MSTR_THEAD
           TABLES
                LINE    = MTAB_PROGRAM_DOCUMENTATION
           EXCEPTIONS
                OTHERS  = 1.
    ENDIF.
*-- Put the report code and texts into a single file
*-- Put the identifier line in so that the start of the TRDIR line
*-- is marked
    CONCATENATE MC_TRDIR_IDENTIFIER
    MTAB_PROGRAM_TRDIR-NAME
    INTO MTAB_PROGRAM_FILE-LINE.
    APPEND MTAB_PROGRAM_FILE.
*-- Add the TRDIR line
    MTAB_PROGRAM_FILE-LINE = MTAB_PROGRAM_TRDIR.
    APPEND MTAB_PROGRAM_FILE.
*-- Put the identifier line in so that the start of the report code
*-- is marked
    CONCATENATE MC_REPORT_IDENTIFIER
                MTAB_PROGRAM_TRDIR-NAME
      INTO MTAB_PROGRAM_FILE-LINE.
    APPEND MTAB_PROGRAM_FILE.
*-- Add the report code
    LOOP AT MTAB_PROGRAM_SOURCE.
      MTAB_PROGRAM_FILE = MTAB_PROGRAM_SOURCE.
      APPEND MTAB_PROGRAM_FILE.
    ENDLOOP.
*-- Put the identifier line in so that the start of the report text
*-- is marked
    CONCATENATE MC_TEXT_IDENTIFIER
                MTAB_PROGRAM_TRDIR-NAME
      INTO MTAB_PROGRAM_FILE-LINE.
    APPEND MTAB_PROGRAM_FILE.
*-- Add the report texts
    LOOP AT MTAB_PROGRAM_TEXTS.
      MTAB_PROGRAM_FILE = MTAB_PROGRAM_TEXTS.
      APPEND MTAB_PROGRAM_FILE.
    ENDLOOP.
*-- Put the identifier line in so that the start of the THEAD record
*-- is marked
    CONCATENATE MC_THEAD_IDENTIFIER
                MTAB_PROGRAM_TRDIR-NAME
      INTO MTAB_PROGRAM_FILE-LINE.
    APPEND MTAB_PROGRAM_FILE.
    MTAB_PROGRAM_FILE = MSTR_THEAD.
    APPEND MTAB_PROGRAM_FILE.
*-- Put the identifier line in so that the start of the report
*-- documentation is marked
    CONCATENATE MC_DOC_IDENTIFIER
                MTAB_PROGRAM_TRDIR-NAME
      INTO MTAB_PROGRAM_FILE-LINE.
    APPEND MTAB_PROGRAM_FILE.
*-- Add the report documentation
    LOOP AT MTAB_PROGRAM_DOCUMENTATION.
      MTAB_PROGRAM_FILE = MTAB_PROGRAM_DOCUMENTATION.
      APPEND MTAB_PROGRAM_FILE.
    ENDLOOP.
*-- Make the fully pathed filename that report will be saved to
    CONCATENATE P_PATH
                MTAB_PROGRAM_TRDIR-NAME
                '.txt'
      INTO LC_FULL_FILENAME.
    PERFORM SAVE_TABLE_TO_FILE TABLES MTAB_PROGRAM_FILE
           USING  LC_FULL_FILENAME.
*-- Write out message with Program Name/Description
    READ TABLE MTAB_PROGRAM_TEXTS WITH KEY ID = 'R'.
    IF SY-SUBRC = 0.
      MTAB_DIRECTORY-NAME = MTAB_PROGRAM_TRDIR-NAME.
      MTAB_DIRECTORY-DESC = MTAB_PROGRAM_TEXTS-ENTRY.
      MTAB_DIRECTORY-SAVENAME = LC_FULL_FILENAME.
      APPEND MTAB_DIRECTORY.
      WRITE: / MTAB_PROGRAM_TRDIR-NAME,
               MTAB_PROGRAM_TEXTS-ENTRY(65) COLOR COL_HEADING.
    ELSE.
      MTAB_DIRECTORY-NAME = MTAB_PROGRAM_TRDIR-NAME.
      MTAB_DIRECTORY-DESC = 'No description available'.
      MTAB_DIRECTORY-SAVENAME = LC_FULL_FILENAME.
      APPEND MTAB_DIRECTORY.
      WRITE: / MTAB_PROGRAM_TRDIR-NAME.
    ENDIF.
  ENDLOOP.
ENDFORM.           " BUILD_PROGRAM_DIRECTORY
      FORM SAVE_TABLE_TO_FILE                   *
-->  FTAB_TABLE            *
-->  F_FILENAME            *
FORM SAVE_TABLE_TO_FILE TABLES FTAB_TABLE
    USING  F_FILENAME.
  IF RB_DOS = 'X'.                  " Save file to presentation server
    CALL FUNCTION 'WS_DOWNLOAD'
         EXPORTING
              FILENAME = F_FILENAME
              FILETYPE = 'ASC'
         TABLES
              DATA_TAB = FTAB_TABLE
         EXCEPTIONS
              OTHERS   = 4.
    IF SY-SUBRC NE 0.
      WRITE: / 'Error opening dataset' COLOR COL_NEGATIVE,
               F_FILENAME COLOR COL_NEGATIVE.
    ENDIF.
  ELSE.            " Save file to application server
    OPEN DATASET F_FILENAME FOR OUTPUT IN TEXT MODE.
    IF SY-SUBRC = 0.
      LOOP AT FTAB_TABLE.
        TRANSFER FTAB_TABLE TO F_FILENAME.
        IF SY-SUBRC NE 0.
          WRITE: / 'Error writing record to file;' COLOR COL_NEGATIVE,
                   F_FILENAME COLOR COL_NEGATIVE.
        ENDIF.
      ENDLOOP.
    ELSE.
      WRITE: / 'Error opening dataset' COLOR COL_NEGATIVE,
               F_FILENAME COLOR COL_NEGATIVE.
    ENDIF.
  ENDIF.           " End RB_DOS
ENDFORM.           " SAVE_PROGRAM
      FORM READ_REPORT_FROM_DISK                *
      Read report into internal table.  Can read from local or      *
      remote computer       *
FORM READ_REPORT_FROM_DISK TABLES FTAB_TABLE
       USING  F_FILENAME.
  DATA:
     LC_MESSAGE(128) TYPE C.
  CLEAR   FTAB_TABLE.
  REFRESH FTAB_TABLE.
  IF RB_DOS = 'X'.
    TRANSLATE F_FILENAME USING '/\'.   " correct slash for Dos PC file
    CALL FUNCTION 'WS_UPLOAD'
         EXPORTING
              FILENAME            = F_FILENAME
              FILETYPE            = 'ASC'
         TABLES
              DATA_TAB            = FTAB_TABLE
         EXCEPTIONS
              CONVERSION_ERROR    = 1
              FILE_OPEN_ERROR     = 2
              FILE_READ_ERROR     = 3
              INVALID_TABLE_WIDTH = 4
              INVALID_TYPE        = 5
              NO_BATCH            = 6
              UNKNOWN_ERROR       = 7
              OTHERS              = 8.
    IF SY-SUBRC >< 0.
      WRITE: / 'Error reading file from local PC' COLOR COL_NEGATIVE.
    ENDIF.
  ELSEIF RB_UNIX = 'X'.
    TRANSLATE F_FILENAME USING '\/'.   " correct slash for unix
    OPEN DATASET F_FILENAME FOR INPUT MESSAGE LC_MESSAGE IN TEXT MODE.
    IF SY-SUBRC = 0.
      DO.
        READ DATASET F_FILENAME INTO FTAB_TABLE.
        IF SY-SUBRC = 0.
          APPEND FTAB_TABLE.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      CLOSE DATASET F_FILENAME.
    ELSE.
      WRITE: / 'Error reading file from remote computer'
  COLOR COL_NEGATIVE,
             / LC_MESSAGE,
             / F_FILENAME.
      SY-SUBRC = 4.
    ENDIF.
  ENDIF.
ENDFORM.           " READ_REPORT_FROM_DISK
      FORM SPLIT_INCOMING_FILE                  *
-->  FTAB_PROGRAM_FILE     *
-->  FTAB_PROGRAM_SOURCE   *
-->  ` *
-->  FTAB_PROGRAM_TEXTS    *
FORM SPLIT_INCOMING_FILE TABLES FTAB_PROGRAM_FILE
                 STRUCTURE MTAB_PROGRAM_FILE
            FTAB_PROGRAM_SOURCE
                 STRUCTURE MTAB_PROGRAM_SOURCE
            FTAB_PROGRAM_TEXTS
                 STRUCTURE MTAB_PROGRAM_TEXTS
            FTAB_PROGRAM_DOCUMENTATION
                STRUCTURE MTAB_PROGRAM_DOCUMENTATION
   CHANGING FSTR_TRDIR
            FSTR_THEAD.
  DATA:
    LC_DATATYPE(4) TYPE C,             " Type of data, REPO, TEXP, RDIR
    LC_PROGRAM_FILE LIKE MTAB_PROGRAM_FILE.
  LOOP AT FTAB_PROGRAM_FILE.
    LC_PROGRAM_FILE = FTAB_PROGRAM_FILE.
    CASE LC_PROGRAM_FILE(9).
      WHEN MC_TRDIR_IDENTIFIER.
        LC_DATATYPE = MC_TRDIR_SHORT.
      WHEN MC_REPORT_IDENTIFIER.
        LC_DATATYPE = MC_REPORT_SHORT.
      WHEN MC_TEXT_IDENTIFIER.
        LC_DATATYPE = MC_TEXT_SHORT.
      WHEN MC_DOC_IDENTIFIER.
        LC_DATATYPE = MC_DOC_SHORT.
      WHEN MC_THEAD_IDENTIFIER.
        LC_DATATYPE = MC_THEAD_SHORT.
      WHEN OTHERS. " Actual contents of report, trdir, or text
        CASE LC_DATATYPE.
          WHEN MC_TRDIR_SHORT.
            FSTR_TRDIR = FTAB_PROGRAM_FILE.
          WHEN MC_REPORT_SHORT.
            FTAB_PROGRAM_SOURCE = FTAB_PROGRAM_FILE.
            APPEND FTAB_PROGRAM_SOURCE.
          WHEN MC_TEXT_SHORT.
            FTAB_PROGRAM_TEXTS = FTAB_PROGRAM_FILE.
            APPEND FTAB_PROGRAM_TEXTS.
          WHEN MC_THEAD_SHORT.
            FSTR_THEAD = FTAB_PROGRAM_FILE.
          WHEN MC_DOC_SHORT.
            FTAB_PROGRAM_DOCUMENTATION = FTAB_PROGRAM_FILE.
            APPEND FTAB_PROGRAM_DOCUMENTATION.
        ENDCASE.
    ENDCASE.
  ENDLOOP.
ENDFORM.           " SPLIT_INCOMING_FILE
      FORM INSERT_NEW_REPORT*
-->  FTAB_PROGRAM_SOURCE   *
-->  FTAB_PROGRAM_TEXTS    *
-->  F_TRDIR               *
FORM INSERT_NEW_REPORT TABLES FTAB_PROGRAM_SOURCE
              STRUCTURE MTAB_PROGRAM_SOURCE
          FTAB_PROGRAM_TEXTS
               STRUCTURE MTAB_PROGRAM_TEXTS
          FTAB_PROGRAM_DOCUMENTATION
               STRUCTURE MTAB_PROGRAM_DOCUMENTATION
   USING  FSTR_TRDIR LIKE TRDIR
          FSTR_THEAD LIKE MSTR_THEAD.
  DATA:
    LC_OBJ_NAME LIKE E071-OBJ_NAME,
    LC_LINE2(40)     TYPE C,
    LC_ANSWER(1)     TYPE C.
*-- read trdir to see if the report already exists, if it does, prompt
*-- user to overwrite or abort.
  SELECT SINGLE * FROM TRDIR WHERE NAME = FSTR_TRDIR-NAME.
  IF SY-SUBRC = 0. " Already exists
    CONCATENATE 'want to overwrite report'
                FSTR_TRDIR-NAME
      INTO LC_LINE2 SEPARATED BY SPACE.
    CONCATENATE LC_LINE2
      INTO LC_LINE2.
    CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
         EXPORTING
              DEFAULTOPTION  = 'N'
              TEXTLINE1   = 'The selected report already exists, do you'
              TEXTLINE2      = LC_LINE2
              TITEL          = 'Report already exists'
              CANCEL_DISPLAY = SPACE
         IMPORTING
              ANSWER         = LC_ANSWER
         EXCEPTIONS
              OTHERS         = 1.
  ELSE.
    LC_ANSWER = 'J'.
  ENDIF.
  IF LC_ANSWER = 'J'.
*-- Create the TADIR entry.  (TRDIR entry created by INSERT REPORT)
    LC_OBJ_NAME = TRDIR-NAME.
    CALL FUNCTION 'TR_TADIR_POPUP_ENTRY_E071'
         EXPORTING
              WI_E071_PGMID     = 'R3TR'
              WI_E071_OBJECT    = 'PROG'
              WI_E071_OBJ_NAME  = LC_OBJ_NAME
              WI_TADIR_DEVCLASS = '$TMP'
         EXCEPTIONS
              EXIT              = 3
              OTHERS            = 4.
    IF SY-SUBRC = 0.
*-- Create Report
      INSERT REPORT FSTR_TRDIR-NAME FROM FTAB_PROGRAM_SOURCE.
*-- Create Texts
      INSERT TEXTPOOL FSTR_TRDIR-NAME FROM FTAB_PROGRAM_TEXTS
             LANGUAGE SY-LANGU.
*-- Save Documentation
      CALL FUNCTION 'DOCU_UPDATE'
           EXPORTING
                HEAD    = FSTR_THEAD
                STATE   = 'A'
                TYP     = 'E'
                VERSION = '1'
           TABLES
                LINE    = FTAB_PROGRAM_DOCUMENTATION
           EXCEPTIONS
                OTHERS  = 1.
    ELSE.
      WRITE: / 'Error updating the TADIR entry' COLOR COL_NEGATIVE,
               'Program' COLOR COL_NEGATIVE INTENSIFIED OFF,
               FSTR_TRDIR-NAME, 'was not loaded into SAP.'
                  COLOR COL_NEGATIVE INTENSIFIED OFF.
    ENDIF.
  ELSE.
    WRITE: / FSTR_TRDIR-NAME COLOR COL_NEGATIVE,
             'was not uploaded into SAP.  Action cancelled by user'
                 COLOR COL_NEGATIVE INTENSIFIED OFF.
  ENDIF.
ENDFORM.           " INSERT_NEW_REPORT
      FORM GET_NAME         *
-->  VALUE(F_FIELD)        *
-->  F_NAME                *
FORM GET_NAME USING VALUE(F_FIELD)
           CHANGING F_NAME.
  DATA: LTAB_FIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE,
        LC_PROG LIKE D020S-PROG,
        LC_DNUM LIKE D020S-DNUM.
  TRANSLATE F_FIELD TO UPPER CASE.
  refresh ltab_fields.
  LTAB_FIELDS-FIELDNAME = F_FIELD.
  append ltab_fields.
  LC_PROG =  SY-REPID .
  LC_DNUM =  SY-DYNNR .
  CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
            DYNAME     = LC_PROG
            DYNUMB     = LC_DNUM
       TABLES
            dynpfields = ltab_fields
       EXCEPTIONS
            OTHERS     = 01.
  read table ltab_fields index 1.
  IF SY-SUBRC EQ 0.
    F_NAME = LTAB_FIELDS-FIELDVALUE.
    refresh ltab_fields.
  ENDIF.
  CALL FUNCTION 'F4_USER'
       EXPORTING
            OBJECT = F_NAME
       IMPORTING
            RESULT = F_NAME.
ENDFORM.           " GET_NAME
Regards,
Sree

Similar Messages

  • How to set database location in the crystal report X1 from the Source code.

    Dear All,
    I am using Crystal report X1 for report generation.Now I am setting the database location manually in the crystal report. How can I Set the database location from the Source code.
    Awaiting for your reply.
    Thanks in advance.
    Regards,
    Rahaneef T

    Here's a routine that also searches for subreports to set the log on info. Simply remove that aprt to set the main report logon info:
    IDatabaseTablePtr pTable;
    //get first table
    pTable = m_Report->Database->Tables->GetItem(1) ;
    long lTableCount = m_Report->Database->Tables->Count;
    for( long lTable=1; lTable<=lTableCount; lTable++ )
         pTable = m_Report->Database->Tables->GetItem(lTable);
         pTable->ConnectionProperties->DeleteAll();
         pTable->ConnectionProperties->Add("DSN", "Name of your DSN");
         pTable->ConnectionProperties->Add("Database", "Demo");
         pTable->ConnectionProperties->Add("Password", "sa");
         pTable->ConnectionProperties->Add("User ID", "1Oem2000");
    // Log on the tables of the subreports.
    long lSectionCount = m_Report->Sections->Count;
    for( long lSection=1; lSection<=lSectionCount; lSection++ )
         ISectionPtr pSection = m_Report->Sections->Item[lSection];
         long lSubreportCount = pSection->ReportObjects->Count;
         for( long lSubreport=1; lSubreport<=lSubreportCount; lSubreport++ )
              IReportObjectPtr pSubreportObject = pSection->ReportObjects->Item[lSubreport];
              CRObjectKind crObjectKind;
              pSubreportObject->get_Kind(&crObjectKind);
              if( crObjectKind == crSubreportObject )
                   ISubreportObjectPtr SubReportPtr = pSubreportObject;
                   IReportPtr pSubReport = SubReportPtr->OpenSubreport();
                   long lTableCount = pSubReport->Database->Tables->Count;
                   for( long lTable=1; lTable<=lTableCount; lTable++ )
                        pTable = m_Report->Database->Tables->GetItem(lTable);
                        pTable->ConnectionProperties->DeleteAll();
                        //pTable->ConnectionProperties->Add("DSN", "dwcb12003");
                        pTable->ConnectionProperties->Add("Database", "CrystalEport_DB");
                        pTable->ConnectionProperties->Add("Password", "sa");
                        pTable->ConnectionProperties->Add("User ID", "1Oem2000");
    If that doesn't work you need to tell us what is the error you are getting and paste in the code you are using.

  • Where can I download the source code of MaxDB (even an older version)?

    Just want to learn some modules of MaxDB. But now I failed to find where to download it.
    Is there any old archive for the older version of MaxDB source code for download?
    Thanks in advance.

    At times when the sources were available I tried to build it on a "new" platform (Solaris x86 32bit) and I can tell you: it's NOTHING that is obvious. Building OpenOffice or Mozilla may appear like an easy task. It took me months to get there and to be able to just build the 'build tools'.
    On top, many of the sources are (historically) written in a Pascal dialect and are transferred to C with an own precompiler so there are three languages used (C, C++ and Pascal)  - so it's a pretty hard (next to impossible) job to learn some algorithms from those sources.
    See also here:
    http://cjcollier.livejournal.com/177628.html
    http://home.snafu.de/~dittmar/sapdbdev/
    and just to get an idea of the modules and their structure:
    http://home.snafu.de/~dittmar/sapdbdev/sapdbModules.txt
    Markus

  • Can I download the source codes of JVM?

    Thanks!

    Note that the above is for everything in the Sun jdk (make files, C code, etc.)
    If you just want to look at the java code for the Java API, then you already have that in your jdk directory. Just look for "src.zip"

  • Needed: A bit more info on the source code structure

    Hi,
    I've downloaded the source code zip file and would like to link to BlazeDS's source code from a Flex Builder project, so that I can step through it in the debugger.
    As far as I can see the source code is split up in multiple sub-directories under the modules directory. It would be nice if there was a single folder that included all BlazeDS source, so that I wouldn't have to link to multiple folders in my project.
    Or, at least, some explanation in a read-me file explaining what I need to link to.
    Am I missing something? If so, where?
    Also, an explanation of the difference between 'java' and 'java15' folders would be helpful.
    Thanks,
    Douglas

    > Could you explain to me why flex.messaging.MessageBroker only exists in
    > /core/src/java/ and not in /core/src/java15/?
    Hi Douglas,
    The classes are merged together in to a single jar file. The java15 code is
    mainly code that needs to be compiled with the compiler in 1.5 mode. This
    is left over from before we released BlazeDS and supported Java 1.4. We
    expect to 'fix' all this moving forward and require Java 5 SDK and JVM as a
    minimum. We just haven't done that yet.
    In an IDE you can just ignore this and set the JVM level to be 1.5 and
    include both the java and java15 directories as source. The Eclipse
    projects (and IntelliJ IDEA projects) we provide should already take care of
    this for you. It shouldn't be too hard to do in any other Java IDE either.
    Tom Jordahl
    Adobe

  • Downloading iView Source Code

    Hello,
    I'm trying to download the source code for the Record Working Time iView.  None of the ESS-related tracks in NWDI have the code I'm looking for.  I've created a new track and put the EA-HR Software Component in it, but when I imported the configuration for the remote DC, there was no code in it to turn into an NWDS project.
    I went to the SAP Marketplace and downloaded the installation package, thinking the code would be in there, but there were no .sca files in there when I unpacked it - just a .pat file with no .att file. 
    My questions are:
         - Would the source code be in the maintenace packages?  If not, where would I find it?
         - I have the EA-HR maintenance packages (EA-HR 605: 0001-0015) in my Approval List awaiting download regardless of whether or not the code I need would be in one of them, who approves this?  Would it be someone in my company, or do we need to contact SAP for approval?
    Thank you very much,
    Jamie

    Hi Marcin,
    In addition to specialized iView Editors that are available for certain iView types (for example, URL iView Editor and XML iView Editor), you edit other iView properties in the Property Editor.
    You must be granted the appropriate permission to edit the iView.
    In the Property Editor, you can:
    ·Customize property values
    ·Modify metadata attributes of each property
    check the below link for any issues.
    http://help.sap.com/saphelp_nw04/helpdata/en/13/81a66d100011d7b84b00047582c9f7/content.htm
    Regards,
    Ponneswari.

  • How to display the source code for this friggin' file.

    Below is a rather lengthy bit of code that provides the behavior and attributes of a web server for OpenCyc. I need to know if I can enter some java to have the HTML source code displayed in a separate text file whenever this class returns some resulting webpage. If you have any ideas it will be greatly appreciated.
    -"Will code for foo."
    package org.opencyc.webserver;
    * Class WebServer is simple multithreaded HTTP server
    * with CGI limited to a Cyc connection on default port 3600.
    * <p>
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import java.util.jar.*;
    import java.text.*;
    import org.opencyc.util.*;
    public class WebServer extends Thread {
         * Singleton WebServer instance.
        public static WebServer current;
         * Default HTTP port.
        protected static int DEFAULT_PORT = 80;
         * Default Cyc base port.
        protected static int DEFAULT_CYC_PORT = 3600;
         * Default directory to serve files from on non-Windows OS.
        protected static String DEFAULT_DIR = "/";
         * Default directory to serve files from on Windows.
        //protected static String DEFAULT_WIN_DIR = "C:\\";
        protected static String DEFAULT_WIN_DIR = "k:\\opencyc\\run\\httpd\\htdocs";
         * File cache capacity.
        protected static final int CACHE_CAPACITY = 100;
         * File cache to improve file serving performance.
        protected static Hashtable fileCache = new Hashtable(CACHE_CAPACITY);
         * Number of files served from this web server.
        protected static long nbrFilesServed = 0;
         * Number of files served from this web server that were found in the cache.
        protected static long nbrCacheHits = 0;
         * Server socket for accepting connections.
        protected ServerSocket server;
         * Directories to serve files from.
        protected ArrayList dirs;
         * Map from String (jar root) to JarFile[] (jar class path).
        protected HashMap map;
         * Webserver HTTP port.
        protected int port;
         * Cyc HTML host.
        protected String cycHost = "localhost";
         * Cyc HTML port.
        protected int cycPort;
         * Expand jar tress.
        protected boolean trees;
         * Requests flag.
        protected boolean traceRequests;
         * Constructs a WebServer object.
         * @param port the port to use
         * @param directories the directory to serve files from
         * @param trees true if files within jar files should be served up
         * @param traceRequests true if client's request text should be logged.
         * @exception IOException if the listening socket cannot be opened, or problem opening jar files.
        public WebServer() throws IOException {
            getProperties();
            server = new ServerSocket(port);
            processDirectories();
         * Class Task processes a single HTTP request.
        protected class Task extends Thread {
             * Socket for the incoming request.
            protected Socket sock;
             * Client socket to the Cyc KB HTML server.
            protected Socket cycHtmlSocket;
             * Output tcp stream.
            protected DataOutputStream out;
             * Contains the file request path for a not-found error message.
            protected String notFoundPath;
             * Contains the first line of a request message.
            protected String methodLine;
             * Contains the body of a POST method.
            protected String bodyLine;
             * Constructs a Task object.
             * @param sock the socket assigned for this request.
            public Task(Socket sock) {
                this.sock = sock;
             * Processes the HTTP request.
            public void run() {
                if (traceRequests)
                    Log.current.println("connection accepted from " + sock.getInetAddress());
                notFoundPath = "";
                try {
                    out = new DataOutputStream(sock.getOutputStream());
                    try {
                        getBytes();
                    catch (Exception e) {
                        Log.current.println("file not found: " + notFoundPath);
                        try {
                            out.writeBytes("HTTP/1.1 404 Not Found\r\n");
                            out.writeBytes("Server: Cyc WebServer\r\n");
                            out.writeBytes("Connection: close\r\n");
                            out.writeBytes("Content-Type: text/html\r\n\r\n");
                            out.writeBytes("<HTML><HEAD>\n");
                            out.writeBytes("<TITLE>404 Not Found</TITLE>\n");
                            out.writeBytes("</HEAD><BODY>\n");
                            out.writeBytes("<H1>404 - Not Found</H1>\n");
                            out.writeBytes("</BODY></HTML>");
                            out.flush();
                        catch (SocketException se) {
                catch (Exception e) {
                    Log.current.printStackTrace(e);
                finally {
                    try {
                        sock.close();
                    catch (IOException e) {
             * Reads the HTTP request and obtains the response.
             * @exception IOException when HTTP request has an invalid format.
            private void getBytes() throws IOException {
                // Below logic is complex because web browsers do not close the
                // socket after sending the request, so must parse message to find
                // the end.
                BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream()));
                ArrayList inBytes = new ArrayList(200);
                int ch = 0;
                boolean postMethod;
                methodLine = in.readLine();
                //if (traceRequests)
                //    Log.current.println("methodLine=" + methodLine);
                bodyLine = "";
                if (methodLine.startsWith("POST /"))
                    postMethod = true;
                else
                    postMethod = false;
                //if (traceRequests)
                //    Log.current.println("postMethod=" + postMethod);
                int ch1 = -1;
                int ch2 = -1;
                int ch3 = -1;
                int ch4 = -1;
                // Read the HTTP request headers.
                while (true) {
                    ch = in.read();
                    inBytes.add(new Integer(ch));
                    ch1 = ch2;
                    ch2 = ch3;
                    ch3 = ch4;
                    ch4 = ch;
                    if (ch1 == '\r' && ch2 == '\n' && ch3 == '\r' && ch4 == '\n')
                        break;
                    if ((! postMethod) &&
                        (! in.ready()) &&
                        ch1 == -1 &&
                        ch2 == -1 &&
                        ch3 == '\r' &&
                        ch4 == '\n') {
                        inBytes.add(new Integer('\r'));
                        inBytes.add(new Integer('\n'));
                        break;
                byte[] byteArray = new byte[inBytes.size()];
                for (int i = 0; i < inBytes.size(); i++) {
                    Integer ich = (Integer) inBytes.get(i);
                    byteArray[i] = ich.byteValue();
                String headers = new String(byteArray);
                if (postMethod) {
                    String lcHeaders = headers.toLowerCase();
                    int i = lcHeaders.indexOf("content-length: ");
                    String contentLength = lcHeaders.substring(i + 16);
                    int j = contentLength.indexOf("\r\n");
                    contentLength = contentLength.substring(0, j);
                    int bodyLen = (new Integer(contentLength)).intValue();
                    for (int k = 0; k < bodyLen; k++) {
                        bodyLine = bodyLine + (new Character((char) in.read())).toString();
                String line = methodLine + "\r\n" + headers + bodyLine;
                if (traceRequests)
                    Log.current.println(line);
                if (postMethod)
                    processHttpPost();
                else
                    if (line.startsWith("GET /"))
                        processHttpGet(line.substring(4));
                    else {
                        Log.current.println("Invalid request = " + line);
                        throw new IOException();
             * Processes an HTTP GET method.
             * @param httpGetPath the path of the file to get.
             * @exception IOException if the file is not found.
            private void processHttpGet(String httpGetPath) throws IOException {
                int i = httpGetPath.indexOf(' ');
                if (i > 0)
                    httpGetPath = httpGetPath.substring(0, i);
                Log.current.println(methodLine + " from " + sock.getInetAddress().getHostName());
                i = httpGetPath.indexOf("cg?");
                if (i > 0) {
                    cycHtmlRequest(httpGetPath.substring(i + 3));
                    return;
                notFoundPath = httpGetPath;
                i = httpGetPath.indexOf('/');
                if (i < 0 || map == null) {
                    if (map == null || httpGetPath.endsWith(".jar")) {
                        for (int j = 0; j < dirs.size(); j++) {
                            String dir = (String) dirs.get(j);
                            String nativePath = dir + httpGetPath;
                            nativePath = nativePath.replace('/', File.separatorChar);
                            if (fileCache.containsKey(nativePath)) {
                                writeDataBytes((byte[]) fileCache.get(nativePath));
                                Log.current.println("...cached");
                                nbrCacheHits++;
                                nbrFilesServed++;
                                return;
                            try {
                                File f = new File(nativePath);
                                byte[] fileBytes = getBytes(new FileInputStream(f), f.length());
                                writeDataBytes(fileBytes);
                                if (fileCache.size() >= CACHE_CAPACITY)
                                    fileCache.clear();
                                fileCache.put(nativePath, fileBytes);
                                Log.current.println("...from " + nativePath);
                                nbrFilesServed++;
                                return;
                            catch (IOException e) {
                    throw new IOException();
                String jar = httpGetPath.substring(0, i);
                httpGetPath = httpGetPath.substring(i + 1);
                JarFile[] jfs = (JarFile[]) map.get(jar);
                if (jfs == null)
                    throw new IOException();
                for (i = 0; i < jfs.length; i++) {
                    JarEntry je = jfs.getJarEntry(httpGetPath);
    if (je == null)
    continue;
    writeDataBytes(getBytes(jfs[i].getInputStream(je), je.getSize()));
    nbrFilesServed++;
    return;
    throw new IOException();
    * Processes an HTTP POST method.
    * @exception IOException if the file is not found.
    private void processHttpPost() throws IOException {
    Log.current.println("POST " + bodyLine + " from " + sock.getInetAddress().getHostName());
    cycHtmlRequest(bodyLine);
    * Reads the specified number of bytes and always close the stream.
    * @param in the file to be read for subsequent downloading.
    * @param length the number of bytes to read from the file.
    * @return An array of bytes from the file.
    * @exception IOException if an error occurs when processing the file.
    private byte[] getBytes(InputStream in, long length) throws IOException {
    DataInputStream din = new DataInputStream(in);
    byte[] bytes = new byte[ (int) length];
    try {
    din.readFully(bytes);
    finally {
    din.close();
    return bytes;
    * Sends the HTML request to Cyc.
    * @param cycPath the portion of the URL which is given to the Cyc HTML server.
    private void cycHtmlRequest(String cycPath) {
    String request = sock.getInetAddress().getHostName() + "&" + cycPath + "#";
    System.out.println("request=" + request);
    ArrayList bytes = new ArrayList(10000);
    try {
    cycHtmlSocket = new Socket(cycHost, cycPort);
    System.out.println("cycHost=" + cycHost + " cycPort=" + cycPort);
    BufferedReader cycIn = new BufferedReader(new InputStreamReader(cycHtmlSocket.getInputStream()));
    PrintWriter cycOut = new PrintWriter(cycHtmlSocket.getOutputStream(), true);
    cycOut.println(request);
    cycOut.flush();
    int ch = 0;
    while (ch >= 0) {
    ch = cycIn.read();
    bytes.add(new Integer(ch));
    catch (Exception e) {
    Log.current.printStackTrace(e);
    byte[] byteArray = new byte[bytes.size()];
    for (int i = 0; i < bytes.size() - 1; i++) {
    Integer ich = (Integer) bytes.get(i);
    byteArray[i] = ich.byteValue();
    try {
    writeTextBytes(byteArray);
    catch (Exception e) {
    Log.current.println(e.getMessage());
    * Responds to the HTTP client with data content from the requested URL.
    * @param bytes the array of bytes from the URL.
    * @exception IOException if there is an error writing to the HTTP client.
    public void writeDataBytes(byte[] bytes) throws IOException {
    out.writeBytes("HTTP/1.1 200 OK\r\n");
    out.writeBytes("Server: Cyc WebServer\r\n");
    out.writeBytes("Connection: close\r\n");
    out.writeBytes("Content-Length: " + bytes.length + "\r\n");
    String prefix = (new String(bytes)).toLowerCase();
    if (prefix.indexOf("<html>") > -1)
    out.writeBytes("Content-Type: text/html\r\n\r\n");
    else
    out.writeBytes("Content-Type: application/java\r\n\r\n");
    out.write(bytes);
    out.flush();
    * Respond to the HTTP client with text content from the requested URL.
    * @param bytes the array of bytes from the URL.
    * @exception IOException if there is an error writing to the HTTP client.
    public void writeTextBytes(byte[] bytes) throws IOException {
    out.writeBytes("HTTP/1.1 200 OK\r\n");
    out.writeBytes("Server: Cyc WebServer\r\n");
    out.writeBytes("Connection: close\r\n");
    out.writeBytes("Content-Length: " + bytes.length + "\r\n");
    out.writeBytes("Content-Type: text/html\r\n\r\n");
    out.write(bytes);
    out.flush();
    * Gets properties governing the web server's behavior.
    private void getProperties() {
    port = DEFAULT_PORT;
    String portProperty = System.getProperty("org.opencyc.webserver.port", "");
    if (! portProperty.equalsIgnoreCase(""))
    port = (new Integer(portProperty)).intValue();
    Log.current.println("Listening on port " + port);
    cycPort = DEFAULT_CYC_PORT;
    String cycPortProperty = System.getProperty("org.opencyc.webserver.cycPort", "");
    if (! cycPortProperty.equalsIgnoreCase(""))
    cycPort = (new Integer(cycPortProperty)).intValue();
    Log.current.println("Cyc connections directed to port " + cycPort);
    String dirsProperty = System.getProperty("org.opencyc.webserver.dirs", "");
    dirs = new ArrayList(3);
    StringTokenizer st = new StringTokenizer(dirsProperty, ";", false);
    while (st.hasMoreTokens()) {
    String dir = st.nextToken();
    dirs.add(dir);
    trees = false;
    String treesProperty = System.getProperty("org.opencyc.webserver.trees", "");
    if (! treesProperty.equalsIgnoreCase(""))
    trees = true;
    traceRequests = false;
    String traceRequestsProperty = System.getProperty("org.opencyc.webserver.traceRequests", "");
    if (! traceRequestsProperty.equalsIgnoreCase("")) {
    traceRequests = true;
    Log.current.println("tracing requests");
    * Adds transitive Class-Path jars to jfs.
    * @param jar the jar file
    * @param jfs the list of jar files to serve.
    * @param dir the jar file directory.
    * @exception IOException if an I/O error has occurred with the jar file.
    private void addJar(String jar, ArrayList jfs, String dir) throws IOException {
    Log.current.println("Serving jar files from: " + dir + jar);
    JarFile jf = new JarFile(dir + jar);
    jfs.add(jf);
    Manifest man = jf.getManifest();
    if (man == null)
    return;
    Attributes attrs = man.getMainAttributes();
    if (attrs == null)
    return;
    String val = attrs.getValue(Attributes.Name.CLASS_PATH);
    if (val == null)
    return;
    dir = dir + jar.substring(0, jar.lastIndexOf(File.separatorChar) + 1);
    StringTokenizer st = new StringTokenizer(val);
    while (st.hasMoreTokens()) {
    addJar(st.nextToken().replace('/', File.separatorChar), jfs, dir);
    * Administrative accessor method that obtains list of directories from which files are served.
    public ArrayList getDirs() {
    return dirs;
    * Administrative method that updates the list of directories from which files are served.
    public synchronized void setDirs(ArrayList dirs) throws IOException {
    this.dirs = dirs;
    fileCache.clear();
    processDirectories();
    * Administrative accessor method that obtains number of files served.
    * @return The number of files served.
    public long getNbrFilesServed() {
    return nbrFilesServed;
    * Administrative accessor method that obtains number of files served from cache.
    * @return The number of files served from the cache.
    public long getNbrCacheHits() {
    return nbrCacheHits;
    * Administrative method that clears the file cache.
    public synchronized void clearFileCache() {
    Log.current.println("Clearing file cache");
    fileCache.clear();
    nbrFilesServed = 0;
    nbrCacheHits = 0;
    * Processes the directories from which files are served, expanding jar trees if
    * directed.
    * @exception IOException if problem occurs while processing the jar files.
    private void processDirectories() throws IOException {
    if (dirs.size() == 0)
    if (File.separatorChar == '\\')
    dirs.add(DEFAULT_WIN_DIR);
    else
    dirs.add(DEFAULT_DIR);
    Iterator directories = dirs.iterator();
    while (directories.hasNext())
    Log.current.println("Serving from " + directories.next());
    if (trees) {
    map = new HashMap();
    for (int j = 0; j < dirs.size(); j++) {
    String dir = (String) dirs.get(j);
    String[] files = new File(dir).list();
    for (int i = 0; i < files.length; i++) {
    String jar = files[i];
    if (!jar.endsWith(".jar"))
    continue;
    ArrayList jfs = new ArrayList(1);
    addJar(jar, jfs, dir);
    map.put(jar.substring(0, jar.length() - 4), jfs.toArray(new JarFile[jfs.size()]));
    * Provides the command line interface for creating an HTTP server.
    * The properties are:
    * <pre>
    * org.opencyc.webserver.port=<HTTP listening port>
    * </pre>
    * which defaults to 80.
    * <pre>
    * org.opencyc.webserver.cycPort=<Cyc connection port>
    * </pre>
    * which defaults to 3600.
    * <pre>
    * org.opencyc.webserver.dirs=<path>;<path> ... ;<path>
    * </pre>
    * with the argument enclosed in quotes if any path contains an
    * embedded space.
    * The default directory on Windows is C:
    * and the default on other systems is / the default
    * can be overridden with this property. By default, all files
    * under this directory (including all subdirectories) are served
    * up via HTTP. If the pathname of a file is <var>path</var> relative
    * to the top-level directory, then the file can be downloaded using
    * the URL
    * <pre>
    * http://<var>host</var>:<var>port</var>/<var>path</var>
    * </pre>
    * Caching of file contents is performed.
    * <pre>
    * org.opencyc.util.log=all
    * </pre>
    * If the all value is given, then all attempts to download files
    * are output.
    * <pre>
    * org.opencyc.webserver.traceRequests
    * </pre>
    * If this property has any value, then the client HTTP requests are
    * output.<p>
    * <pre>
    * org.opencyc.webserver.trees
    * </pre>
    * This property can be used to serve up individual files stored
    * within jar files in addition to the files that are served up by
    * default. If the property has any value, the server finds all jar files
    * in the top-level directory (not in subdirectories). For each
    * jar file, if the name of the jar file is <var>name</var>.jar, then any
    * individual file named <var>file</var> within that jar file (or within
    * the jar or zip files referenced transitively in the Class-Path manifest
    * attribute, can be downloaded using a URL of the form:
    * <pre>
    * http://<var>host</var>:<var>port</var>/<var>name</var>/<var>file</var>
    * </pre>
    * When this property has any value, an open file descriptor and cached
    * information are held for each jar file, for the life of the process.
    * @param args an unused array of command line arguments.
    public static void main(String[] args) {
    Log.makeLog();
    System.out.println("OpenCyc Web Server");
    try {
    // Launch thread to accept HTTP connections.
    current = new WebServer();
    current.start();
    catch (IOException e) {
    e.printStackTrace();
    * Just keep looping, spawning a new thread for each incoming request.
    public void run() {
    try {
    while (true) {
    // Launch thread to process one HTTP request.
    new Task(server.accept()).start();
    catch (IOException e) {
    e.printStackTrace();

    JLundan,
    I want to thank you for responding to the thread I started on the forum at java.sun.com. Your solution to my problem of needing to print the code of the html pages that the file I included generates was just what I was looking for. However, I have some further questions to ask, if you don't mind. To clarify my task I should say that your rephrasing of the problem is accurate: "You wan't to display the contents of the HTML file that the web server produces in response of client's request?"
    Yes, this is what I need to do, but also it needs to display the source code of that html file that the server produces in response to the client's request. Also, in this case, I am the client requesting that the server return some html file, and I'm not sure where the server is. But the webserver.java file that I shared on the forum is on my local machine. I was wondering if I could modify this webserver.java file at my home so that any html file the server returns to me would automatically display the source code. This is a school project of mine and I am stuck on this one thing here.
    Further, where would I put the "foo.html" file so it can be written to?
    FileOuputStream fos = new FileOutputStream("foo.html");
    fos.write(bytes);
    fos.close();
    Thanks so much for your help. I look forward to your response, at your convenience.
    Regards

  • OIC: Need to find the Source Code for the YTDSummary.java file

    Hi All,
    We have 11.5.10 implemention and we are using the OIC(Incentive Compensation) Application. In the Report Module for the Year-To-Date Summary we need look for the Java Source Code.The cnytdsum.jsp file call the YTDSummary.java file. We have teh following question
    1. How we can get the Java Source Code and where and which directory we need to look into?
    2. Let say if we need to customize the java file how we can do that?
    3. where and which directory we have to complie the java file?
    Highly appreciate for any pointers
    Thanks,
    Johnson.

    But those must be platform dependant, not really that
    interesting to look at. I have never felt any need to
    look at those at least.Wake up and smell the coffee, abbie! I read the source code all the time and constantly tell my students to do that, too.
    1. Java source code is not platform dependent. The original poster wanted to look at linked list code, how could that be platform dependent?
    2. It is the implementation of the SDK APIs, so by definition it is implementation dependent code, liable to change in a later version. So don't assume anything beyond what is claimed in the API documentation. However, sometimes the documentation is incomplete or ambiguous to you, and reading the source can provide some insight, however implementation dependent. (Light a candle or curse the darkness.)
    3. Why read source code? It's a good way to learn how to program. You see something in the API and ask: how'd they do that? Or you realize you want to do something broadly similar, but you can't reuse the source code.
    For example, Images are not Serializable, but suppose you want a small image that is part of an object to be serialized with the rest of the object without too much fuss (ie, without using javax.imageio). You notice ImageIcon is serializable, so you use it. (An ImageIcon has-an Image.) Then you wonder: how'd they do that? You read the source and then you know.
    You live, you learn,
    Nax

  • Where can I get the source code for sun classes?

    Hello,
    When ever you download sun's j2sdk, the archive always contains the source code for the entire sdk in a zip file called src.zip except the sun.xxx classes like sun.awt.print.PrintDialog or sun.awt.font.FontResolver.
    For debugging purposes I need, if availabe, the source code of these classes which are not present in the src.zip.
    Please can someone tell me if theses classes are available as source and can point me where I can find it cause I am searching for it but can't find it on the net.
    Thank you
    Carolin

    Hey ChuckBing
    And your way is the only way, right? No.What on earth is eating you? Highly sensitive today?
    Where is the problem? There are two solutions of the question.
    The one link I posted points directly to the sun source download link. The "readme" explains, yippie, the sun sources are contained. Easy, isn't it?
    With the other one, you have to navigate at least through two other pages before you might find the link and only if you recognize that "Download JDK 5.0 source via SCSL/JRL" means the sun source code and not the sources contained in the JDK download. This is what I thought as I've seen this link the first time. Unfortunately there is no "readme".
    I prefer the easy way, I dont want to earn a doctorate. Ok, you can say dont "play the woman", but I'm a woman and a blonde too;-)
    But, let us stop the idle discussion here, please!
    Nevertheless, thanks to you and [email protected] for answering.

  • View the source code before deciding which PHP CMS to download?

    Maybe no one knows this site, for I just was recommend by a friend, if you want to install an Open Source [PHP CMS|http://www.phpkode.com/projects/category/php-cms/] but don't know which one to choose you can visit PHPKode.com and first view the source code of this PHP CMS with the file list feature on the page before installing it...

    If you use SAPlink http://www.saplink.org - you can download the entire component.
    If you want just the classes, that is a little bit harder.  The classes are dynamically generated.  There are different tricks to find out what the class names are. You should NEVER directly interact with the underlying classes. However if you just want to view the code in them you can see the class names in the debugger.  Also if you want, you can just set a breakpoint within one of the methods and then choose utilities->breakpoints->display . You will see the name of the class where your breakpoint is set.  It will be something like: /1BCWDY/4XLHG76LQV8VMTT2GRB2  - however you might find that it is difficult to look at the code from these classes; as we now restrict the ability to pull them up in the class editor.  You just get a message that the object does not exist or is not assigned to a package. This restriction is a protection to keep anyone from accidentally changing the generated objects and corrupting the WD Component.

  • Where's the source code for the JavaFX 8 Samples?

    Hi,
    I just downloaded the samples for JavaFX 8 and the menu popup on the top left really caught my attention.
    I'd like to study the source code for it. Does anyone know where I can find it?
    I expected it here http://hg.openjdk.java.net/openjfx/8/master/rt/file but it seems it's not there.
    Alternatively: Jasper Potts presented a Kiosk App at Devoxx 2012 (Antwerp), which was also used at JavaOne. I think this app uses the same Menu. And he said sources are available. But I can't remember the link.

    Oh, too obvious. They are directly included into the zip. My bad I didn't notice them. I had expected them to be online somewhere. Thanks!

  • I am running 10.6.8 and using iweb for my web site. After several SEO analysis they all indicate I need H1-6 header tags. After looking at the source code I see there are none in iweb. Is it necessary to add? If so, how do I add H Tags to iweb.

    I am running 10.6.8 and using iweb for my web site. After several SEO analysis they all indicate I need H1-6 header tags. After looking at the source code I see there are none in iweb. Are they necessary to add?  Why would one add these tags and how do I add H Tags to iweb? And are there examples to look at? I am slowly learning about simple web design and assumed that iweb was stand alone without having to write code. Is this one of the reasons iweb is no longer supported? Thanks for looking at this!

    A simple text page like this:
    Heading
        sub heading
              text paragraph ....
    Is traditionally represented by html tags like:
    <h1>Heading</h1>
         <h2>sub heading</h2>
              <p>text paragraph ... </p>
    I would guess that the use of h1-h6 tags helps search engines to understand the structure of a page as the tags imply a certain structure.
    This can be compared to more generic tags like <div> that could represent any kind of content - and may be what iWeb uses (you'll have to check yourself).
    I would generally recommend that you use some kind of up to date blog/site building tool, perhaps Wordpress or Squarespace (I haven't used either one myself) that support current web technologies - this should reduce your SEO issues and make it easier to properly support mobile/tablet users.

  • Is there any differnce between the Numeric Limit Test source code from TestStand 3.0 to TestStand 3.1? How to get the source code for the Numric Limit Test for both the versions?

    I need to know the differnece between the Numeric Limit Test between the TestStand version 3.0 to 3.1. If there is any differnec in the source code how to find it out? If somebody has the code can you share it?
    Thanks,
    Jeyan

    Hi,
    I don't believe there are any differences between the two versions. But you can check the source code for the Numeric Limit Test in TestStand\Components\NI\StepTypes\CommonSubsteps. But the main part of the step is the Code Module and this bit the users supplies this.
    What has prompted this question?
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Where to find the source code for MenuTreeListPreviewLayoutController

    Dear All!
    I am desparately searching for the source code of the MenuTreeListPreviewLayoutController. I would like to
    implement a similar Layout Controller than the above mentioned one, but cannot find the code.
    Is anybody able to help me?
    Cheers and thanks in advance
    Ingo

    Hi Ingo,
    you should be able to find and decompile the class com.sapportals.wcm.rendering.layout.cm.MenuTreeListPreviewLayoutController in the JAR km.appl.ui.flex.control_core.jar. This JAR is located under ...<irj-root>\WEB-INF\portal\portalapps\com.sap.km.cm.ui.flex\private\lib
    Hope this helps,
    Robert
    PS: If you have problems to find it, gimme a mail and I'll send you the decompiled version.

  • How to view the source code for Native Method

    hi
    i am using some native methods in to my code ;
    can anybody tell me how to view the source code for the same ;
    nik

    Buy/acquire a C/C++/assembly code disassembler and run the shared library through it.

Maybe you are looking for

  • How to control report direction at runtime

    Hi All I want to control report direction(Left_To_Right or Right_To_Left) at runtime. to make every thing is clear I want to call the report from Form passing parameter ,according the parameter the direction should be directed

  • Need help in importing from a flash drive

    My problem is the content on the flash drive will play in itunes as long as the flash drive is connected to my computer. How to I move the files from the flash permanently into itunes? Thanks for any help

  • Apple mail and email accounts do not open in Yosemite

    I have recently found the problem that I open the Apple Mail app and nothing is functional. When I try to edit account settings it doesn't let me access those. I want to reinstall mail app or at least update its settings. I read in some blog that yos

  • Two of my 7 calendars aren't syncing correctly via icloud from iMac to ipad and iphone.  i cant find the problem. Help!

    Two calendars in my list of seven are not correctly syncing between my iMac and my ipad & iPhone.  Also, the two calendars appear in my iCloud list with alert symbols after the (triangle with exclamation mark) whereas others in list show a "broadcast

  • A feq PC to Mac questions

    How can I accomplish the following 1. Cut and paste the path. For example on the PC, i can go into explorer and cut and paste the physical path such as c:\my docs\folder\folder\folder The reason I like to do this is that I have some files that are fa