Webutil, ora_ffi and source code

Hi
We use forms 6i, so, of course, we can't use webutil.
What we currently do in client/server is use the get_file_name to allow the user to select a file from their drives and then that path and filename are stored in the database.
Then, using some ORA_FFI code, we allow the user to click on the file name and the file opens on their machine, using the default application (done by a call to shellexecutea, I think)
ANYHOW, what we'd like to do is bring this over into our web deployment.
For the get_file_name item, I was thinking that if we could get the source code for Webutil, we could make it work for 6i.
Question: Is there any place I can get the source?
For the opening of the file, it gets a little more complicated.
Question: Does anyone know how I might accomplish the same functionality for our web as we have on our client/server version?
(yeah, I know this is kind of a big question)
thanks!
-Joel

HI Joel,
As far as I saw,you can use webutil with F6i...the only requirement is to have a JInitiator 1.3.1.9 available..
You can download it from otn and install it into Forms6i..
I don't know exactly ,but it seems to me that patch 13 installs it automatically..
You can open the webutil.pll with a text editor and get the code frm there,and create the 6i pll.
And with webutil.olb,you can open it in a forms9i get the code from the triggers on the block,and create a 6i olb file.
I thinck it worth the work.
You must also create the virtual directory where the webutil files are downloaded from.
Good luck

