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

Similar Messages

  • How to upload  and download a files into AL11 directory in ABAP

    Hi,
                   How to upload  and download a files into AL11 directory in ABAP
    thanks
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on Mar 21, 2011 9:18 AM

    You should try one of these forums for an answer to your question:
    http://swforum.sun.com/jive/forum.jspa?forumID=116
    http://community.java.net/netbeans
    http://linux.java.net

  • Where are the buttons gone File upload and Download in New ABAP Editor

    Where are the buttons gone of File upload and Download in New ABAP Editor in ECC 6.0.
    Or some new utility added for this feature.
    Kindly guide.
    Thanks,
    pradeep

    Go to Utilities>more Utilities>upload/download is there.
    Amresh.

  • 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

  • How to download WD source code?

    Hi,
    I would like to download WD source code and then upload it in another system without the need of a transport.
    Do you have any idea how to do so?
    Thanks,
    Itay

    There is a fantastic open source project SAPLINK  for sharing ABAP related programs/classes between systems without the need for a transport. This can be used in the scenario you have mentioned
    Link:[Saplink |http://code.google.com/p/saplink/]
    For WD ABAP, you would need a ABAP Web Dynpro Plugin Link:[http://code.google.com/p/saplink-plugins/downloads/list?can=2&q=wdyn&colspec=FilenameSummaryUploadedSizeDownloadCount]
    Link: [Documentation|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/saplink]

  • How to upload and Download the file in a system through java programing

    I am trying to upload a file as well as want to download the uploaded file in my system....I don't have any server an all.
    I want to implement this in my system only .
    I got this code but i don't know ,where i have to make the change and what are the parameters i have to pass.
    can any one help me on this code ....please
    here some piece of code
    File Upload and Download Code Example
    package com.resource.util;
    public class FileUpload
    public void upload( String ftpServer, String user, String password,
    String fileName, File source ) throws MalformedURLException,
    IOException
    if (ftpServer != null && fileName != null && source != null)
    StringBuffer sb = new StringBuffer( "ftp://" );
    // check for authentication else assume its anonymous access.
    if (user != null && password != null)
    sb.append( user );
    sb.append( ':' );
    sb.append( password );
    sb.append( '@' );
    sb.append( ftpServer );
    sb.append( '/' );
    sb.append( fileName );
    * type ==> a=ASCII mode, i=image (binary) mode, d= file directory
    * listing
    sb.append( ";type=i" );
    BufferedInputStream bis = null;
    BufferedOutputStream bos = null;
    try
    URL url = new URL( sb.toString() );
    URLConnection urlc = url.openConnection();
    bos = new BufferedOutputStream( urlc.getOutputStream() );
    bis = new BufferedInputStream( new FileInputStream( source ) );
    int i;
    // read byte by byte until end of stream
    while ((i = bis.read()) != -1)
    bos.write( i );
    finally
    if (bis != null)
    try
    bis.close();
    catch (IOException ioe)
    ioe.printStackTrace();
    if (bos != null)
    try
    bos.close();
    catch (IOException ioe)
    ioe.printStackTrace();
    else
    System.out.println( "Input not available." );
    }

    At least that is what the code you posted suggests to me.It looks like that to me too.
    I believe that
    URLConnection urlc = url.openConnection(url);Will return you an FTP URLConnection implementation if you pass it a ftp:// url
    So for simple FTP ops, you don't need any external libs.
    Actually, looking at your code, this is already what you are doing, so I really don't get this:
    am not using FTP server..... i want to implement in my system only ....So How i will do.
    Can you give me any idea based on this code Can you explain a bit more what you need?
    patumaire

  • How to upload and download in BLOB?

    I tried webutil but is not working properly according to my needs is there any other way to upload and download files in BLOB?
    If any body knows solution please tell me.
    Regards,

    Dear Colleague,
    In my Forms application, I use the WEBUTIL to load files into a BLOB column. However, prior to getting WEBUTIL to work, I loaded files into the BLOB column using the following PL/SQL code.
    Note, that the example assumes that the row already exists in the table and you are updating it by loading the file into the BLOB. You will also be required to first create a Database Directory object (in my case, it was called "RKMS_DOC_DIR")
    I do not have an example for downloading, as I use the WEBUTIL functionality for this.
    Good luck!
    Randy
    PL/SQL (DBMS_LOB Package): Loading an Internal Persistent BLOB
    with BFILE Data
    The following example illustrates:
    How to use LOADBLOBFROMFILE to load the entire file without getting its length first.
    How to use the return value of the offsets to calculate the actual amount loaded.
    DECLARE
    src_loc BFILE := bfilename('RKMS_DOC_DIR','ROPE_Offerte_v2.pdf') ;
    v_author VARCHAR2(10) := 'RKMS_MGR' ;
    dst_loc BLOB;
    src_offset NUMBER := 1;
    dst_offset NUMBER := 1;
    src_osin NUMBER;
    dst_osin NUMBER;
    bytes_rd NUMBER;
    bytes_wt NUMBER;
    BEGIN
    -- SELECT ad_composite INTO dst_loc FROM Print_media
    -- WHERE product_id=3106 and ad_id=13001 FOR UPDATE;
    SELECT doc INTO dst_loc FROM docs
    WHERE USER_AUTHOR_ID = v_author FOR UPDATE;
    /* Opening the source BFILE is mandatory */
    dbms_lob.fileopen(src_loc, dbms_lob.file_readonly);
    /* Opening the LOB is optional */
    dbms_lob.OPEN(dst_loc, dbms_lob.lob_readwrite);
    /* Save the input source/destination offsets */
    src_osin := src_offset;
    dst_osin := dst_offset;
    /* Use LOBMAXSIZE to indicate loading the entire BFILE */
    dbms_lob.LOADBLOBFROMFILE(dst_loc, src_loc, dbms_lob.lobmaxsize, src_offset, dst_offset) ;
    /* Closing the LOB is mandatory if you have opened it */
    dbms_lob.close(dst_loc);
    dbms_lob.filecloseall();
    COMMIT;
    /* Use the src_offset returned to calculate the actual amount read from the BFILE */
    bytes_rd := src_offset - src_osin;
    dbms_output.put_line(' Number of bytes read from the BFILE ' || bytes_rd ) ;
    /* Use the dst_offset returned to calculate the actual amount written to the BLOB */
    bytes_wt := dst_offset - dst_osin;
    dbms_output.put_line(' Number of bytes written to the BLOB ' || bytes_wt ) ;
    /* If there is no exception the number of bytes read should equal to the number of bytes written */
    END ;
    /

  • File upload and download through web Dynpro2.0.9. with Java

    Hai All,
          I am working in web Dynpro2.0.9 with Java.For file upload and download "IWDResource" is used.But this package is not available in web Dynpro2.0.9.How to download and upload files through using this version?
          Anyone can help me?
    Thanks in Advance,
    Kindly Regards,
    S.V.Selva Bala.

    Hai Noufal,
        I successfully upload the files to the database.
        For file download i create two views.
       In the first view files are fetched from the database(datatype for the file is image in the database)and it is converted to byte from image.Afterthat the byte is converted to string by using the following code.
    byte source[]=new byte[1024];
                        if(rs.next()){
                             source=rs.getBytes("cv_document_file");
                        String sourcestr=source.toString();
                        wdContext.currentContextElement().setDownloadfile(sourcestr);     
            Now i put the converted string into the second view.In the second view i try to convert the string value into bytes by using the following codes.
    String sourcestr=wdContext.currentContextElement().getDownloadfile();
             byte bs[]=new byte[1024];
             bs=sourcestr.getBytes();
             wdContext.currentDownloadElement().setDownloadfile(bs);
             But it doesn't work and no error.
             Now i am expecting the valuable suggestions from you.
    Thanks in Advance,
    Kind Regards,
    S.V.Selva Bala.

  • How to Upload and Download Files

    Dear Friends
    I want to write code for Upload and Download file ( Group of Files). Please Guide me the right way I have a few java files and i have compiled that but i donot know how to run that file and i am stranger to java also.
    Please send me reply and sugessest me.
    my email id is [email protected]
    Amogh

    I have write a upload code, but the code can deal with txt onle, it can not deal with bmp or doc, what the matter?
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Upload extends HttpServlet {
         String rootPath;
         static final int MAX_SIZE = 102400;
         public void init(ServletConfig config) throws ServletException
              super.init(config);
         public void doGet(HttpServletRequest request,HttpServletResponse response)
         throws ServletException,IOException
              response.setContentType("text/html");
              PrintWriter out = new PrintWriter (response.getOutputStream());
              out.println("<html>");
              out.println("<head><title>Servlet1</title></head>");
              out.println("<body><form ENCTYPE=\'multipart/form-data\' method=post action=''><input type=file enctype=\'multipart/form-data\' name=filedata>");
              out.println("<input type=submit></form>");
              out.println("</body></html>");
              out.close();
         public void doPost(HttpServletRequest request,HttpServletResponse response)
              ServletOutputStream out=null;
              DataInputStream in=null;
              FileOutputStream fileOut=null;
              rootPath = "C:\\upload\\tmp\\";          //The directory to save the target file.
              try
                   response.setContentType("text/plain");
                   out = response.getOutputStream();
              catch (IOException e)
                   System.out.println("Error getting output stream.");
                   System.out.println("Error description: " + e);
                   return;
         try
              String contentType = request.getContentType();
              if(contentType != null && contentType.indexOf("multipart/form-data") != -1)
                   in = new DataInputStream(request.getInputStream());
                   int formDataLength = request.getContentLength();
                   byte dataBytes[] = new byte[formDataLength];
                   int bytesRead = 0;
                   int totalBytesRead = 0;
                   int sizeCheck = 0;
                   String sourceFileName = "";
                   String targetFileName = "";
                   while (totalBytesRead < formDataLength)
                        sizeCheck = totalBytesRead + in.available();
                        if (sizeCheck > MAX_SIZE)
                             out.println("Sorry, file is too large to upload.");
                             return;
                        bytesRead = in.read(dataBytes, totalBytesRead, formDataLength);
                        totalBytesRead += bytesRead;
                   String file = new String(dataBytes);
                   dataBytes = null;
                   int lastIndex = contentType.lastIndexOf("=");
                   String boundary = contentType.substring(lastIndex+1, contentType.length());
                   //File Content
                   //out.println("File content: " + file);
                   if (file.indexOf("name=") > 0)
                        int fileNameStart = 0;
                        int fileNameEnd = 0;
                        fileNameStart = file.indexOf("filename=\"");
                        fileNameEnd = file.indexOf("Content-Type:");
                        sourceFileName = file.substring(fileNameStart + 10, fileNameEnd - 3);
                        //Source File
                        out.println("Source file: " + sourceFileName);
                   String successPage="";
                   if (file.indexOf("name=\"SuccessPage\"") > 0)
                        successPage = file.substring(file.indexOf("name=\"SuccessPage\""));
                        successPage = successPage.substring(successPage.indexOf("\n")+1);
                        successPage = successPage.substring(successPage.indexOf("\n")+1);
                        successPage = successPage.substring(0,successPage.indexOf("\n")-1);}
                        String overWrite;
                        if (file.indexOf("name=\"OverWrite\"") > 0)
                             overWrite = file.substring(file.indexOf("name=\"OverWrite\""));
                             overWrite = overWrite.substring(
                             overWrite.indexOf("\n")+1);
                             overWrite = overWrite.substring(overWrite.indexOf("\n")+1);
                             overWrite = overWrite.substring(0,overWrite.indexOf("\n")-1);
                        else
                             overWrite = "false";
                        String overWritePage="";
                        if (file.indexOf("name=\"OverWritePage\"") > 0)
                             overWritePage = file.substring(file.indexOf("name=\"OverWritePage\""));
                             overWritePage = overWritePage.substring(overWritePage.indexOf("\n")+1);
                             overWritePage = overWritePage.substring(overWritePage.indexOf("\n")+1);
                             overWritePage = overWritePage.substring(0,overWritePage.indexOf("\n")-1);
                        targetFileName = sourceFileName.substring(sourceFileName.lastIndexOf("\\") + 1);
                        targetFileName = rootPath + targetFileName;
                        //Target File:
                        out.println("Target file: " + targetFileName);
                        int pos; //position in upload file
                        pos = file.indexOf("filename=");
                        pos = file.indexOf("\n",pos)+1;
                        pos = file.indexOf("\n",pos)+1;
                        pos = file.indexOf("\n",pos)+1;
                        int boundaryLocation = file.indexOf(boundary,pos)-4;
                        file = file.substring(pos,boundaryLocation);
                        File checkFile = new File(targetFileName);
                        if (checkFile.exists())
                             if (!overWrite.toLowerCase().equals("true"))
                                  if (overWritePage.equals(""))
                                       out.println("Sorry, file already exists.");
                                  else
                                       //redirect client to OverWrite HTML page
                                       response.sendRedirect(overWritePage);
                                  return;
                        File fileDir = new File(rootPath);
                        if (!fileDir.exists())
                             fileDir.mkdirs();
                        fileOut = new FileOutputStream(targetFileName);
                        fileOut.write(file.getBytes(),0,file.length());
                        if (successPage.equals(""))
                             out.println("File written to: " + targetFileName);
                        else
                             response.sendRedirect(successPage);
                        else //request is not multipart/form-data
                             out.println("Request not multipart/form-data.");
                   catch(Exception e)
                        try
                             System.out.println("Error in doPost: " + e);
                             out.println("An unexpected error has occurred.");
                             out.println("Error description: " + e);
                        catch (Exception f) {}
                   finally
                   try
                        fileOut.close(); //close file output stream
                   catch (Exception f) {}
                   try
                        in.close(); //close input stream from client
                   catch (Exception f) {}
                   try
                        out.close(); //close output stream to client
                   catch (Exception f) {}
    }

  • Uploading and downloading files from a web app (Urgent!!)

    Hi everyone:
    I'm developing an application in PL/SQL to upload and download files from an HTML webpage. I congured the document table and the parameters necessary in the DAD of my application.
    when I upload the file using my webpage that file info is automatically uploaded to the doc table. This is as far as I have gotten.
    I need to do the following:
    - Place the uploaded file into a column in another table in my database as part of a text message (think of it as an email message), and delete the file from the doc table (as this is thought to be a temp table that holds the file when uploaded from my webpage)
    - Retreive the file so that it can be downloaded from another web page.
    The file can be a PDF, WORD DOC, etc...
    I now that I can do this with InterMedia but I haven't figured out how :(
    Can anyone please point me to an example or some documentation that can guide me through the process.
    DB VERSION: 8.1.7
    IAS VERSION: 1.0.2.2
    Thanks,
    Carlos Abarca

    The idea was for you to look at the code and get an idea of how to access the BLOB in the document table. IF you look at the procedure
    insert_new_photo( new_description IN VARCHAR2,
    new_location IN VARCHAR,
    new_photo IN VARCHAR2 )
    It shows how to access the blob that is stored in the document table. You can then copy this blob to your own table using the DBMS_LOB package.
    Hope this helps,
    Larry

  • ABAP source code is written "by hand" or automatically?

    Hi all,
    I would like to modify the report "Open Items - Vendor Due Date Forecast" created by T. S_ALR_87012084. 
    With SE93 i found the name of the program RFKOFW00, which are referring to the T. S_ALR_87012084. T. S_ALR_87012084. (Parameter: D_SREPOVARI-REPORT = RFKOFW00) and with SE38 i have seen the ABAP source code of the program RFKOFW00.
    My questions are:
    1) The ABAP  source code of the program RFKOFW00 is written "by hand", or automatically by one of the SAP tools, for example Report Painter/Writer, SAP queryu2026..? It seems to me that it is written "by hand". Is this true?
    2) In general, how can i tell if a SAP ABAP program is written "by hand" or automatically by one of SAP tools? I know that one way to understand is that source code, written by hand is more clear.
    Is there a way to understand, more accurate, more secure?
    Thanks in advance
    Serena

    Hi ,
    if the code is automatically created, there will be a comment line in the beginning of the code which says
    Generated function module for ..........
    Please do not modify or copy this function module
    Regards

  • Function Module to get ABAP source code for a specific version

    Hi all
    Is there a function module that I can use to get the source code of another function module at a specific version?
    For example, can I call a function module passing in "FM_NAME" and "FM_VERSION" and have it return the lines of code associated with that object?
    Thanks in advance.
    Stuart

    Thanks guys
    That's incredibly helpful! I have one more question that I just thought of last night...
    Is there a way to hook into the code activation process? I want to be able to take a snapshot of the ABAP source code at each point when it is activated for use in another system, but need to be able to intercept this event and get the source code at that point in time.
    Any ideas?
    Thanks!

  • Uploading and downloading blobs without wwv_flow_files

    Hi,
    I am currently working on oracle 10g database and application express.
    i went throu the material to upload and download images, pdf from a htmldb book.
    it was excellent material. but the book only gave example about loading and downloading images, pdf through flows_files.wwv_flow_files view.
    it seemed like we can only d/l the pdf, images and display on htmldb report only throu flows_files.wwv_flow_files view, as in the case of the script below
    select
       wff.id, htf.anchor( 'p?n=' || wff.id, wff.filename ) filename_1,
       wff.filename filename_2, ed.abstract abstract
    from
       wwv_flow_files wff, easy_document ed
    where
       wff.name = ed.name;but is there a way to load and download images, pdfs from my own tables without the involvement of flows_files schema.
    if then how can i modify the above code to get the pdf from the following table
    TableA (vessel number, cruise number, pdf blob)
    here for every (vessel, cruise) combination there is a pdf.
    how can i get this pdf displayed in my htmldb report.
    Can someone guide me please.
    Thanks,
    Philip.

    Hi,
    I tried the document link you gave and it looks like, i can directly download pdfs from my own tables without needding to upload to wwv_flow_files_objecst$ table.
    i modified the procedure in the document accroding to my requirements and it worked.
    in my page i show a grid with the parameters and the pdf documentname as download link.
    when i click on the link a popup window with the option to save or open comes up.
    but the popup window shows the filename as my procedure name through which i pass the id for the pdf document instaed of the filename which is shown as download link on the page.
    How can i change this popup window filename to the default file name shown in the download link.
    so that everytime i select the parameters, the page shows the pdf filename as link and on clicking the link the popup window should be able to show the same name shown as link.
    i think this can be set either at the procedure level or at the page level.
    and this is the following contents of the procedure
    --        SET UP HTTP HEADER
                   -- use an NVL around the mime type and
                   -- if it is a null set it to application/octect
                   -- application/octect may launch a download window from windows
                   owa_util.mime_header( nvl('PDF','application/octet'), FALSE );
                    -- set the size so the browser knows how much to download
                     htp.p('Content-length: ' || B_LEN);
                    -- the filename will be used by the browser if the users does a save as
    -- htp.p('Content-Disposition:  attachment; filename="'||'CR'||VES||CRU||'.PDF'|| '"');
                    -- close the headers           
                    owa_util.http_header_close;
                    -- download the BLOB
                    wpg_docload.download_file( BREP );and this is what i did at the page level. for that particular column i went to link option and the foll is what i gave:
    Link Text: CR#VESSEL##CRUISE#.PDF
    Link Attributes: target="_blank"
    URL: #OWNER#.PROC_DOWNLOAD_PDFS?V=#VESSEL#&C=#CRUISE#
    Here the link text is the filename that i wanted to show when saving the file.
    Can someone guid eme please.
    Thanks,
    Philip.

  • Upload and download a PDF in BSP

    Hi All,
    I need to do the following funtionalityin BSP (business server page ).
    1)upload and download a PDF
    Pls anyone help me by providing the necessary code to do this .
    Thanks in Advance
    Rizwan

    Hi,
    This link is useful for U
    http://help.sap.com/saphelp_nw04/helpdata/en/eb/8c683c8de8a969e10000000a114084/content.htm
    http://wiki.sdn.sap.com/wiki/display/BSP/HandlingBinaryData
    Regards
    kk

  • How to upload and download a file in server side program

    Give me a sample code for the file upload and download using Server side program.

    You should try one of these forums for an answer to your question:
    http://swforum.sun.com/jive/forum.jspa?forumID=116
    http://community.java.net/netbeans
    http://linux.java.net

Maybe you are looking for

  • Import statement .. what does it do ??

    Hi All, What is IMPORT statement doing ?? IMPORT order_items_in to w_order_items_in from MEMORY ID 'FREEGOODSTERMS'. can you kindly explain what this statement is doing ? I was by my friend that this is used to pass order_items from one session to th

  • Pass parameter based on login Id?

    Hi Friends I should pass client_id as a parameter to my portal pages as a parameter based on the login ID ... my portal page consists of a report based on client_id Can any one suggest me how can i achieve this? Thanks Ravi

  • IPod Video 5G Not recognized on MacBook Pro 17 Intel

    My Ipod video 5G is not showing in iTunes or on my desktop. Not showing in System Profiler either. The ipod does charge however. I'm frustrated and stumped. I've tried the 5Rs a number of times but can't even get to the "Restore" portion. iPod works

  • Purchase Order Condition Data

    Hi, Can anybody please explain what is Purchase Order Condition Data ( KONV ). What is the use of it in the report. Thanks, JB

  • M50-192: screen catch doesn't hold down the screen

    hi hope somebody can help i own a m50 192 and have had it since 28/02/2006 the laptop has never left the house yet and i have a problem with the screen catch. It is not holding the screen down in the transit position to myself as engineer it looks li