Similar Messages

  • Jar file and source code? (new to java!)

    Hi all!
    Sorry if this is a dumb question but I'm really new to java (.net guy).
    Someone sent me a jar file and now I need access to source code. I now that I can rename to .zip and view its contents (.class)...
    But what about source code? Can I decompile? As i understand, .class files are compiled .java files...
    Should I ask for the source code to the guys that sent me the .jar file?
    thanks
    jay

    Humm... is java as fast as replies in this forum? Thank's for your replies warnerja and zadok
    I need the source code so that I can understand how the original developer solved a problem. I can ask for the source code.
    I posted this message because I was afraid that the question was stupid and source code was in front of me. I am really new to java!
    So. No source code in .jar or .class files. Right?
    Thanks
    Jay

  • Login Box example and source code on adf struts and JSP

    Dear all..
    I want to make application using ADF struts and JSP using oracle 10g Jdeveloper.
    The user should login into the login box and verify everyone who has right to enter the home.jsp.
    Anybody could help me with the source code as well as the step by step explanation...
    I'm looking forward the help...

    http://www.oracle.com/technology/products/jdev/collateral/papers/10g/reviewer/viewlets/reviewer_struts_viewlet_swf.html

  • How to track DDL Changes and source code changes

    How can I track the DDL Changes and the Source code (Functions,Procedures,Packages & views) changes made for selective schemas?.
    I mean I want to maintain the history of DDL changes and the sourcecode change history. How to do that? Please provide your guideline with some example...

    Hi,
    you could use a DDL trigger (before create)
    to maybe capture the code and do the audit as well?
    Try this:
    SQL>create table old_code
    2 as
    3 select user username, 0 version, sysdate date_changed, user_source.*
    4 from user_source
    5 where 1=0
    6 /
    Table created.
    SQL>create sequence version_seq;
    Sequence created.
    SQL> create or replace trigger create_trigger
    2 before create on schema
    3 declare
    4 l_date date := sysdate;
    5 l_ver number;
    6 begin
    7 if (ora_dict_obj_type in ( 'PACKAGE', 'PACKAGE BODY', 'PROCEDURE',
    'FUNCTION' ) )
    8 then
    9 select version_seq.nextval into l_ver from dual;
    10
    11 insert into old_code
    12 select user, l_ver, l_date, user_source.*
    13 from user_source
    14 where name = ora_dict_obj_name
    15 and type = ora_dict_obj_type;
    16 end if;
    17 end;
    18 /
    Trigger created.
    SQL> create or replace function f return number
    2 as
    3 begin
    4 return 0;
    5 end;
    6 /
    Function created.
    SQL> select * from old_code;
    no rows selected
    SQL> create or replace function f return date
    2 as
    3 begin
    4 return sysdate;
    5 end;
    6 /
    Function created.
    ops$[email protected]> select * from old_code;
    USERNAME VERSION DATE_CHAN NAME TYPE LINE TEXT
    aaaaaaaaaaa 2 17-OCT-02 F FUNCTION 1 function f return number
    aaaaaaaaaaa 2 17-OCT-02 F FUNCTION 2 as
    aaaaaaaaaaa 2 17-OCT-02 F FUNCTION 3 begin
    aaaaaaaaaaa 2 17-OCT-02 F FUNCTION 4 return 0;
    aaaaaaaaaaa 2 17-OCT-02 F FUNCTION 5 end;

  • Exercises and source code

    I´m trying to do the exercise "Binding data and Handling
    a User Event"
    It says "1. Open AdobeODT.mxml in the AdobeODT project.."
    Maybe this is a silly question - but, is there any source
    code to download somewhere?
    If so, where? Cant find the link.

    Building on what highlander_1 is asking: it would be helpful
    to have the source code for the exercises available for
    downloading. I like the current format for building the files: it
    helps us to understand how the various pieces fit together.
    However, even when we carefully construct these modules, it
    is possible to make errors that are not caught at compilation and
    very, very difficult to spot where we made the mistake.
    For example, I've done the exercise on Using XML with E4X and
    added the Search exercise. I even found a typo in step 41 were the
    var searchObjEvent is listed as "searObjEvent" (that through me off
    when errors were thrown at compilation), but I'm now getting an
    error when I try to run the search. I'm still digging into the code
    trying to figure out where I went wrong, but it would be good to
    have the correct code available should that search not yield
    results.

  • Lingo Applications and Source Code

    The freeware applications have been around for a while, and now the source code is available as well.
    Applications - http://www.axiomx.com/free_software.htm
    Source Code - http://www.axiomx.com/algorithms.htm
    I decided to make the code available because otherwise it will just continue to collect dust.
    My code is more or less devoid of commenting, making it more difficult to decipher. The majority of it is original, but I adapted a significant amount of code from Gary Rosenzweig's Using Director 7, and from the wonderful community of Director users on the Web. If you need my help to make sense of something, let me know.

    Thanks for sharing Luisa Klose.. really appreciate it!

  • Drag & drop application and source code

    hi,
    i am now researching a drag & drop Java application.
    could someone tell me where can i find a sample Java application with source code which implement GUI drag and drop.
    thank u very much and have a nice day

    http://java.sun.com/docs/books/tutorial/dnd/index.html

  • Portal design and source code

    Hi
    How can I make the HTML generated from the portal more readable? When I view the page source some tags like table, div are separated into few lines.
    I have a portal composed as one main book (book1). book1 has some pages (page1). Then each page has one book (book2). That book can has 1 to n pages (p1, p2....pn). Can I just put book2 in book1, or even p1 in book1 if book2 only has one page p1? What's the difference? I will think it's simpler.
    Thanks

    If you're using WLP 10.0 or later, use the Bighorn look and feel as your starting point. In Bighorn's skeleton, we've cleaned up a lot of the markup to make it easier to read and understand.
    You might also look into Firebug (http://getfirebug.com) or another web development tool of similar ilk, to help you when you're trying to read rendered markup.
    George

  • Upload and Download ABAP Source Code

    This is a program that I have had kicking around for a couple of years in various incarnations.
    Source Code Listing
    Report: ZKBPROGS *
    Function : Up/Download ABAP reports complete with texts *
    - 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
    Program Texts
    DIR File Download Options (File Selection)
    FIL File Options
    FNA Enter filename below (under File Options)
    H01 Prog Name
    H03 Program Description
    SNG Upload a single file
    UDL Upload to SAP/Download from SAP
    UPL File Upload Options
    R Backup/Restore program source code with texts
    P_PATH Path to save programs to
    RB_DOS Files on local computer
    RB_DOWN Download Programs
    RB_FILE Upload a single file
    RB_LIST Select program(s) from a list
    RB_UNIX Files on remote computer
    RB_UP Upload Programs to SAP
    S_CDAT Date Created
    S_CNAM Created by UserID
    S_NAME Program Name
    S_SUBC Program Type
    S_UDAT Date Changed
    S_UNAM Last Changed by UserID

    Hi
    you can use SAPLink for this
    http://code.google.com/p/saplink/
    Abhi

  • Is it possible to get source code of AutomationManager.as class or/and QTPAdapter.as?

    Sorry, we don’t really provide source for those classes right now.
    On 2/25/09 2:47 AM, "JabbyPanda" <
    [email protected]> wrote:
    A new discussion was started by JabbyPanda in
    General Discussion --
      Is it possible to get source code of  AutomationManager.as class or/and QTPAdapter.as?
    I have a license of Flex Builder 3.0.1 Pro, running Win XP.
    Inside "c:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\2.0.1\frameworks\source\mx\automation\"  folder I can only locate a listing of source code of IAutomationManager interface.
    Inside "c:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.2.0\frameworks\projects\automation\src\mx\automation\" folder there is also a bunch of open sourced classes present, but even source code of IAutomationManager interface is missing.
    And source code for AutomationManager.as and QTPAdapter.as classes are nowhere to find.
    And I tried to extract source files from Data Visualization package as suggested here
    http://blogs.adobe.com/flexdoc/2008/04/extracting_data_visualization.html, no luck
    View/reply at Is it possible to get source code of  AutomationManager.as class or/and QTPAdapter.as? <
    http://www.adobeforums.com/webx?13@@.59b80b91>
    Replies by email are OK.
    Use the unsubscribe <
    http://www.adobeforums.com/webx?280@@.59b80b91!folder=.3c060fa1>  form to cancel your email subscription.

    We can look at setting up some subtopic forums targeting specifics like automation once we have our new system in place.
    On 2/26/09 7:57 AM, "JabbyPanda" <
    [email protected]> wrote:
    A new message was posted by JabbyPanda in
    General Discussion --
      Is it possible to get source code of AutomationManager.as class or/and QTPAdapter.as?
    What I plan to do, is to write a couple of delegates to prepare (instrument) my custom components that extend from UIComponent for testing.
    I found the source file for AQAdapter.as from FlexMonkey tool at  
    http://code.google.com/p/flexmonkey/source/browse/trunk/FlexMonkey/src/com/gorillalogic/aq adaptor/AQAdapter.as, by studying the code of AQAdapter.as I can get the better idea what QTPAdapter.as does.
    In general, I found the documentation on test automation for Flex application to be very modest and limited, for example many attributes for XML-based "class information file" for HP QuickTest tool are not documented at Adobe Flex livedocs.
    BTW, is there any better place where test professionals and Adobe Flex developers exchange the knowledge on test automation of Flex apps?
    I've tried
    http://www.sqaforums.com by running search query
    http://www.google.com/custom?domains=SQAforums.com&! q=Adobe+Flex&sitesearch=SQAforums.com <
    http://www.google.com/custom?domains=SQAforums.com&q=Adobe+Flex&sitesearch=SQAforums.com> , but I left with a feeling the most enquiries were made by people who are just evaluating possiblity of testing of Flex apps with HP QuickTest tool.  

  • How to read the Java source code (in Netbeans)

    I use OS X10.5.5, NetBeans 6.1 and JSE 6 on a 64 bit mac.
    When I downloaded NB6.1 it had JSE 5 as it's default (and only) java platform. I ran Software Update to get Java 6 from Apple, used the Java Prefrences utitlity to set JSE6 as default. In NB I added the JDK6 platform, registered the JDK6 javadocs and noticed that I also have the option of registering the Java source code.
    I have three questions:
    1) How do I make JDK6 the default in NetBeans. The JDK5 keeps being default after I did the steps above and I don't see anywhere to change that.
    2) How do I read the Java 6 source code? I can see sun provides [source code| http://download.java.net/jdk6/] for their supported platforms. I dont see Apple doing the same for its JDK port. What would I need to do to get to read the java SE6 sources? or is it actually hiding somewhere in the /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home hierarchy?
    3) Where does the JVM look for the binary code to run when I make a call to, say java.util.ArrayList or any other library. In my naivety I would have assumed it would be a .class file somewhere in the java Home folder, but I don't see anything like it.
    thanks in advance,
    chris

    This is taken from the help included with netbeans. In response to question 1.
    By default, the IDE uses the version of the Java SE platform (JDK) with which the IDE runs as the default Java platform
    for compilation, execution, and debugging. You can view your IDE's JDK version by choosing Help > About and clicking the
    Detail tab. The JDK version is listed in the Java field.
    You can run the IDE with a different JDK version by starting the IDE with the --jdkhome jdk-home-dir switch on the command line
    or in your IDE-HOME/etc/netbeans.conf file. For more information, see IDE Startup Parameters.
    In the IDE, you can register multiple Java platforms and attach Javadoc and source code to each platform. For example, if you
    want to work with the new features introduced in JDK 5.0, you would either run the IDE on JDK 5.0 or register JDK 5.0 as a
    platform and attach the source code and Javadoc to the platform.
    In  , you can switch the target JDK in the Project Properties dialog box. In  , you have to set the target JDK in the Ant script itself,
    then specify the source/binary format in the Project Properties dialog box.
    To register a new Java platform:
    Choose Tools > Java Platforms from the main window.
    Click New Platform and select the directory that contains the Java platform. Java platform directories are marked with a  
    in the file chooser.
    Use the Sources and Javadoc tabs to attach Javadoc documentation and source code for debugging to the platform.
    Click Close.
    To set the default Java platform for a standard project:
    Right-click the project's root node in the Projects window and choose Properties.
    In the Project Properties dialog box, select the Libraries node in the left pane.
    Choose the desired Java platform in the Java Platform combo box.
    Switching the target JDK for a standard project does the following:
    Offers the new target JDK's classes for code completion.
    If available, displays the target JDK's source code and Javadoc documentation.
    Uses the target JDK's executables (javac and java) to compile and execute your application.
    Compiles your source code against the target JDK's libraries.
    If you want to register additional Java platforms with the IDE, you can do so by clicking the Manage Platforms button.
    Then click the Add Platform button and navigate to the desired platform.
    To set the target Java platform for a free-form project:
    In your Ant script, set the target JDK as desired in the javac, java, and javadoc tasks.
    Right-click the project's root node in the Projects window and choose Properties.
    In the Sources panel, set the level of JDK you want your application to be run on in the Source/Binary Format combo box.
    When you access Javadoc or source code for JDK classes, the IDE searches the Java platforms registered in the
    Java Platform Manager for a platform with a matching version number. If no matching platform is found, the IDE's default platform is used instead.
    See Also
    Managing the Classpath
    Declaring the Classpath in a Free-Form Project
    Stepping Through Your Program
    Legal Notices

  • API : EventHandler and ugly code

    Hello,
    I'm playing with javafx2 api since I 've been disapointed by flex and silverlight api.
    My reference is forever the swing api and I want to know how to write beautiful code which will respect all best practices (pmd,checkstyle, findbugs, javancss)
    The problem is the genericsable class EventHandler ...
    In swing I can have a class that implements MouseListener and ActionListener interface, So if my control implements these interfaces I can have an actionPerformed, mouseMoved .... methods which will process all actions.
    public class MyClass extends JPanel implements ActionListener, MouseListener {
    mybutton.addActionListener(this);
    mycontrol.addMouseListener(this);
    public void actionPerformed(ActionEvent e){
        if(e.getSource.equals(mybutton)){
             // mybutton stuff
    public void mouseMoved(MouseEvent e){
        if(e.getSource.equals(mycontrol)){
             // mycontrol stuff
    }The JavaFX2 API use the same approach but since the eventHandler use a custom generics type, I must implements EventHandler (without type <XX>) and do a lot of cast everywhere to fill the gap.
    mybutton.setOnAction((EventHandler)this);then
    public class ControlPanel extends Region implements EventHandler<Event> {
    bt1.setOnAction((EventHandler)this);
    bt2.setOnAction((EventHandler)this);
    progressbar.setOnMouseClicked(this);
        public void handle(Event event) {
            if(MouseEvent.class.equals(event.getClass())){
                f(event.getSource().equals(progressbar)){
                     //stuff;
            }else if(ActionEvent.class.equals(event.getClass())){
                if(event.getSource().equals(bt1)){
                     //stuff;
                }else if(event.getSource().equals(bt2)){
                    //stuff;
        }IN fact with javafx2 it's more difficult to write code not using anonymous class which will be a very big problem for software maintainability and source code quality.
    Moreover the SetONXXX method which have a Runnable argument need anonymous class or dedicated inner class to manage threading priorities and I don't see any solution to make it cleaner.
    It would be nicer to use a custom Runnable class which have some fields used to identify the source and the kind of event.
    At the moment, a javafx2 developers have 2 options :
    _ Write a lot of anonymous class anywhere in its source code, the class will be unreadable because the code is not organized (components initialization, action processes, business logic)
    _ create a huge amount of dedicated class (runnable and eventhandler) which all reference the main control ...
    JavaFx2 code will be more complex and can be less adopted or misloved ....
    What do you think about this ?
    Edited by: Seb on 27 août 2011 00:15

    I do like a good architecture debate, everyone gets so passionate! :)
    Pure OO or otherwise, I feel your pain Sebastian: inner classes can be painful to work with. As mentioned above, (IMHO) this is mostly a result of Java's syntax being a little clunky in this area. What you really want to do is pass in a method pointer like this:
    void buildView() {
        Button myButtton = new Button();
        myButton.addActionHandler(onMyButtonAction);
    void onMyButtonAction(ActionEvent event) {
        // do custom event handling
    } But obviously Java doesn't support this at a language level. It does support it via Reflection however and in Swing (and now in JFX) I've often created a helper class that would let me bind the action to the method via Reflection (using inner classes internally - but this is all hidden under the helper).
    void buildView() {
        Button myButtton = new Button();
        bindAction(myButton.onActionProperty(), this, "onMyButtonAction");
    void onMyButtonAction(ActionEvent event) {
        // do custom event handling
    } Your code is now much simpler and more readable but the big (BIG!) drawback is that you lose compiler safety - it is up to you to decide whether this is worth it or not (I'm sure purists will passionately hate this idea but I'm all for 'developers choice').
    A simple implementation of the helper code would look something like:
    public void bindAction(ObjectProperty<EventHandler<ActionEvent>> onActionProperty, final Object target, final String methodName)
        final Method method = target.getClass().getMethod(methodName, EventHandler.class);
        onActionProperty.set(new EventHandler<ActionEvent>()
            public void handle(ActionEvent event)
                method.invoke(target, event);
    }I've left out exception handling for simplicity. You could obviously add a bindMouseClick method, and bindXYZ methods for all the other events that you want to handle.
    There's also an [url http://download.oracle.com/javafx/2.0/fxml_get_started/jfxpub-fxml_get_started.htm]emerging option with FXML, that does similar action to method binding. When you define your button in the XML you add a onAction="#myButtonHandlerMethod" and the FXML binder will bind this automagically to your method (I imagine using reflection like I have done above). It's still pretty raw and you have to build your UI layout in XML (a plus in some people's eyes, a negative in others) but it's worth a look. I haven't seen Mouse handler stuff in there yet but if it's not there yet, I imagine it will be added before too long.
    Like all free advice, take it or leave it :)
    Enjoy,
    zonski

  • How to Upload Program Source Code

    Hello,
    i have a program which downloads the source code into text files.
    I need to create all these into another server.
    so i need a program to upload these programs.
    Any idea how to it? Thanks in advance.
    Thanks&Regards,
    Sayanna Damerla

    Try this custom code:
    Upload and Download ABAP Source Code
    Source Code Listing
    Report: ZKBPROGS             *
    Function   : Up/Download ABAP reports complete with texts            *
            - 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
    Program Texts
    DIR             File Download Options (File Selection)
    FIL             File Options     
    FNA             Enter filename below (under File Options)
    H01             Prog Name
    H03             Program Description
    SNG             Upload a single file
    UDL             Upload to SAP/Download from SAP
    UPL             File Upload Options
    R               Backup/Restore program source code with texts
    P_PATH          Path to save programs to
    RB_DOS          Files on local computer
    RB_DOWN         Download Programs
    RB_FILE         Upload a single file
    RB_LIST         Select program(s) from a list          
    RB_UNIX         Files on remote computer               
    RB_UP           Upload Programs to SAP                 
    S_CDAT          Date Created       
    S_CNAM          Created by UserID  
    S_NAME          Program Name       
    S_SUBC          Program Type       
    S_UDAT          Date Changed       
    S_UNAM          Last Changed by UserID     
    Regards,
    Joy.

  • 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

  • Attaching source code of jar files in ecllipse edidor

    Hi all,
    i want to attach source code for jre system library 1.5 while i am using ecllipse 3.2. i also want to attach other source code for struts.jar .
    but i am unable to do it.
    my another problem is that i have struts.jar 1.2.9 and source code for that version is not available on the apache site.
    so please help me to attaching source file with jar files.
    thanks.

    source code for jre system library 1.5 under eclipse: Window -> Preferences ->
    Installed JREs -> here add JDK and not JRE
    (that's all !!)
    source code for struts.jardownload struts.xxx-src.zip from struts web site the
    add it to your struts project repository. Write some
    code that uses the struts API then select a struts
    class (ActionForm for example) and hit F3 keyboard
    key. Finally, click the button Attach
    Source... and select struts.xxx-src.zip you've
    just downloaded.
    do the same thing for all other jar which have a
    source code
    hope that helpsRather than change JVMs to do this, you could just follow java_2006's instructions for the JRE, looking for the source inside the folder where your JDK is installed. It's in a file called src.zip

Maybe you are looking for

  • Icloud Documents: How do I keep files in folders?

    I am very happy about Documents in the Cloud.  But I like to keep my documents categoried in folders.  I can't figure out how to do it.

  • Search of PDF content not working within SharePoint 2003

    Unable to get any search results for filenames that include underscores and any PDF document content. Confirmed that search is working correctly otherwise. PDF file types have been included in the SharePoint search. Was using ifilter 6.0 installed on

  • Automatic primary key generation for pointbase

    Hello friends, I was wondering whether it is possible to automatically generate primary keys for a pointbase database. Just like the SQL Server pointbase also has a indentity property. I have used weblogic builder to specify automatic key generation.

  • DWT updating issues

    Hello, I am having an odd problem in that pages attached to a DWT will only update if they are open in design view. If I close them, open the DWT file and update all attached pages, they will not update. Open the attached pages, repeat the process an

  • Transport objs

    i like to know the scenario on offshore work assignments.  that includes development class, work requist id and workbench etc., i  need to know how objects are transported at offshore develoopment.  while working with sapscript and std texts using so