Download ABAP Objects to a local directory

Hi! Just want to ask if there's someone who knows any program that can download a copy of ABAP Objects to a local directory? Thanks a lot!!!

Hi Jason.
Find the Below code to download ABAP Source code to your local directory . Before downloading just create " :\source " directory.
Hope this info Helps YOU.
<i>Reward Points If It Helps YOU.</i>
Regards,
Raghav
[code]*
Download and Upload your ABAP program from/to your local harddisk.
Allows individual or mass transfering of ABAP program.
Before using, create a folder c:\Source
REPORT ZDOWN_UP_LOAD
        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:\Source\'.
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-LINE = MTAB_PROGRAM_TEXTS-ENTRY .
       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 serve
     OPEN DATASET F_FILENAME FOR OUTPUT IN TEXT MODE encoding default.
     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 encoding default.
     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-key = FTAB_PROGRAM_FILE-line.
             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
*TEXPZKBPROGS
IDIR     File Download Options (File Selection)
IFIL     File Options
IFNA     Enter filename below (under File Options)
IH01     Prog Name
IH03     Program Description
ISNG     Upload a single file
IUDL     Upload to SAP/Download from SAP
IUPL     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
*HEADZKBPROGS
DOKU      ZHRBDC54
*DOKLZKBPROGS
*--- End of Program[/code]

Similar Messages

  • Unable to update this object because the following attributes associated with this object have values that may already be associated with another object in your local directory services

    Getting this error from DirSync
    Unable to update this object because the following attributes associated with this object have values that may already be associated with another object in your local directory services: [UserPrincipalName
    [email protected];].  Correct or remove the duplicate values in your local directory.  Please refer to
    http://support.microsoft.com/kb/2647098 for more information on identifying objects with duplicate attribute values.
    Quick eyeball and couldn't see the cause in the user account so used the script here:
    http://gallery.technet.microsoft.com/office/Fix-Duplicate-User-d92215ef
    And got these outputs:
    PS C:\Windows\System32\WindowsPowerShell\v1.0> Export-OSCADUserPrincipalName -UserPrincipalName "[email protected]" -Path .\outputs.csv
    WARNING: Cannot find objects with specified duplicate user principal name
    [email protected]
    Found 0 user(s) with duplicate user principal name.
    Where to from here?
    Richard P

    Hi,
    Did you talk about the Microsoft Azure Active Directory Sync tool ?
    If yes, this issue occurs if one or more of the following conditions are true:
    An object in the on-premises Active Directory has an SMTP address that's the same as the SMTP address of the object that's reporting the problem.
    An object in the on-premises Active Directory has a mail attribute that's identical to the object that's reporting the problem.
    An object already exists in your organizational account and has the same SMTP address or mail attribute as the object in the on-premises Active Directory
    More detail information, please refer to:
    http://support.microsoft.com/kb/2520976/en-us
    [Troubleshooting] Unable to update this object because the following attributes associated with this object
    http://blogs.technet.com/b/aadsyncsupport/archive/2014/05/20/troubleshooting-unable-to-update-this-object-because-the-following-attributes-associated-with-this-object.aspx
    Regards.
    Vivian Wang

  • Download/upload abap objects to/from local PC

    Hi all,
            I need to download objects of a tcode (like includes, reports etc) on to PC and  upload it to different server. Can anybody please send me the programs to upload and download objects.
    Thanks in Advance

    REPORT ZUPDOWNPROGRAMS LINE-SIZE 132 LINE-COUNT 62 NO STANDARD PAGE HEADING.
      This program up / downloads from / to a local dataset
      all the components of an ABAP - i.e TEXTS, the entire CUA
      including statuses and menus, DYNPROS and source code.
      Program documentation and variants are not handled.
      INCLUDED programs are automatically handled both on upload
      or download. INCLUDE selection can be excluded or generic
      e.g only handle INCLUDES starting with ZIN*
      INCLUDES within INCLUDES also handled.
      The only restriction is on UPLOAD the INCLUDED programs must come
      from the same directory as the main program.
      On Download of course the ABAP must exist in the library.
         Note for LINUX and BATCH users
      This program was originally designed as a one off tool for
      getting ABAPS etc from a SAP R2 (IBM MVS mainframe system) into
      an R3 test system minimising the need for a large amount of
      mainframe sysprogs (anybody remember what they were !!) time
      and support to say nothing of access problems from TSO /JES2 /
      SAP R2. At that time network connections were patchy and the
      transport systems largely incompatable and not very reliable.
      This program was originally designed as a one off tool for
      Must run on Windows front end ---- If you are running SAP with
      LINUX on your work station you will have to change the WS_UPLOAD
      and WS_DOWNLOAD functions to reflect the Linux file system. The
      contents of the data sets themseleves do not need to be changed
      Program can easily be modified to run in batch and store
      the data on a UNIX host. Change the WS_UPLOAD and WS_DOWNLOAD
      to read from and write to UNIX data sets (OPEN FILE etc).
      You will also need to modify the parts of the program that get
      the DOS directory and display the Windows file paths.
      The actual abap data sets do not need to be changed.
    Rel 4.0   names can now be up to 40 bytes long
              Dynpros and CUA have changed from rel 3.1
              Tabstrips now loaded and unloaded in dynpros
       Please note restriction on 4.6 systems for users who
       have ABAP names which include '/'s in their names.
    Rel 4.6b, 4.6c Abap names can include the '/' in their names
    e.g /CUST1/CUST2/ORDER
    This causes problems when storing to a local file.
    a solution is to change the name to %CUST1%CUST2%ORDER i.e / will
    be changed to %. On upload the % should be changed back to /
    again.    This change still needs to be implemented.
    If you don't use the / in the abap name then this is not a problem.
    If file to be uploaded is in rel 3 format then names are only 8
    bytes long.
      program uses 3 datasets per abap
         1) abapname.eee     source, dynpr logic, texts, CUA stuff
         2) abapname.hhh     dynpr header
         3) abapname.fff     dynpro fields.
    because of varying lengths and contents 3 data sets are used. The
    complexity of combining all these to 1 data set would make the
    program far too complex.
      NOTE: This version of the program can only be used on
            release 4.0 or higher. Once an ABAP has been converted
            to rel 4.0 it cannot be converted back to rel 3.0
            on a release 3/3.1 system. Release 4 CUA tables
            are different.  Use release 3 version of this program
           for releases 3.0 and 3.1. Available on SAPFANS website.
      Note that data to be uploaded must have been previously downloaded
      by this program (any version since rel 2.0) - except for Initial
      Load -- see end of these comments.
             Dynpros and CUA statuses have changed since rel 3.1
       This program will handle rel 3.1 format on upload but will
       download in rel 4.0 format. To upload 3.1 format specify an 'X'
       in the rel3 parameter.
       If you have downloaded components in rel 4.0 format and you
       want to re-load to a 3.1 system  you will have to load
       the source via standard upload and re-create dynpros and the CUA
       manually.
       As names can now be longer than 8 characters you can only
       use this program if the SAP front end (SAPGUI) supports
       long file names (WIN 95/98 or WIN NT). Windows 3.x will not
       work as the underlying DOS system cannot handle long file names.
          UPLOAD function and DOS directory.
    When an ABAP is selected for UPLOAD then the DOS
    directory is read into a table. A file called ABAP.BAT is created,
    and down loaded to the 'C' drive and executed.
    This file executes a DOS DIR command and pipes the output
    into a dataset which is then uploaded into an internal
    table on SAP.
    Note on running DOS commands from ABAP
    The first time this procedure is executed you will see a DOS window
    which you will have to close manually. To get round this
    use windows explorer to select the file ABAP.BAT and then
    right mouse click on the file name. Select the
    properties window. From this click the CLOSE on EXIT box. This
    will then automatically close the DOS function after it has
    executed. (Windows restriction).
    The DOS function has not been tested using Windows 2000 so
    it might not work. OK on W95,W98,WME and Windows NT (No Thanks)
    If INCLUDE programs are wanted on UPLOAD only the specified
    directory is searched.
    Instead of entering path name manually you can click on
    the path parameter. Because of Windows restriction you will
    have to select ANY file in the relevant directory.
    The path will then be copied on to the selection screen.
    To do still : Merge 3 files to one and compress output to .ZIP file
                   fix 4.5 4.6 problem of abaps containing '/' in the name
                   possibility to automatically up / download referenced
                   function modules with selection criteria like INCLUDES
    To load the ist time into a system.
    Create program with ABAP editor and Upload the .EEE file.
    Delete ist line  (????SRCE) in the ABAP EDITOR --NOT THE DISK FILE
    Delete all the source from the line that starts ????TEXT (towards
    the end file) till the end so the last line in your source is ENDFORM.
    DO NOT ALTER THE DISK FILE. DO THESE CHANGES IN THE ABAP EDITOR.
    Save file and execute
    Use following parameters (Note the ist time you won't get proper
    text on the selection screen).
    Function      U
    Path          full dos path containing source e.g c:\abaps\
                   NOTE YOU MUST ENTER THE FINAL \ as above.
    REPID         the program name. e.g ZZJIMHXX
                   note that on the DISK you will see 3 files
                   ZZJIMHXX.EEE, ZZJIMHXX.FFF, ZZJIMHXX.HHH
                   just use the name before the dos qualifier - the
                   program will do the rest
    ignore other parameters
    The program will then load itself with all the texts etc.
    It should now be ready for use.
      Macros
    DEFINE DEFINE_TABLE.
      DATA: &1 LIKE &2 OCCURS &3 WITH HEADER LINE.
    END-OF-DEFINITION.
    DEFINE CLS.
      REFRESH &1.
      CLEAR &1.
    END-OF-DEFINITION.
    DEFINE INIT.
      IF &1 NE SPACE.
        SEARCH &1 FOR '. .'.
        IF SY-SUBRC = 0.
          WRITE '*' TO &1+SY-FDPOS(1).
        ENDIF.
        TRANSLATE &1 USING '*%'.
      ELSE.
        MOVE '%' TO &1.
      ENDIF.
    END-OF-DEFINITION.
    end of macros
    /     SAP standard tables                                        */
    TABLES: D020S,                         "Dynpro header
            D020T,                         "Dynpro title
            D021T,                         "Screen field keyword texts
            TRDIR,                         "Attribute table
            TADIR,                         "Dev. class etc.
            EUDB,                          "CUA data
            TSTC,                          "transaction data
            TITLE,                         "CUA titles
            RSMPTEXTS.                     "Function texts (rel 4.0)
    /     Work tables to hold ABAP source etc, and dynpro            */
    /     contents.                                                  */
    DATA: BEGIN OF H.                      "Header
            INCLUDE STRUCTURE D020S.
    DATA: END OF H.
    DATA: BEGIN OF H1 OCCURS 10,           "Header
          NAME(40)               TYPE C,                        "rel 4
          NUMBER(4)              TYPE N.
            INCLUDE STRUCTURE D020S.
    DATA: END OF H1.
    DATA: BEGIN OF H2 OCCURS 0,            "Rel 3  dynp. header
            CNAME(8)   TYPE C,
            CNUM(4)    TYPE C,
            NNAME(8)   TYPE C,
            NNUM(4)    TYPE C,
            FILL(51)   TYPE C,
            CDAT(6)    TYPE C,
            CTIM(6)    TYPE C,
          END OF H2.
    DATA: BEGIN OF F OCCURS 250.           "Dynpro Fields
            INCLUDE STRUCTURE D021S.
    DATA: END OF F.
    DATA: BEGIN OF F1 OCCURS 500,          "Dynpro Fields
          NAME(40)               TYPE C,                        "rel 4
          NUMBER(4)              TYPE N.
            INCLUDE STRUCTURE D021S.
    DATA: END OF F1.
    DATA: BEGIN OF OLD_F1 OCCURS 0,        "Dynpro Fields (rel 3)
          NAME(8)    TYPE C,
          NUMBER(4)     TYPE C.
            INCLUDE STRUCTURE D021SE_OLD.
    DATA: END OF OLD_F1.
    DATA: BEGIN OF F2 OCCURS 0,            "Dynpro Fields (rel 3)
          TFIL(284)  TYPE C,
          END OF F2.
    DATA: BEGIN OF M OCCURS 3.             "Match codes (if any)
            INCLUDE STRUCTURE D023S.
    DATA: END OF M.
    DATA: BEGIN OF E OCCURS 0.             "Dynpro Logic
            INCLUDE STRUCTURE D022S.
    DATA: END OF E.
    DATA: BEGIN OF E1 OCCURS 0,            "Dynpro Logic
          NAME(40)               TYPE C,                        "rel 4
          NUMBER(4)              TYPE N.
            INCLUDE STRUCTURE D022S.
    DATA: END OF E1.
    DATA: BEGIN OF T   OCCURS 0,           "prog name and dynpro nrs
          NAME(40)     TYPE C,                                  "rel 4
          NUMBER(4)    TYPE N,
    END OF T.
    DATA: BEGIN OF R   OCCURS 56,          "prog name and language
          NAME(40)     TYPE C,                                  "rel 4
          LANGUAGE(1)  TYPE C,
       END OF R.
    DATA: BEGIN OF S OCCURS 3000,
          TXT(180)               TYPE C,   "rel 4   was 132
          END OF S.
    DATA: BEGIN OF R1 OCCURS 50,           "for include programs
            NAME(40)             TYPE C,                        "rel 4
            INSTANCE(3)          TYPE P,
          END OF R1.
    DATA: BEGIN OF S1 OCCURS 3000,
          TXT(180)               TYPE C,   "   rel 4  was 132
          END OF S1.
    DATA: BEGIN OF U OCCURS 100,           "Text elements
          TXT(180)               TYPE C,   " rel 4   was 132
          END OF U.
    DATA: BEGIN OF DIR.                    "ABAP Attributes
            INCLUDE STRUCTURE TRDIR.
    DATA: END OF DIR.
    DATA: BEGIN OF DTXT.                   "Dynpro field keyword texts
            INCLUDE STRUCTURE D021T.
    DATA: END OF DTXT.
    /     This data contains all the components of the               */
    /     CUA such as menus, statuses, Pfkeys                        */
    /     As from rel 4.5 Tabstrips are automatically copied as well */
    /     The rel3 parameter must be set however to load the         */
    /     correct version of the CUA tables if uploading rel 3       */
    /     data to a rel 4 system.                                    */
    /     Rel 4.0B can  convert 3.1 and earlier CUA's                */
    /     This could change later however.                           */
    CUA Tables.
    Key of CUA tables in EUDB data set. Name is len 40 in rel 4.0
    DATA BEGIN OF EU_KEY.
            INCLUDE STRUCTURE RSEU1_KEY.
    DATA END OF EU_KEY.
        Status
    DATA BEGIN OF STA OCCURS 0.
            INCLUDE STRUCTURE RSMPE_STAT.                       " rel 4
    DATA END OF STA.
        Functions
    DATA BEGIN OF FUN OCCURS 0.
            INCLUDE STRUCTURE RSMPE_FUNT.                       "rel 4
    DATA END OF FUN.
        Menus
    DATA BEGIN OF MEN OCCURS 0.
            INCLUDE STRUCTURE RSMPE_MEN.   "rel 4.0
    DATA END OF MEN.
        Menus (texts)
    DATA BEGIN OF MTX OCCURS 0.
            INCLUDE STRUCTURE RSMPE_MNLT.  "rel 4.0
    DATA END OF MTX.
        Action Bar
    DATA BEGIN OF ACT OCCURS 0.
            INCLUDE STRUCTURE RSMPE_ACT.   "rel 4.0
    DATA END OF ACT.
        Push Buttons
    DATA BEGIN OF BUT OCCURS 0.
            INCLUDE STRUCTURE RSMPE_BUT.   "rel 4.0
    DATA END OF BUT.
        PF-Keys
    DATA BEGIN OF PFK OCCURS 0.
            INCLUDE STRUCTURE RSMPE_PFK.   "rel 4.0
    DATA END OF PFK.
        Function sets
    DATA BEGIN OF SET OCCURS 0.
            INCLUDE STRUCTURE RSMPE_STAF.  "rel 4.0
    DATA END OF SET.
        Documentation
    DATA BEGIN OF DOC OCCURS 0.
            INCLUDE STRUCTURE RSMPE_ATRT.  "rel 4.0
    DATA END OF DOC.
        Title codes with text
    DATA: BEGIN OF TIT OCCURS 0.
            INCLUDE STRUCTURE RSMPE_TITT.  "rel 4.0
    DATA: END OF TIT.
    DATA BEGIN OF FTX OCCURS 0.            "rel 4.0
            INCLUDE STRUCTURE RSMPTEXTS.
    DATA END OF FTX.
           rel 3.1 CUA components.
        Status
    DATA BEGIN OF OLD_STA OCCURS 0.
            INCLUDE STRUCTURE RSEU1_GEN.   " rel 3.1
    DATA END OF OLD_STA.
        Functions
    DATA BEGIN OF OLD_FUN OCCURS 0.
            INCLUDE STRUCTURE RSEU1_FUN.   "rel 3.1
    DATA END OF OLD_FUN.
        Menus
    DATA BEGIN OF OLD_MEN OCCURS 0.
            INCLUDE STRUCTURE RSEU1_MEN.   "rel 3.1
    DATA END OF OLD_MEN.
        Menus (texts)
    DATA BEGIN OF OLD_MTX OCCURS 0.
            INCLUDE STRUCTURE RSEU1_TXM.   "rel 3.1
    DATA END OF OLD_MTX.
        Action Bar
    DATA BEGIN OF OLD_ACT OCCURS 0.
            INCLUDE STRUCTURE RSEU1_ACT.   "rel 3.1
    DATA END OF OLD_ACT.
        Push Buttons
    DATA BEGIN OF OLD_BUT OCCURS 0.
            INCLUDE STRUCTURE RSEU1_BUT.   "rel 3.1
    DATA END OF OLD_BUT.
        PF-Keys
    DATA BEGIN OF OLD_PFK OCCURS 0.
            INCLUDE STRUCTURE RSEU1_PFK.   "rel 3.1
    DATA END OF OLD_PFK.
        Function sets
    DATA BEGIN OF OLD_SET OCCURS 0.
            INCLUDE STRUCTURE RSEU1_SET.   "rel 3.1
    DATA END OF OLD_SET.
        Documentation
    DATA BEGIN OF OLD_DOC OCCURS 0.
            INCLUDE STRUCTURE RSEU1_ETM.   "rel 3.1
    DATA END OF OLD_DOC.
        Title codes with text
    DATA: BEGIN OF OLD_TIT OCCURS 0.
            INCLUDE STRUCTURE TITLE.       "rel 3.1
    DATA: END OF OLD_TIT.
    dynamic function text
    DATA BEGIN OF FDN OCCURS 1.
            INCLUDE STRUCTURE RSEU1_FDYN.  "not req for rel 4.
    DATA END OF FDN.
    Icons
    DATA BEGIN OF FIN OCCURS 1.
            INCLUDE STRUCTURE RSEU1_ICON.  "not req for rel 4
    DATA END OF FIN.
    dynamic menu texts
    DATA BEGIN OF MDN OCCURS 1.
            INCLUDE STRUCTURE RSEU1_MDYN.  "not req for rel 4.
    DATA END OF MDN.
        Symbol list
    DATA BEGIN OF SYM OCCURS 0.
            INCLUDE STRUCTURE RSEU1_SYMB.
    DATA END OF SYM.
        Status Short text
    DATA BEGIN OF STX OCCURS 0.
            INCLUDE STRUCTURE RSEU1_CTX.
    DATA END OF STX.
        Attributes for function key settings (menu bars)  Rel 3.0
    DATA BEGIN OF ATT OCCURS 0.
            INCLUDE STRUCTURE RSEU1_HAT.
    DATA END OF ATT.
        Include-Menus
    DATA BEGIN OF INC OCCURS 3.
            INCLUDE STRUCTURE RSEU1_INC.
    DATA END OF INC.
    Last used numbers
    DATA BEGIN OF LAST.
            INCLUDE STRUCTURE RSEU1_LST.
    DATA END OF LAST.
      data for call transaction (SE41 to re-generate the CUA)
    DATA: BEGIN OF T_BDC_TAB OCCURS 0.
            INCLUDE STRUCTURE BDCDATA.     "BDC data
    DATA: END OF T_BDC_TAB.
    DATA: BEGIN OF T_MESSTAB OCCURS 0.
            INCLUDE STRUCTURE BDCDATA.
    DATA: END OF T_MESSTAB.
    /     Program data                                               */
    DATA: NUMBER(4)               TYPE N,
          OLDNUM(4)               TYPE N,
          FILESIZE                TYPE I,
          NR_OF_BYTES             TYPE I,
          I(3)                    TYPE P,
          IX(3)                   TYPE P,
          J(3)                    TYPE P,
          L(3)                    TYPE P,
          CUA-FLAG(1)             TYPE C,
          CUA_RETURN(10)          TYPE C,
          DYNPRO_MESSAGE(160)     TYPE C,
          DYNPRO_LINE             TYPE P,
          DYNPRO_WORD(30)         TYPE C,
          NUM(3)                  TYPE N,
          DYNNAME(44)             TYPE C,
          FN1(128)                TYPE C,
          FN2(128)                TYPE C,
          FN3(128)                TYPE C,
          W_ITERATE(1)            TYPE C,
          MAIN(1)                 TYPE C,
          FUNC(1)                 TYPE C,
          OLDNAME(40)             TYPE C,
          OLD-FUNC(8)             TYPE C,
          NEW-FUNC(8)             TYPE C,
          FOUND(1)                TYPE C,
          LANGUAGE                LIKE SY-LANGU,
          FIRST-TIME(1)           TYPE C VALUE 'Y',
          OK-CODE(5)              TYPE C,
          NAME(40)                TYPE C,                       "rel 4
          TXLINE(70)              TYPE C,
          LINE(132)               TYPE C.
    DATA:
          UL_FILE(128)          TYPE C,
          DL_FILE(128)          TYPE C,
          DOSLINE(72)           TYPE C.
    DATA: BEGIN OF DOSDIR OCCURS 0,
            TEXT(72),
          END OF DOSDIR.
    DATA: BEGIN OF I_PROG OCCURS 0,
          NAME(40),
          END OF I_PROG.
    DATA: BEGIN OF I_PROGT OCCURS 0,
          NAME(40),
          END OF I_PROGT.
    DATA: BEGIN OF I_INCLUDE OCCURS 0,
          NAME(40),
          HANDLED(1)   TYPE C,
          END OF I_INCLUDE.
    DATA: BEGIN OF I_INCL OCCURS 0,
          NAME(40),
          END OF I_INCL.
    DATA: BUFFER(1024).
    DATA: WINSYS(3).
    DATA: GLOBAL_FILEMASK_MASK(20), GLOBAL_FILEMASK_TEXT(20).
    DATA: GLOBAL_FILEMASK_ALL(80).
    DATA: T_FILENAME(128),
          TMP_FILENAME(128),
          T_MODE(1),
          FIELDLN     TYPE I.
    DEFINE_TABLE I_DYNPFIELDS DYNPREAD 0.  "dynpro fields to be updated
    DATA: I_FLDS LIKE HELP_VALUE OCCURS 0 WITH HEADER LINE.
    FIELD-SYMBOLS: <F>.
    /     Parameters                                                 */
    SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS REPID FOR TRDIR-NAME OBLIGATORY .
    PARAMETERS:
          FUNCTION(1)       TYPE C OBLIGATORY,  "Function
          DSNAME(40)        TYPE C,        "Data set name
          INCLUDES(1)       TYPE C DEFAULT 'N', "Resolve Includes
          IMASK(40)         TYPE C,        "Include Mask
          CLASS             LIKE TRDIR-CLAS,
          AUTHOR            LIKE TRDIR-CNAM,          "Author
          APPL              LIKE TRDIR-APPL,
          PATH(88)          TYPE C DEFAULT 'A:\',
          REL3(1)           TYPE C.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(70) TEXT-004.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(70) TEXT-005.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(70) TEXT-002.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(70) TEXT-003.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END  OF BLOCK A1.
    /          Check users workstation is running WINDOWS,        */
    /          WINDOWS 95, or WINDOWS NT. OS/2 no good for        */
    /          this application.                                  */
    CALL FUNCTION 'WS_QUERY'
         EXPORTING
              QUERY  = 'WS'
         IMPORTING
              RETURN = WINSYS.
    IF WINSYS(2) NE 'WN'.                  "Win 3.X no good either
      WRITE: / 'Windows NT or Windows 95/98 is required'.
      EXIT.
    ENDIF.
    /          Get names of programs to be handled.               */
    /          Name can be a single value, many values or ranges  */
    /          as per standard SELECT-OPTIONS on selection screen */
    / On Download read TRDIR and store program names in a table   */
    / as per selection options.                                   */
    / On upload read the specified directory for all files of     */
    /  type .EEE from specified directory                         */
    /  compare file names with selection criteria                 */
    MOVE FUNCTION TO FUNC.
    MOVE 'Y' TO MAIN.
    CASE FUNC.
      WHEN 'U'.                            "Upload required
        PERFORM READ_DOS_DIRECTORY.
        PERFORM GET_RANGE_UL.              "Get list of progs to process
      WHEN 'D'.                            "Download required
        PERFORM GET_RANGE_DL.              "Get list of progs to process
      WHEN OTHERS.
        WRITE: / 'Function not performed due to user request'.
        EXIT.
    ENDCASE.
    SORT I_PROG.
    DELETE ADJACENT DUPLICATES FROM I_PROG.
    For download INCLUDE handling can be resolved via function
    module call.
    All Includes within Includes are also resolved by the function
    module call.
    Note that this method does not work if program itself is of type
    I (it's an include)
    In this case we can still search the source.
    IF FUNC = 'D'.
      IF INCLUDES = 'Y'.
        PERFORM GET_INCLUDES_DL.
        PERFORM PROCESS_INCLUDES_DL.
      ENDIF.
    ENDIF.
    Program list from selection criteria i.e excluding INCLUDES found
    LOOP AT I_PROG.
      MOVE I_PROG-NAME TO R1-NAME.
      APPEND R1.
      DESCRIBE TABLE R1 LINES I.
      WHILE I NE 0.
        PERFORM EXECUTE-FUNCTION.
      ENDWHILE.
      REFRESH R1.
    ENDLOOP.
    We need to check now for INCLUDES on DOWNLOAD when the INCLUDE
    program itself is of type I. In this case the function call
    will not return the INCLUDES. For example we could be
    downloading ZTESTTOP (an Include itself) which as an include
    ZTEST01.
    The process fortunately is the same as the UPLOAD function
    except of course we need to read the library instead of the
    DOS directory
    process INCLUDE modules for Upload
    On upload the procedure is more complex as Includes within
    Includes can only be resolved by scanning the code and
    searching if the program exists in the directory.
    To get all INCLUDES within INCLUDES entries in table I_INCL
    that do not exist in I_INCLUDE are copied to table I_INCLUDE
    after each entire pass of table i_INCLUDE and table is then
    re-looped through. Programs in table I_INCLUDE that have already
    been processed have a "Y" indicator set in I_INCLUDE-AVAIL.
    if  func = 'U'.
    IF INCLUDES = 'Y'.
      DESCRIBE TABLE I_INCL LINES I.
      IF I > 0.
        W_ITERATE = 'Y'.
      ELSE.
        W_ITERATE = ' '.
      ENDIF.
      WHILE W_ITERATE = 'Y'.
        PERFORM PROCESS_INCLUDES_UL.
        PERFORM LOOP_THROUGH.
        DESCRIBE TABLE I_INCL LINES I.
        IF I > 0.
          W_ITERATE = 'Y'.
        ELSE.
          W_ITERATE = ' '.
        ENDIF.
      ENDWHILE.
    endif.
    ENDIF.
    DESCRIBE TABLE I_INCLUDE LINES I.
    IF I > 0.
      SKIP 1.
      WRITE: / ' Included Programs found'.
      SKIP 1.
      LOOP AT I_INCLUDE.
        WRITE I_INCLUDE-NAME TO LINE(40).
        CONDENSE LINE.
        WRITE: / LINE(80).
      ENDLOOP.
    ENDIF.
    /       Table R contains ABAP names to up / download.            */
    /       Loop through table R and perform up / download           */
    /       for each program.                                        */
    /       Table R1 contains INCLUDE names found (if any)           */
    /       As each                                                  */
    FORM EXECUTE-FUNCTION.
      LOOP AT R1.
        MOVE-CORRESPONDING R1 TO R.
        APPEND R.
      ENDLOOP.
      REFRESH R1.
      LOOP AT R.
        REFRESH : T, E1, H1, F1, S, U.
        PERFORM PROCESS.
        MOVE 'N' TO MAIN.
      ENDLOOP.
      REFRESH R.
      DESCRIBE TABLE R1 LINES I.
    ENDFORM.
    /     Build file names for UP/DOWNLOAD                           */
    /     3 files are generated per ABAP.                            */
    /       1) ABAP    Path\PROGNAME.EEE (ABAP, Attr,Texts)          */
    /          Logic   Path\PROGNAME.EEE (Dynpro Source Logic)       */
    /          CUA     Path\PROGNAME.EEE (CUA components - keys etc) */
    /       2) Header  Path\PROGNAME.HHH (Dynpro Header)             */
    /       3) Fields  Path\PROGNAME.FFF (Dynpro Field definitions  )*/
    / ( If alternate file name specified -DSNAME- this will          */
    /   be used instead. This is only valid for the main program.    */
    /   INCLUDED programs will have file names as specified          */
    /   above).                                                      */
    /  By using this scheme it saves the user from having to         */
    /  be prompted for 3 file names.                                 */
    /  If you want multiple copies / versions on disk either         */
    /  rename the old versions or specify a different directory in   */
    /  the path parameter.                                           */
    FORM PROCESS.
      MOVE PATH TO FN1.
      CASE MAIN.
        WHEN 'Y'.
          IF DSNAME NE SPACE.
            WRITE DSNAME TO FN1+66.                             "rel 4
          ELSE.
            WRITE R-NAME TO FN1+66.                             "rel 4
          ENDIF.
        WHEN OTHERS.
          WRITE R-NAME TO FN1+66.                               "rel 4
      ENDCASE.
      MOVE FN1 TO FN2.
      MOVE FN1 TO FN3.
      WRITE '.HHH' TO FN1+124(4).                               "rel 4
      WRITE '.FFF' TO FN2+124(4).                               "rel 4
      WRITE '.EEE' TO FN3+124(4).                               "rel 4
      CONDENSE FN1 NO-GAPS.
      CONDENSE FN2 NO-GAPS.
      CONDENSE FN3 NO-GAPS.
      NAME   = R-NAME.
      CASE FUNC.
        WHEN 'D'.
          PERFORM DOWNLOAD_OBJECTS.
          CLEAR LINE.
          WRITE : 'ABAP : ' TO LINE.
          WRITE R-NAME TO LINE+8.
          WRITE 'has been unloaded' TO LINE+55.
          CONDENSE LINE.
          WRITE: / LINE.
          DESCRIBE TABLE T LINES I.
          IF I = 0.
            WRITE: / 'No Dynpros were found for unload function'.
          ELSE.
            WRITE: / 'The following Dynpros have been unloaded : '.
            PERFORM LOOP_THROUGH_T.
          ENDIF.
        WHEN 'U'.
          PERFORM UPLOAD_OBJECTS.
          DESCRIBE TABLE T LINES I.
          CASE I.
            WHEN 0.
              WRITE:  / 'No Dynpros were found for restore function'.
            WHEN OTHERS.
              WRITE: / 'The following Dynpros have been restored : '.
              PERFORM LOOP_THROUGH_T.
          ENDCASE.
          IF MAIN EQ 'Y'.
            CASE OLDNAME.
              WHEN SPACE.
                CLEAR LINE.
                WRITE : 'ABAP : ' TO LINE.
                WRITE R-NAME TO LINE+8.
                WRITE 'has been restored' TO LINE+55.
                CONDENSE LINE.
                WRITE: / LINE.
              WHEN OTHERS.
                CLEAR LINE.
                WRITE : 'ABAP : ' TO LINE.
                WRITE R-NAME TO LINE+8.
                WRITE 'has been restored - original name :'
                   TO LINE+55.
                WRITE OLDNAME TO LINE+92.
                CONDENSE LINE.
                WRITE: / LINE.
            ENDCASE.
          ELSE.
            CLEAR LINE.
            WRITE : 'ABAP : ' TO LINE.
            WRITE R-NAME TO LINE+8.
            WRITE 'has been restored' TO LINE+55.
            CONDENSE LINE.
            WRITE: / LINE.
          ENDIF.
      ENDCASE.
    ENDFORM.
    /      print progname + dynpro nrs that have been processed.     */
    FORM LOOP_THROUGH_T.
      LOOP AT T.
        CLEAR LINE.
        WRITE R-NAME TO LINE.
        WRITE T-NUMBER TO LINE+50.
        CONDENSE LINE.
        WRITE: / LINE.
      ENDLOOP.
    ENDFORM.
    /            Download Objects                                    */
    FORM DOWNLOAD_OBJECTS.
      PERFORM UNLOAD_ABAP.                 "ABAP source, texts, attr
      SELECT SINGLE * FROM TRDIR
       WHERE NAME EQ R-NAME.
      IF TRDIR-SUBC = 'I'.
        CASE INCLUDES.                     "Included file wanted
          WHEN 'Y'.
            PERFORM SCAN4-INCLUDES.
        ENDCASE.
      ENDIF.
      PERFORM UNLOAD_CUA.                  "CUA stuff
      PERFORM DOWNLOAD_DATA.               "Download EEE file to PC
      PERFORM BUILD_T.        "Build table of all dynpros in ABAP
      DESCRIBE TABLE T LINES I.
      CASE I.
        WHEN 0.            "if no dynpros exist then cannot download any
          PERFORM DOWNLOAD_DATA.           "Download EEE file to PC
        WHEN OTHERS.
          PERFORM UNLOAD_DYNPROS.          "Get Raw dynpros from SAP
          PERFORM UNLOAD_DYNPRO_COMPONENTS."Convert to table
          PERFORM DOWNLOAD_DATA.           "Download ABAP etc. to PC
          PERFORM DOWNLOAD_BIN_H1.         "Download dynpro header
          PERFORM DOWNLOAD_BIN_F1.         "Download dynpro fields
      ENDCASE.
    ENDFORM.
    /  Split ABAP up into its component parts                        */
    /                           A) Program source (72)               */
    /                           B) Texts          (132)              */
    /                           C) Attributes     (117)              */
    /                           D) CUA stuff      (Various)          */
    FORM UNLOAD_ABAP.
    /    Get ABAP language. Only required on download.               */
      SELECT SINGLE * FROM TRDIR
        WHERE NAME EQ R-NAME.
      MOVE TRDIR-RLOAD TO R-LANGUAGE.
      READ REPORT R-NAME INTO S.           "Get source into table S
      MOVE '????SRCE' TO S-TXT.
      INSERT  S INDEX 1.
    /    Text elements, Numbered texts, headings, selection texts    */
    /    Read text elements with logon language. If they don't       */
    /    exist read with the value taken from TRDIR.                 */
      READ TEXTPOOL R-NAME INTO U LANGUAGE SY-LANGU.
      IF SY-SUBRC NE 0.
        READ TEXTPOOL R-NAME INTO U LANGUAGE R-LANGUAGE.
      ENDIF.
      DESCRIBE TABLE U LINES I.
      CASE I.
        WHEN 0.
        WHEN OTHERS.
          MOVE '????TEXT' TO S-TXT.
          APPEND S.
          LOOP AT U.
            MOVE U-TXT TO S-TXT.
            APPEND S.
            DELETE U.
          ENDLOOP.
      ENDCASE.
    /    Retrieve Attributes from TRDIR and add to table S           */
    /    Change language to logged on language                       */
      MOVE '????ATTR' TO S-TXT.
      APPEND S.
      SELECT SINGLE * FROM TRDIR
             WHERE NAME EQ R-NAME.
      MOVE SY-LANGU TO TRDIR-RLOAD.
      MOVE-CORRESPONDING TRDIR TO DIR.
      MOVE DIR TO S-TXT.
      APPEND S.
    ENDFORM.
    /             retrieve CUA stuff and append to table S.          */
    FORM UNLOAD_CUA.
      MOVE R-NAME TO EU_KEY-NAME.          "Program name for CUA
      MOVE 'D' TO EU_KEY-SPRSL.            "CUA seems to want D as lang
    MOVE R-LANGUAGE TO EU_KEY-SPRSL.     "Language              "rel 2.2
    IMPORT STA FUN MEN MTX ACT BUT PFK SET LAST INC STX DOC    "rel 2.2
      IMPORT STA STX FUN MEN MTX ACT BUT PFK SET LAST INC DOC     "rel 3.0
             ATT FDN MDN SYM FIN           "rel 3.0
              FROM DATABASE EUDB(CU) ID EU_KEY.
      IF SY-SUBRC NE 0.                    "No statuses
        EXIT.
      ENDIF.
    read titles in logged on language. If not present use
    language from TRDIR.
      CASE REL3.
        WHEN SPACE.                        "(rel 4)
          SELECT * FROM RSMPTEXTS WHERE PROGNAME EQ R-NAME
                            AND SPRSL = SY-LANGU.
            MOVE-CORRESPONDING RSMPTEXTS TO FTX.
            APPEND FTX.
          ENDSELECT.
          IF SY-SUBRC NE 0.
            SELECT * FROM RSMPTEXTS WHERE PROGNAME EQ R-NAME
                              AND SPRSL = R-LANGUAGE.
              MOVE-CORRESPONDING RSMPTEXTS TO FTX.
              APPEND FTX.
            ENDSELECT.
          ENDIF.
          DESCRIBE TABLE FTX LINES I.
          IF   I > 0.
            MOVE '????FTXT' TO S-TXT.
            APPEND S.
            LOOP AT FTX.
              MOVE FTX TO S-TXT.
              APPEND S.
            ENDLOOP.
          ENDIF.
        WHEN OTHERS.
          SELECT * FROM TITLE WHERE PROGNAME   EQ R-NAME
                              AND   DDLANGUAGE EQ SY-LANGU.
            MOVE-CORRESPONDING TITLE TO TIT.
            APPEND TIT.
          ENDSELECT.
          IF SY-SUBRC NE 0.
            SELECT * FROM TITLE WHERE PROGNAME   EQ R-NAME
                                AND   DDLANGUAGE EQ R-LANGUAGE.
              MOVE-CORRESPONDING TITLE TO TIT.
              APPEND TIT.
            ENDSELECT.
          ENDIF.
      ENDCASE.
      DESCRIBE TABLE STA LINES I.
      IF   I > 0.
        MOVE '????STAT' TO S-TXT.
        APPEND S.
        LOOP AT STA.
          MOVE STA TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE FUN LINES I.
      IF   I > 0.
        MOVE '????FUNC' TO S-TXT.
        APPEND S.
        LOOP AT FUN.
          MOVE FUN TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE MEN LINES I.
      IF   I > 0.
        MOVE '????MEN1' TO S-TXT.
        APPEND S.
        LOOP AT MEN.
          MOVE MEN TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE MTX LINES I.
      IF   I > 0.
        MOVE '????MTX1' TO S-TXT.
        APPEND S.
        LOOP AT MTX.
          MOVE MTX TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE ACT LINES I.
      IF   I > 0.
        MOVE '????ACTN' TO S-TXT.
        APPEND S.
        LOOP AT ACT.
          MOVE ACT TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE BUT LINES I.
      IF   I > 0.
        MOVE '????BUTN' TO S-TXT.
        APPEND S.
        LOOP AT BUT.
          MOVE BUT TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE PFK LINES I.
      IF   I > 0.
        MOVE '????PFKY' TO S-TXT.
        APPEND S.
        LOOP AT PFK.
          MOVE PFK TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE SET LINES I.
      IF   I > 0.
        MOVE '????SETS' TO S-TXT.
        APPEND S.
        LOOP AT SET.
          MOVE SET TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      IF LAST NE SPACE.
        MOVE '????LIST' TO S-TXT.
        APPEND S.
        MOVE LAST TO S-TXT.
        APPEND S.
      ENDIF.
      DESCRIBE TABLE INC LINES I.
      IF   I > 0.
        MOVE '????INCL' TO S-TXT.
        APPEND S.
        LOOP AT INC.
          MOVE INC TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE STX LINES I.
      IF   I > 0.
        MOVE '????STXT' TO S-TXT.
        APPEND S.
        LOOP AT STX.
          MOVE STX TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE DOC LINES I.
      IF   I > 0.
        MOVE '????DOCN' TO S-TXT.
        APPEND S.
        LOOP AT DOC.
          MOVE DOC TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE TIT LINES I.
      IF   I > 0.
        MOVE '????TITL' TO S-TXT.
        APPEND S.
        LOOP AT TIT.
          MOVE TIT TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
    Next 5 tables are rel 3.0 specific  (ATT, FDN, MDN, SYM, FIN)
      DESCRIBE TABLE ATT LINES I.
      IF   I > 0.
        MOVE '????VATT' TO S-TXT.
        APPEND S.
        LOOP AT ATT.
          MOVE ATT TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE FDN LINES I.
      IF   I > 0.
        MOVE '????VFDN' TO S-TXT.
        APPEND S.
        LOOP AT FDN.
          MOVE FDN TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE MDN LINES I.
      IF   I > 0.
        MOVE '????VMDN' TO S-TXT.
        APPEND S.
        LOOP AT MDN.
          MOVE MDN TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE SYM LINES I.
      IF   I > 0.
        MOVE '????VSYM' TO S-TXT.
        APPEND S.
        LOOP AT SYM.
          MOVE SYM TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE FIN LINES I.
      IF   I > 0.
        MOVE '????VFIN' TO S-TXT.
        APPEND S.
        LOOP AT FIN.
          MOVE FIN TO S-TXT.
          APPEND S.
        ENDLOOP.
      ENDIF.
    ENDFORM.
    /

  • How to upload & download abap object ?

    Hi all,
    Is there any tcode in sap to upload & download any object from sap?
    Edited by: nehal patel on Mar 7, 2008 6:02 AM

    Hi,
    To my knowledge there is no Tcode.
    if the object is a report , then u can downlaod to local file.
    go to se38, and display ur report . In that u will find a green icon with arrows, Just below ur report name.
    With that icon (save locally) , u can dowanlaod to ur file.
    I dont know what you asked is regarding this......?
    Rvert back...
    Regards,
    Naveen

  • Download abap object under a tranport request.

    hi experts
                  i have a requirement, a tranport request contain any ABAP Object i don't know how many object actually it contains may be one or more just suppose it will have a report program under a  transport request , in the select-option i will enter transport request number and the path of the directery( whr i have to store the report program). now this report wiil download the report program on this path which i have given in section screen.
    could you please help me where the transport requests are stored in SAP is thr any table pls give me table name or is thr any function module to do this job.
    thanks & regards
    pardeep kumar

    Take a look at the following tables :
    E071
    E071C
    E071E
    E071K
    E071KF
    E071KFINI
    E071S
    They contain the data you are looking for.
    Hope that helps,
    Michael

  • Download abap objects by package

    Hi All
    Any one please suggest any program to download abap programs including ztables / include if any by giving development class
    Thanks
    Sekhar

    Check SAPLink add-on for ABAP. [http://code.google.com/p/saplink/]

  • Download ABAP Objects

    Hi,
    Is there a way to download dialog programs together with screen definitions same way one would do for a normal report program.
    I also would like to download table definitions.
    Scenario
    We have written some custom applications that we use for demonstration for our potential clients, all this are loaded on laptop. We need to copy on of our internal clients to the laptop and also re-upload the custom applications on the laptop. For this we need to download all the custom development/ applications to a secondary storage, do client copy then upload the custom development.
    Thank you for all your help.
    Regards,
    Kennedy.

    Don't know if you heard of [SAPLink|http://code.google.com/p/saplink/]. This application gives the possiblity to copy different kinds of objects - a full list of supported objects [here|http://code.google.com/p/saplink/wiki/pluginList].
    As for the screens you can copy them like described [here|http://erpgenie.com/abaptips/content/view/109/35/]. This however is more suitbale for copying singular programs not all custom development as you need to copy screens one by one.
    Another way of moving entire custom objects is like I described [here|http://wiki.sdn.sap.com/wiki/display/ABAP/HowtocopyRepositoryObjectsbetweennon-connectedSAPsystems]
    Regards
    Marcin

  • Download ABAP OBJECT(Smartform) based on Transport Request

    Dear Expert,
         I want to create a report on which there r two input fields on selection screen.First is transport request and second is Path of local disk on which i want to save .Now under this transport request all samrtforms which i have been made.I want to save a on given path in XML file(all settings at all).
    Please give me example for that.
    Thanks & Regard,
    Jatin Sangal

    Hi,
    Check this:
    http://it.toolbox.com/wiki/index.php/Upload/download_SAP_transport_request
    Points apreciated

  • Download ABAP Class in 46C?

    Hi,
    Anyone know a tool for downloading ABAP class method codes/ attribute definitions to a local PC file for release 46C?
    I know Direct Download, but for 46C version it's not possible to download Classes:-(
    I know that via menu Goto-> Protected/Private/Public section I can dowload the generated class, but it's not really easy for several class.
    Thanks in advance,
    Peter

    Hi,
    Got from a link
    Downloading ABAP code to your local PC
    Creating Z* test programs is a popular method for conducting tests. However, when an environment is about to get shut down, keeping your test programs becomes tricky. You have to launch se38/37/24/80, select your programs one by one, and choose system -> list -> save -> local file, or use function module WS_DOWNLOAD. This is a lengthy procedure that does not even enable you to save screens, tables, or structures.
    An ABAP program available for free download at http://www.dalestech.com/ can help you save your test programs.
    Choose home -> R/3 entreprise -> direct download entreprise 1.2
    download the .ZIP file,
    Unzip
    Cut and paste in an ABAP program
    Compile and run
    All your projects (including multiple classes, programs, function groups, screens and tables) can be saved in less than one minute.
    If you want to backup your work in order to keep a certain stable version while you are programming, it might be preferable use a tool that is already embedded in the Workbench: in se38/37/24/80, choose utilities -> versions -> generate version
    Thanks & Regards,
    Judith.

  • Alv Icon not displaying when download to local  directory

    Dear All,
    I have ALV report sent THROUGH email . When i had download the report to local directory  . I am unable to see the Icons like block  , in the report .
    Thanks,
    Sridhar

    Hi Sridhar,
    The icons are only displayed by the SAPGUI. In  the report data they are only something like @1F@... - which then is interpreted by the SAPGUI.
    When downloading the report the internal data is downloaded, but no SAPGUI will interpret them any longer (since you are not using SAPGUI to view the downloaded data).
    So in conclusion it is not possible to see those items. If you want to download the report you should avoid the usage of icons.
    Regards,
    Gerd Rother

  • FM to create a folder in local directory and then download the file...

    hi...
    can some one help me with a FM which will create the folder mentioned in the file path and then download the file.
    Ex : if file path is 'C:\Try\file.txt'.
    if the foler 'Try' is not available then it should be created and then the file should be downloaded in it.

    Hi
    Use the FM GUI_DOWNLOAD
    It will create the folder in PC if it not exist. Then Download the data .
      CONCATENATE p_path    " Directory path        
                  l_file                " File name
                  '.TXT'
            INTO  l_file_path.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = l_file_path
          filetype                = 'ASC'
        TABLES
          data_tab                = i_source[]
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.

  • 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

  • How to download ABAP(report,module pool...etc) source code to client PC?

    hi guys,
    please advise how can i download/export ABAP(report,module pool...etc) source code to client PC?
    thanks.

    hi
    this report is to export to another server...
    PROGRAM ZDOWNLOAD_SAP
    LINE-SIZE 132
    LINE-COUNT 62
    NO STANDARD PAGE HEADING.
    This program up / downloads from / to a local dataset
    all the components of an ABAP - i.e TEXTS, the entire CUA
    including statuses and menus, DYNPROS and source code.
    Program documentation and variants are not handled.
    INCLUDED programs are automatically handled both on upload
    or download. INCLUDE selection can be excluded or generic
    e.g only handle INCLUDES starting with ZIN*
    INCLUDES within INCLUDES alos handled.
    The only restriction is on UPLOAD the INCLUDED programs must come
    from the same directory as the main program.
    On Download of course the ABAP must exist in the library.
    Note for LINUX and BATCH users
    This program was originally designed as a one off tool for
    getting ABAPS etc from a SAP R2 (IBM MVS mainframe system) into
    an R3 test system minimising the need for a large amount of
    mainframe sysprogs (anybody remember what they were !!) time
    and support to say nothing of access problems from TSO /JES2 /
    SAP R2. At that time network connections were patchy and the
    transport systems largely incompatable and not very reliable.
    This program was originally designed as a one off tool for
    Must run on Windows front end ---- If you are running SAP with
    LINUX on your work station you will have to change the WS_UPLOAD
    and WS_DOWNLOAD functions to reflect the Linux file system. The
    contents of the data sets themseleves do not need to be changed
    Program can easily be modified to run in batch and store
    the data on a UNIX host. Change the WS_UPLOAD and WS_DOWNLOAD
    to read from and write to UNIX data sets (OPEN FILE etc).
    You will also need to modify the parts of the program that get
    the DOS directory and display the Windows file paths.
    The actual abap data sets do not need to be changed.
    Rel 4.0 names can now be up to 40 bytes long
    Dynpros and CUA have changed from rel 3.1
    Tabstrips now loaded and unloaded in dynpros
    Please note restriction on 4.6 systems for users who
    have ABAP names which include '/'s in their names.
    Rel 4.6b, 4.6c Abap names can include the '/' in their names
    e.g /CUST1/CUST2/ORDER
    This causes problems when storing to a local file.
    a solution is to change the name to %CUST1%CUST2%ORDER i.e / will
    be changed to %. On upload the % should be changed back to /
    again. This change still needs to be implemented.
    If you don't use the / in the abap name then this is not a problem.
    If file to be uploaded is in rel 3 format then names are only 8
    bytes long.
    program uses 3 datasets per abap
    1) abapname.eee source, dynpr logic, texts, CUA stuff
    2) abapname.hhh dynpr header
    3) abapname.fff dynpro fields.
    because of varying lengths and contents 3 data sets are used. The
    complexity of combining all these to 1 data set would make the
    program far too complex.
    NOTE: This version of the program can only be used on
    release 4.0 or higher. Once an ABAP has been converted
    to rel 4.0 it cannot be converted back to rel 3.0
    on a release 3/3.1 system. Release 4 CUA tables
    are different. Use release 3 version of this program
    for releases 3.0 and 3.1. Available on SAPFANS website.
    Note that data to be uploaded must have been previously downloaded
    by this program (any version since rel 2.0) - except for Initial
    Load -- see end of these comments.
    Dynpros and CUA statuses have changed since rel 3.1
    This program will handle rel 3.1 format on upload but will
    download in rel 4.0 format. To upload 3.1 format specify an 'X'
    in the rel3 parameter.
    If you have downloaded components in rel 4.0 format and you
    want to re-load to a 3.1 system you will have to load
    the source via standard upload and re-create dynpros and the CUA
    manually.
    As names can now be longer than 8 characters you can only
    use this program if the SAP front end (SAPGUI) supports
    long file names (WIN 95/98 or WIN NT). Windows 3.x will not
    work as the underlying DOS system cannot handle long file names.
    UPLOAD function and DOS directory.
    When an ABAP is selected for UPLOAD then the DOS
    directory is read into a table. A file called ABAP.BAT is created,
    and down loaded to the 'C' drive and executed.
    This file executes a DOS DIR command and pipes the output
    into a dataset which is then uploaded into an internal
    table on SAP.
    Note on running DOS commands from ABAP
    The first time this procedure is executed you will see a DOS window
    which you will have to close manually. To get round this
    use windows explorer to select the file ABAP.BAT and then
    right mouse click on the file name. Select the
    properties window. From this click the CLOSE on EXIT box. This
    will then automatically close the DOS function after it has
    executed. (Windows restriction).
    The DOS function has not been tested using Windows 2000 so
    it might not work. OK on W95,W98,WME and Windows NT (No Thanks)
    If INCLUDE programs are wanted on UPLOAD only the specified
    directory is searched.
    Instead of entering path name manually you can click on
    the path parameter. Because of Windows restriction you will
    have to select ANY file in the relevant directory.
    The path will then be copied on to the selection screen.
    To do still : Merge 3 files to one and compress output to .ZIP file
    fix 4.5 4.6 problem of abaps containing '/' in the name
    possibility to automatically up / download referenced
    function modules with selection criteria like INCLUDES
    To load the ist time into a system.
    Create program with ABAP editor and Upload the .EEE file.
    Delete ist line (????SRCE) in the ABAP EDITOR --NOT THE DISK FILE
    Delete all the source from the line that starts ????TEXT (towards
    the end file) till the end so the last line in your source is ENDFORM.
    DO NOT ALTER THE DISK FILE. DO THESE CHANGES IN THE ABAP EDITOR.
    Save file and execute
    Use following parameters (Note the ist time you won't get proper
    text on the selection screen).
    Function U
    Path full dos path containing source e.g c:\abaps\
    NOTE YOU MUST ENTER THE FINAL \ as above.
    REPID the program name. e.g ZZJIMHXX
    note that on the DISK you will see 3 files
    ZZJIMHXX.EEE, ZZJIMHXX.FFF, ZZJIMHXX.HHH
    just use the name before the dos qualifier - the
    program will do the rest
    ignore other parameters
    The program will then load itself with all the texts etc.
    It should now be ready for use.
    Macros
    DEFINE DEFINE_TABLE.
    DATA: &1 LIKE &2 OCCURS &3 WITH HEADER LINE.
    END-OF-DEFINITION.
    DEFINE CLS.
    REFRESH &1.
    CLEAR &1.
    END-OF-DEFINITION.
    DEFINE INIT.
    IF &1 NE SPACE.
    SEARCH &1 FOR '. .'.
    IF SY-SUBRC = 0.
    WRITE '*' TO &1+SY-FDPOS(1).
    ENDIF.
    TRANSLATE &1 USING '*%'.
    ELSE.
    MOVE '%' TO &1.
    ENDIF.
    END-OF-DEFINITION.
    end of macros
    / SAP standard tables */
    TABLES: D020S, "Dynpro header
    D020T, "Dynpro title
    D021T, "Screen field keyword texts
    TRDIR, "Attribute table
    TADIR, "Dev. class etc.
    EUDB, "CUA data
    TSTC, "transaction data
    TITLE, "CUA titles
    RSMPTEXTS. "Function texts (rel 4.0)
    / Work tables to hold ABAP source etc, and dynpro */
    / contents. */
    DATA: BEGIN OF H. "Header
    INCLUDE STRUCTURE D020S.
    DATA: END OF H.
    DATA: BEGIN OF H1 OCCURS 10, "Header
    NAME(40) TYPE C, "rel 4
    NUMBER(4) TYPE N.
    INCLUDE STRUCTURE D020S.
    DATA: END OF H1.
    DATA: BEGIN OF H2 OCCURS 0, "Rel 3 dynp. header
    CNAME(8) TYPE C,
    CNUM(4) TYPE C,
    NNAME(8) TYPE C,
    NNUM(4) TYPE C,
    FILL(51) TYPE C,
    CDAT(6) TYPE C,
    CTIM(6) TYPE C,
    END OF H2.
    DATA: BEGIN OF F OCCURS 250. "Dynpro Fields
    INCLUDE STRUCTURE D021S.
    DATA: END OF F.
    DATA: BEGIN OF F1 OCCURS 500, "Dynpro Fields
    NAME(40) TYPE C, "rel 4
    NUMBER(4) TYPE N.
    INCLUDE STRUCTURE D021S.
    DATA: END OF F1.
    DATA: BEGIN OF OLD_F1 OCCURS 0, "Dynpro Fields (rel 3)
    NAME(8) TYPE C,
    NUMBER(4) TYPE C.
    INCLUDE STRUCTURE D021SE_OLD.
    DATA: END OF OLD_F1.
    DATA: BEGIN OF F2 OCCURS 0, "Dynpro Fields (rel 3)
    TFIL(284) TYPE C,
    END OF F2.
    DATA: BEGIN OF M OCCURS 3. "Match codes (if any)
    INCLUDE STRUCTURE D023S.
    DATA: END OF M.
    DATA: BEGIN OF E OCCURS 0. "Dynpro Logic
    INCLUDE STRUCTURE D022S.
    DATA: END OF E.
    DATA: BEGIN OF E1 OCCURS 0, "Dynpro Logic
    NAME(40) TYPE C, "rel 4
    NUMBER(4) TYPE N.
    INCLUDE STRUCTURE D022S.
    DATA: END OF E1.
    DATA: BEGIN OF T OCCURS 0, "prog name and dynpro nrs
    NAME(40) TYPE C, "rel 4
    NUMBER(4) TYPE N,
    END OF T.
    DATA: BEGIN OF R OCCURS 56, "prog name and language
    NAME(40) TYPE C, "rel 4
    LANGUAGE(1) TYPE C,
    END OF R.
    DATA: BEGIN OF S OCCURS 3000,
    TXT(180) TYPE C, "rel 4 was 132
    END OF S.
    DATA: BEGIN OF R1 OCCURS 50, "for include programs
    NAME(40) TYPE C, "rel 4
    INSTANCE(3) TYPE P,
    END OF R1.
    DATA: BEGIN OF S1 OCCURS 3000,
    TXT(180) TYPE C, " rel 4 was 132
    END OF S1.
    DATA: BEGIN OF U OCCURS 100, "Text elements
    TXT(180) TYPE C, " rel 4 was 132
    END OF U.
    DATA: BEGIN OF DIR. "ABAP Attributes
    INCLUDE STRUCTURE TRDIR.
    DATA: END OF DIR.
    DATA: BEGIN OF DTXT. "Dynpro field keyword texts
    INCLUDE STRUCTURE D021T.
    DATA: END OF DTXT.
    / This data contains all the components of the */
    / CUA such as menus, statuses, Pfkeys */
    / As from rel 4.5 Tabstrips are automatically copied as well */
    / The rel3 parameter must be set however to load the */
    / correct version of the CUA tables if uploading rel 3 */
    / data to a rel 4 system. */
    / Rel 4.0B can convert 3.1 and earlier CUA's */
    / This could change later however. */
    CUA Tables.
    Key of CUA tables in EUDB data set. Name is len 40 in rel 4.0
    DATA BEGIN OF EU_KEY.
    INCLUDE STRUCTURE RSEU1_KEY.
    DATA END OF EU_KEY.
    Status
    DATA BEGIN OF STA OCCURS 0.
    INCLUDE STRUCTURE RSMPE_STAT. " rel 4
    DATA END OF STA.
    Functions
    DATA BEGIN OF FUN OCCURS 0.
    INCLUDE STRUCTURE RSMPE_FUNT. "rel 4
    DATA END OF FUN.
    Menus
    DATA BEGIN OF MEN OCCURS 0.
    INCLUDE STRUCTURE RSMPE_MEN. "rel 4.0
    DATA END OF MEN.
    Menus (texts)
    DATA BEGIN OF MTX OCCURS 0.
    INCLUDE STRUCTURE RSMPE_MNLT. "rel 4.0
    DATA END OF MTX.
    Action Bar
    DATA BEGIN OF ACT OCCURS 0.
    INCLUDE STRUCTURE RSMPE_ACT. "rel 4.0
    DATA END OF ACT.
    Push Buttons
    DATA BEGIN OF BUT OCCURS 0.
    INCLUDE STRUCTURE RSMPE_BUT. "rel 4.0
    DATA END OF BUT.
    PF-Keys
    DATA BEGIN OF PFK OCCURS 0.
    INCLUDE STRUCTURE RSMPE_PFK. "rel 4.0
    DATA END OF PFK.
    Function sets
    DATA BEGIN OF SET OCCURS 0.
    INCLUDE STRUCTURE RSMPE_STAF. "rel 4.0
    DATA END OF SET.
    Documentation
    DATA BEGIN OF DOC OCCURS 0.
    INCLUDE STRUCTURE RSMPE_ATRT. "rel 4.0
    DATA END OF DOC.
    Title codes with text
    DATA: BEGIN OF TIT OCCURS 0.
    INCLUDE STRUCTURE RSMPE_TITT. "rel 4.0
    DATA: END OF TIT.
    DATA BEGIN OF FTX OCCURS 0. "rel 4.0
    INCLUDE STRUCTURE RSMPTEXTS.
    DATA END OF FTX.
    rel 3.1 CUA components.
    Status
    DATA BEGIN OF OLD_STA OCCURS 0.
    INCLUDE STRUCTURE RSEU1_GEN. " rel 3.1
    DATA END OF OLD_STA.
    Functions
    DATA BEGIN OF OLD_FUN OCCURS 0.
    INCLUDE STRUCTURE RSEU1_FUN. "rel 3.1
    DATA END OF OLD_FUN.
    Menus
    DATA BEGIN OF OLD_MEN OCCURS 0.
    INCLUDE STRUCTURE RSEU1_MEN. "rel 3.1
    DATA END OF OLD_MEN.
    Menus (texts)
    DATA BEGIN OF OLD_MTX OCCURS 0.
    INCLUDE STRUCTURE RSEU1_TXM. "rel 3.1
    DATA END OF OLD_MTX.
    Action Bar
    DATA BEGIN OF OLD_ACT OCCURS 0.
    INCLUDE STRUCTURE RSEU1_ACT. "rel 3.1
    DATA END OF OLD_ACT.
    Push Buttons
    DATA BEGIN OF OLD_BUT OCCURS 0.
    INCLUDE STRUCTURE RSEU1_BUT. "rel 3.1
    DATA END OF OLD_BUT.
    PF-Keys
    DATA BEGIN OF OLD_PFK OCCURS 0.
    INCLUDE STRUCTURE RSEU1_PFK. "rel 3.1
    DATA END OF OLD_PFK.
    Function sets
    DATA BEGIN OF OLD_SET OCCURS 0.
    INCLUDE STRUCTURE RSEU1_SET. "rel 3.1
    DATA END OF OLD_SET.
    Documentation
    DATA BEGIN OF OLD_DOC OCCURS 0.
    INCLUDE STRUCTURE RSEU1_ETM. "rel 3.1
    DATA END OF OLD_DOC.
    Title codes with text
    DATA: BEGIN OF OLD_TIT OCCURS 0.
    INCLUDE STRUCTURE TITLE. "rel 3.1
    DATA: END OF OLD_TIT.
    dynamic function text
    DATA BEGIN OF FDN OCCURS 1.
    INCLUDE STRUCTURE RSEU1_FDYN. "not req for rel 4.
    DATA END OF FDN.
    Icons
    DATA BEGIN OF FIN OCCURS 1.
    INCLUDE STRUCTURE RSEU1_ICON. "not req for rel 4
    DATA END OF FIN.
    dynamic menu texts
    DATA BEGIN OF MDN OCCURS 1.
    INCLUDE STRUCTURE RSEU1_MDYN. "not req for rel 4.
    DATA END OF MDN.
    Symbol list
    DATA BEGIN OF SYM OCCURS 0.
    INCLUDE STRUCTURE RSEU1_SYMB.
    DATA END OF SYM.
    Status Short text
    DATA BEGIN OF STX OCCURS 0.
    INCLUDE STRUCTURE RSEU1_CTX.
    DATA END OF STX.
    Attributes for function key settings (menu bars) Rel 3.0
    DATA BEGIN OF ATT OCCURS 0.
    INCLUDE STRUCTURE RSEU1_HAT.
    DATA END OF ATT.
    Include-Menus
    DATA BEGIN OF INC OCCURS 3.
    INCLUDE STRUCTURE RSEU1_INC.
    DATA END OF INC.
    Last used numbers
    DATA BEGIN OF LAST.
    INCLUDE STRUCTURE RSEU1_LST.
    DATA END OF LAST.
    data for call transaction (SE41 to re-generate the CUA)
    DATA: BEGIN OF T_BDC_TAB OCCURS 0.
    INCLUDE STRUCTURE BDCDATA. "BDC data
    DATA: END OF T_BDC_TAB.
    DATA: BEGIN OF T_MESSTAB OCCURS 0.
    INCLUDE STRUCTURE BDCDATA.
    DATA: END OF T_MESSTAB.
    / Program data */
    DATA: NUMBER(4) TYPE N,
    OLDNUM(4) TYPE N,
    FILESIZE TYPE I,
    NR_OF_BYTES TYPE I,
    I(3) TYPE P,
    IX(3) TYPE P,
    J(3) TYPE P,
    L(3) TYPE P,
    CUA-FLAG(1) TYPE C,
    CUA_RETURN(10) TYPE C,
    DYNPRO_MESSAGE(160) TYPE C,
    DYNPRO_LINE TYPE P,
    DYNPRO_WORD(30) TYPE C,
    NUM(3) TYPE N,
    DYNNAME(44) TYPE C,
    FN1(128) TYPE C,
    FN2(128) TYPE C,
    FN3(128) TYPE C,
    W_ITERATE(1) TYPE C,
    MAIN(1) TYPE C,
    FUNC(1) TYPE C,
    OLDNAME(40) TYPE C,
    OLD-FUNC(8) TYPE C,
    NEW-FUNC(8) TYPE C,
    FOUND(1) TYPE C,
    LANGUAGE LIKE SY-LANGU,
    FIRST-TIME(1) TYPE C VALUE 'Y',
    OK-CODE(5) TYPE C,
    NAME(40) TYPE C, "rel 4
    TXLINE(70) TYPE C,
    LINE(132) TYPE C.
    DATA:
    UL_FILE(128) TYPE C,
    DL_FILE(128) TYPE C,
    DOSLINE(72) TYPE C.
    DATA: BEGIN OF DOSDIR OCCURS 0,
    TEXT(72),
    END OF DOSDIR.
    DATA: BEGIN OF I_PROG OCCURS 0,
    NAME(40),
    END OF I_PROG.
    DATA: BEGIN OF I_PROGT OCCURS 0,
    NAME(40),
    END OF I_PROGT.
    DATA: BEGIN OF I_INCLUDE OCCURS 0,
    NAME(40),
    HANDLED(1) TYPE C,
    END OF I_INCLUDE.
    DATA: BEGIN OF I_INCL OCCURS 0,
    NAME(40),
    END OF I_INCL.
    DATA: BUFFER(1024).
    DATA: WINSYS(3).
    DATA: GLOBAL_FILEMASK_MASK(20), GLOBAL_FILEMASK_TEXT(20).
    DATA: GLOBAL_FILEMASK_ALL(80).
    DATA: T_FILENAME(128),
    TMP_FILENAME(128),
    T_MODE(1),
    FIELDLN TYPE I.
    DEFINE_TABLE I_DYNPFIELDS DYNPREAD 0. "dynpro fields to be updated
    DATA: I_FLDS LIKE HELP_VALUE OCCURS 0 WITH HEADER LINE.
    FIELD-SYMBOLS: <F>.
    / Parameters */
    SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS REPID FOR TRDIR-NAME OBLIGATORY .
    PARAMETERS:
    FUNCTION(1) TYPE C OBLIGATORY, "Function
    DSNAME(40) TYPE C, "Data set name
    INCLUDES(1) TYPE C DEFAULT 'N', "Resolve Includes
    IMASK(40) TYPE C, "Include Mask
    CLASS LIKE TRDIR-CLAS,
    AUTHOR LIKE TRDIR-CNAM, "Author
    APPL LIKE TRDIR-APPL,
    PATH(88) TYPE C DEFAULT 'A:\',
    REL3(1) TYPE C.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(70) TEXT-004.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(70) TEXT-005.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(70) TEXT-002.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(70) TEXT-003.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK A1.
    / Check users workstation is running WINDOWS, */
    / WINDOWS 95, or WINDOWS NT. OS/2 no good for */
    / this application. */
    CALL FUNCTION 'WS_QUERY'
    EXPORTING
    QUERY = 'WS'
    IMPORTING
    RETURN = WINSYS.
    IF WINSYS(2) NE 'WN'. "Win 3.X no good either
    WRITE: / 'Windows NT or Windows 95/98 is required'.
    EXIT.
    ENDIF.
    / Get names of programs to be handled. */
    / Name can be a single value, many values or ranges */
    / as per standard SELECT-OPTIONS on selection screen */
    / On Download read TRDIR and store program names in a table */
    / as per selection options. */
    / On upload read the specified directory for all files of */
    / type .EEE from specified directory */
    / compare file names with selection criteria */
    MOVE FUNCTION TO FUNC.
    MOVE 'Y' TO MAIN.
    CASE FUNC.
    WHEN 'U'. "Upload required
    PERFORM READ_DOS_DIRECTORY.
    PERFORM GET_RANGE_UL. "Get list of progs to process
    WHEN 'D'. "Download required
    PERFORM GET_RANGE_DL. "Get list of progs to process
    WHEN OTHERS.
    WRITE: / 'Function not performed due to user request'.
    EXIT.
    ENDCASE.
    SORT I_PROG.
    DELETE ADJACENT DUPLICATES FROM I_PROG.
    For download INCLUDE handling can be resolved via function
    module call.
    All Includes within Includes are also resolved by the function
    module call.
    Note that this method does not work if program itself is of type
    I (it's an include)
    In this case we can still search the source.
    IF FUNC = 'D'.
    IF INCLUDES = 'Y'.
    PERFORM GET_INCLUDES_DL.
    PERFORM PROCESS_INCLUDES_DL.
    ENDIF.
    ENDIF.
    Program list from selection criteria i.e excluding INCLUDES found
    LOOP AT I_PROG.
    MOVE I_PROG-NAME TO R1-NAME.
    APPEND R1.
    DESCRIBE TABLE R1 LINES I.
    WHILE I NE 0.
    PERFORM EXECUTE-FUNCTION.
    ENDWHILE.
    REFRESH R1.
    ENDLOOP.
    We need to check now for INCLUDES on DOWNLOAD when the INCLUDE
    program itself is of type I. In this case the function call
    will not return the INCLUDES. For example we could be
    downloading ZTESTTOP (an Include itself) which as an include
    ZTEST01.
    The process fortunately is the same as the UPLOAD function
    except of course we need to read the library instead of the
    DOS directory
    process INCLUDE modules for Upload
    On upload the procedure is more complex as Includes within
    Includes can only be resolved by scanning the code and
    searching if the program exists in the directory.
    To get all INCLUDES within INCLUDES entries in table I_INCL
    that do not exist in I_INCLUDE are copied to table I_INCLUDE
    after each entire pass of table i_INCLUDE and table is then
    re-looped through. Programs in table I_INCLUDE that have already
    been processed have a "Y" indicator set in I_INCLUDE-AVAIL.
    if func = 'U'.
    IF INCLUDES = 'Y'.
    DESCRIBE TABLE I_INCL LINES I.
    IF I > 0.
    W_ITERATE = 'Y'.
    ELSE.
    W_ITERATE = ' '.
    ENDIF.
    WHILE W_ITERATE = 'Y'.
    PERFORM PROCESS_INCLUDES_UL.
    PERFORM LOOP_THROUGH.
    DESCRIBE TABLE I_INCL LINES I.
    IF I > 0.
    W_ITERATE = 'Y'.
    ELSE.
    W_ITERATE = ' '.
    ENDIF.
    ENDWHILE.
    endif.
    ENDIF.
    DESCRIBE TABLE I_INCLUDE LINES I.
    IF I > 0.
    SKIP 1.
    WRITE: / ' Included Programs found'.
    SKIP 1.
    LOOP AT I_INCLUDE.
    WRITE I_INCLUDE-NAME TO LINE(40).
    CONDENSE LINE.
    WRITE: / LINE(80).
    ENDLOOP.
    ENDIF.
    / Table R contains ABAP names to up / download. */
    / Loop through table R and perform up / download */
    / for each program. */
    / Table R1 contains INCLUDE names found (if any) */
    / As each */
    FORM EXECUTE-FUNCTION.
    LOOP AT R1.
    MOVE-CORRESPONDING R1 TO R.
    APPEND R.
    ENDLOOP.
    REFRESH R1.
    LOOP AT R.
    REFRESH : T, E1, H1, F1, S, U.
    PERFORM PROCESS.
    MOVE 'N' TO MAIN.
    ENDLOOP.
    REFRESH R.
    DESCRIBE TABLE R1 LINES I.
    ENDFORM.
    / Build file names for UP/DOWNLOAD */
    / 3 files are generated per ABAP. */
    / 1) ABAP Path\PROGNAME.EEE (ABAP, Attr,Texts) */
    / Logic Path\PROGNAME.EEE (Dynpro Source Logic) */
    / CUA Path\PROGNAME.EEE (CUA components - keys etc) */
    / 2) Header Path\PROGNAME.HHH (Dynpro Header) */
    / 3) Fields Path\PROGNAME.FFF (Dynpro Field definitions )*/
    / ( If alternate file name specified -DSNAME- this will */
    / be used instead. This is only valid for the main program. */
    / INCLUDED programs will have file names as specified */
    / above). */
    / By using this scheme it saves the user from having to */
    / be prompted for 3 file names. */
    / If you want multiple copies / versions on disk either */
    / rename the old versions or specify a different directory in */
    / the path parameter. */
    FORM PROCESS.
    MOVE PATH TO FN1.
    CASE MAIN.
    WHEN 'Y'.
    IF DSNAME NE SPACE.
    WRITE DSNAME TO FN1+66. "rel 4
    ELSE.
    WRITE R-NAME TO FN1+66. "rel 4
    ENDIF.
    WHEN OTHERS.
    WRITE R-NAME TO FN1+66. "rel 4
    ENDCASE.
    MOVE FN1 TO FN2.
    MOVE FN1 TO FN3.
    WRITE '.HHH' TO FN1+124(4). "rel 4
    WRITE '.FFF' TO FN2+124(4). "rel 4
    WRITE '.EEE' TO FN3+124(4). "rel 4
    CONDENSE FN1 NO-GAPS.
    CONDENSE FN2 NO-GAPS.
    CONDENSE FN3 NO-GAPS.
    NAME = R-NAME.
    CASE FUNC.
    WHEN 'D'.
    PERFORM DOWNLOAD_OBJECTS.
    CLEAR LINE.
    WRITE : 'ABAP : ' TO LINE.
    WRITE R-NAME TO LINE+8.
    WRITE 'has been unloaded' TO LINE+55.
    CONDENSE LINE.
    WRITE: / LINE.
    DESCRIBE TABLE T LINES I.
    IF I = 0.
    WRITE: / 'No Dynpros were found for unload function'.
    ELSE.
    WRITE: / 'The following Dynpros have been unloaded : '.
    PERFORM LOOP_THROUGH_T.
    ENDIF.
    WHEN 'U'.
    PERFORM UPLOAD_OBJECTS.
    DESCRIBE TABLE T LINES I.
    CASE I.
    WHEN 0.
    WRITE: / 'No Dynpros were found for restore function'.
    WHEN OTHERS.
    WRITE: / 'The following Dynpros have been restored : '.
    PERFORM LOOP_THROUGH_T.
    ENDCASE.
    IF MAIN EQ 'Y'.
    CASE OLDNAME.
    WHEN SPACE.
    CLEAR LINE.
    WRITE : 'ABAP : ' TO LINE.
    WRITE R-NAME TO LINE+8.
    WRITE 'has been restored' TO LINE+55.
    CONDENSE LINE.
    WRITE: / LINE.
    WHEN OTHERS.
    CLEAR LINE.
    WRITE : 'ABAP : ' TO LINE.
    WRITE R-NAME TO LINE+8.
    WRITE 'has been restored - original name :'
    TO LINE+55.
    WRITE OLDNAME TO LINE+92.
    CONDENSE LINE.
    WRITE: / LINE.
    ENDCASE.
    ELSE.
    CLEAR LINE.
    WRITE : 'ABAP : ' TO LINE.
    WRITE R-NAME TO LINE+8.
    WRITE 'has been restored' TO LINE+55.
    CONDENSE LINE.
    WRITE: / LINE.
    ENDIF.
    ENDCASE.
    ENDFORM.
    / print progname + dynpro nrs that have been processed. */
    FORM LOOP_THROUGH_T.
    LOOP AT T.
    CLEAR LINE.
    WRITE R-NAME TO LINE.
    WRITE T-NUMBER TO LINE+50.
    CONDENSE LINE.
    WRITE: / LINE.
    ENDLOOP.
    ENDFORM.
    / Download Objects */
    FORM DOWNLOAD_OBJECTS.
    PERFORM UNLOAD_ABAP. "ABAP source, texts, attr
    SELECT SINGLE * FROM TRDIR
    WHERE NAME EQ R-NAME.
    IF TRDIR-SUBC = 'I'.
    CASE INCLUDES. "Included file wanted
    WHEN 'Y'.
    PERFORM SCAN4-INCLUDES.
    ENDCASE.
    ENDIF.
    PERFORM UNLOAD_CUA. "CUA stuff
    PERFORM DOWNLOAD_DATA. "Download EEE file to PC
    PERFORM BUILD_T. "Build table of all dynpros in ABAP
    DESCRIBE TABLE T LINES I.
    CASE I.
    WHEN 0. "if no dynpros exist then cannot download any
    PERFORM DOWNLOAD_DATA. "Download EEE file to PC
    WHEN OTHERS.
    PERFORM UNLOAD_DYNPROS. "Get Raw dynpros from SAP
    PERFORM UNLOAD_DYNPRO_COMPONENTS."Convert to table
    PERFORM DOWNLOAD_DATA. "Download ABAP etc. to PC
    PERFORM DOWNLOAD_BIN_H1. "Download dynpro header
    PERFORM DOWNLOAD_BIN_F1. "Download dynpro fields
    ENDCASE.
    ENDFORM.
    / Split ABAP up into its component parts */
    / A) Program source (72) */
    / B) Texts (132) */
    / C) Attributes (117) */
    / D) CUA stuff (Various) */
    FORM UNLOAD_ABAP.
    / Get ABAP language. Only required on download. */
    SELECT SINGLE * FROM TRDIR
    WHERE NAME EQ R-NAME.
    MOVE TRDIR-RLOAD TO R-LANGUAGE.
    READ REPORT R-NAME INTO S. "Get source into table S
    MOVE '????SRCE' TO S-TXT.
    INSERT S INDEX 1.
    / Text elements, Numbered texts, headings, selection texts */
    / Read text elements with logon language. If they don't */
    / exist read with the value taken from TRDIR. */
    READ TEXTPOOL R-NAME INTO U LANGUAGE SY-LANGU.
    IF SY-SUBRC NE 0.
    READ TEXTPOOL R-NAME INTO U LANGUAGE R-LANGUAGE.
    ENDIF.
    DESCRIBE TABLE U LINES I.
    CASE I.
    WHEN 0.
    WHEN OTHERS.
    MOVE '????TEXT' TO S-TXT.
    APPEND S.
    LOOP AT U.
    MOVE U-TXT TO S-TXT.
    APPEND S.
    DELETE U.
    ENDLOOP.
    ENDCASE.
    / Retrieve Attributes from TRDIR and add to table S */
    / Change language to logged on language */
    MOVE '????ATTR' TO S-TXT.
    APPEND S.
    SELECT SINGLE * FROM TRDIR
    WHERE NAME EQ R-NAME.
    MOVE SY-LANGU TO TRDIR-RLOAD.
    MOVE-CORRESPONDING TRDIR TO DIR.
    MOVE DIR TO S-TXT.
    APPEND S.
    ENDFORM.
    / retrieve CUA stuff and append to table S. */
    FORM UNLOAD_CUA.
    MOVE R-NAME TO EU_KEY-NAME. "Program name for CUA
    MOVE 'D' TO EU_KEY-SPRSL. "CUA seems to want D as lang
    MOVE R-LANGUAGE TO EU_KEY-SPRSL. "Language "rel 2.2
    IMPORT STA FUN MEN MTX ACT BUT PFK SET LAST INC STX DOC "rel 2.2
    IMPORT STA STX FUN MEN MTX ACT BUT PFK SET LAST INC DOC "rel 3.0
    ATT FDN MDN SYM FIN "rel 3.0
    FROM DATABASE EUDB(CU) ID EU_KEY.
    IF SY-SUBRC NE 0. "No statuses
    EXIT.
    ENDIF.
    read titles in logged on language. If not present use
    language from TRDIR.
    CASE REL3.
    WHEN SPACE. "(rel 4)
    SELECT * FROM RSMPTEXTS WHERE PROGNAME EQ R-NAME
    AND SPRSL = SY-LANGU.
    MOVE-CORRESPONDING RSMPTEXTS TO FTX.
    APPEND FTX.
    ENDSELECT.
    IF SY-SUBRC NE 0.
    SELECT * FROM RSMPTEXTS WHERE PROGNAME EQ R-NAME
    AND SPRSL = R-LANGUAGE.
    MOVE-CORRESPONDING RSMPTEXTS TO FTX.
    APPEND FTX.
    ENDSELECT.
    ENDIF.
    DESCRIBE TABLE FTX LINES I.
    IF I > 0.
    MOVE '????FTXT' TO S-TXT.
    APPEND S.
    LOOP AT FTX.
    MOVE FTX TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    WHEN OTHERS.
    SELECT * FROM TITLE WHERE PROGNAME EQ R-NAME
    AND DDLANGUAGE EQ SY-LANGU.
    MOVE-CORRESPONDING TITLE TO TIT.
    APPEND TIT.
    ENDSELECT.
    IF SY-SUBRC NE 0.
    SELECT * FROM TITLE WHERE PROGNAME EQ R-NAME
    AND DDLANGUAGE EQ R-LANGUAGE.
    MOVE-CORRESPONDING TITLE TO TIT.
    APPEND TIT.
    ENDSELECT.
    ENDIF.
    ENDCASE.
    DESCRIBE TABLE STA LINES I.
    IF I > 0.
    MOVE '????STAT' TO S-TXT.
    APPEND S.
    LOOP AT STA.
    MOVE STA TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE FUN LINES I.
    IF I > 0.
    MOVE '????FUNC' TO S-TXT.
    APPEND S.
    LOOP AT FUN.
    MOVE FUN TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE MEN LINES I.
    IF I > 0.
    MOVE '????MEN1' TO S-TXT.
    APPEND S.
    LOOP AT MEN.
    MOVE MEN TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE MTX LINES I.
    IF I > 0.
    MOVE '????MTX1' TO S-TXT.
    APPEND S.
    LOOP AT MTX.
    MOVE MTX TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE ACT LINES I.
    IF I > 0.
    MOVE '????ACTN' TO S-TXT.
    APPEND S.
    LOOP AT ACT.
    MOVE ACT TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE BUT LINES I.
    IF I > 0.
    MOVE '????BUTN' TO S-TXT.
    APPEND S.
    LOOP AT BUT.
    MOVE BUT TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE PFK LINES I.
    IF I > 0.
    MOVE '????PFKY' TO S-TXT.
    APPEND S.
    LOOP AT PFK.
    MOVE PFK TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE SET LINES I.
    IF I > 0.
    MOVE '????SETS' TO S-TXT.
    APPEND S.
    LOOP AT SET.
    MOVE SET TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    IF LAST NE SPACE.
    MOVE '????LIST' TO S-TXT.
    APPEND S.
    MOVE LAST TO S-TXT.
    APPEND S.
    ENDIF.
    DESCRIBE TABLE INC LINES I.
    IF I > 0.
    MOVE '????INCL' TO S-TXT.
    APPEND S.
    LOOP AT INC.
    MOVE INC TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE STX LINES I.
    IF I > 0.
    MOVE '????STXT' TO S-TXT.
    APPEND S.
    LOOP AT STX.
    MOVE STX TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE DOC LINES I.
    IF I > 0.
    MOVE '????DOCN' TO S-TXT.
    APPEND S.
    LOOP AT DOC.
    MOVE DOC TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE TIT LINES I.
    IF I > 0.
    MOVE '????TITL' TO S-TXT.
    APPEND S.
    LOOP AT TIT.
    MOVE TIT TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    Next 5 tables are rel 3.0 specific (ATT, FDN, MDN, SYM, FIN)
    DESCRIBE TABLE ATT LINES I.
    IF I > 0.
    MOVE '????VATT' TO S-TXT.
    APPEND S.
    LOOP AT ATT.
    MOVE ATT TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE FDN LINES I.
    IF I > 0.
    MOVE '????VFDN' TO S-TXT.
    APPEND S.
    LOOP AT FDN.
    MOVE FDN TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE MDN LINES I.
    IF I > 0.
    MOVE '????VMDN' TO S-TXT.
    APPEND S.
    LOOP AT MDN.
    MOVE MDN TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE SYM LINES I.
    IF I > 0.
    MOVE '????VSYM' TO S-TXT.
    APPEND S.
    LOOP AT SYM.
    MOVE SYM TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    DESCRIBE TABLE FIN LINES I.
    IF I > 0.
    MOVE '????VFIN' TO S-TXT.
    APPEND S.
    LOOP AT FIN.
    MOVE FIN TO S-TXT.
    APPEND S.
    ENDLOOP.
    ENDIF.
    ENDFORM.
    / Upload Objects. */
    FORM UPLOAD_OBJECTS.
    PERFORM UPLOAD_EEE. "ABAP,texts,attr dynpro logic
    DESCRIBE TABLE E1 LINES I.
    IF I > 0. "Do dynpro components exist
    PERFORM UPLOAD_HHH. "dynpro header
    PERFORM UPLOAD_FFF. "dynpro fields.
    PERFORM RECONSTRUCT_DYNPROS. "load + gen dynpros
    ENDIF.
    ENDFORM.
    / Build table containing dynpro names and numbers */
    FORM BUILD_T.
    SELECT * FROM D020S WHERE PROG EQ R-NAME.
    T-NUMBER = D020S-DNUM.
    T-NAME = D020S-PROG.
    APPEND T.
    ENDSELECT.
    ENDFORM.
    / Split dynpros into constituent parts. */
    FORM UNLOAD_DYNPROS.
    MOVE 'Y' TO FIRST-TIME.
    LOOP AT T.
    REFRESH: F, E.
    CLEAR: H, F, E.
    PERFORM BUILD_HHH. "Dynpro Header
    PERFORM BUILD_FFF. "Dynpro Fields
    PERFORM BUILD_EEE_DYNP. "Dynpro Logic
    ENDLOOP.
    ENDFORM.
    / Header H length 284. */
    FORM BUILD_HHH.
    MOVE T-NAME TO DYNNAME(40). "rel 4.
    MOVE T-NUMBER TO DYNNAME+40(4). "rel 4.
    IMPORT DYNPRO H F E M ID DYNNAME.
    MOVE T-NAME TO H1-NAME.
    MOVE T-NUMBER TO H1-NUMBER.
    MOVE-CORRESPONDING H TO H1.
    APPEND H1.
    ENDFORM.
    / Fields D021S Len 87. */
    FORM BUILD_FFF.
    MOVE T-NAME TO F1-NAME.
    MOVE T-NUMBER TO F1-NUMBER.
    LOOP AT F.
    MOVE-CORRESPONDING F TO F1.
    APPEND F1.
    DELETE F.
    ENDLOOP.
    ENDFORM.
    / Dynpro Logic D022S E */
    FORM BUILD_EEE_DYNP.
    MOVE T-NAME TO E1-NAME.
    MOVE T-NUMBER TO E1-NUMBER.
    LOOP AT E.
    MOVE-CORRESPONDING E TO E1.
    APPEND E1.
    DELETE E.
    ENDLOOP.
    ENDFORM.
    / Unload Constituent parts of dynpro. */
    FORM UNLOAD_DYNPRO_COMPONENTS.
    MOVE '????LOGC' TO S-TXT.
    APPEND S.
    LOOP AT E1.
    MOVE E1 TO S-TXT.
    APPEND S.
    DELETE E1.
    ENDLOOP.
    FREE E1.
    LOOP AT T.
    MOVE 'N' TO FOUND.
    SELECT SINGLE * FROM D020T "use logged on language
    WHERE PROG EQ T-NAME
    AND DYNR EQ T-NUMBER
    AND LANG EQ SY-LANGU.
    IF SY-SUBRC NE 0. "try original language.
    SELECT SINGLE * FROM D020T
    WHERE PROG EQ T-NAME
    AND DYNR EQ T-NUMBER
    AND LANG EQ R-LANGUAGE.
    ENDIF.
    IF SY-SUBRC EQ 0.
    IF FOUND = 'N'.
    MOVE '????DTIT' TO S-TXT.
    APPEND S.
    MOVE 'Y' TO FOUND.
    ENDIF.
    MOVE T-NAME TO S-TXT.
    WRITE T-NUMBER TO S-TXT+8(4).
    WRITE D020T-DTXT TO S-TXT+12(60).
    APPEND S.
    ENDIF.
    MOVE 'N' TO FOUND.
    SELECT * FROM D021T
    WHERE PROG EQ T-NAME
    AND DYNR EQ T-NUMBER
    AND LANG EQ SY-LANGU. "logged on language
    IF FOUND = 'N'.
    MOVE '????DTXT' TO S-TXT.
    APPEND S.
    MOVE 'Y' TO FOUND.
    ENDIF.
    MOVE-CORRESPONDING D021T TO DTXT.
    MOVE DTXT TO S-TXT.
    APPEND S.
    ENDSELECT.
    CASE SY-SUBRC.
    WHEN 0.
    WHEN OTHERS. "try original language
    SELECT * FROM D021T
    WHERE PROG EQ T-NAME
    AND DYNR EQ T-NUMBER
    AND LANG EQ R-LANGUAGE.
    IF FOUND = 'N'.
    MOVE '????DTXT' TO S-TXT.
    APPEND S.
    MOVE 'Y' TO FOUND.
    ENDIF.
    MOVE-CORRESPONDING D021T TO DTXT.
    MOVE DTXT TO S-TXT.
    APPEND S.
    ENDSELECT.
    ENDCASE.
    ENDLOOP.
    ENDFORM.
    / Build the original dynpro component tables. */
    / Table H1 contains 1 entry for each dynpro. H1 contains */
    / the header for the dynpro prefixed by the program name */
    / and dynpro number. */
    / By looping round this table we can re-build the F */
    / (Fields) and E (Logic) components. By stripping off the */
    / program name and dynpro number the original tables are */
    / re-created. (Tables F1 and E1 also have a prefix of */
    / Program name and dynpro nr). */
    / After the original set of tables has been re-created we */
    / use R3 - SYSTEM-CALL (rel 2.2) to generate the screen */
    / and then get the next entry in table H1 to build the */
    / next screen. For releases 3.0 and higher use generate */
    / dynpro. */
    FORM RECONSTRUCT_DYNPROS.
    LOOP AT H1.
    CASE MAIN.
    WHEN 'Y'.
    if h1-name ne repid.
    IF H1-NAME NE R1-NAME.
    MOVE H1-NAME TO OLDNAME.
    ENDIF.
    ENDCASE.
    PERFORM RECONSTRUCT_F.
    PERFORM RECONSTRUCT_E.
    MOVE-CORRESPONDING H1 TO H.
    IF MAIN = 'Y'.
    move repid to h-prog.
    MOVE R1-NAME TO H-PROG.
    move repid to dynname.
    MOVE R1-NAME TO DYNNAME.
    ELSE.
    MOVE H1-NAME TO H-PROG.
    MOVE H1-NAME TO DYNNAME.
    ENDIF.
    MOVE H1-NUMBER TO H-DNUM.
    WRITE H1-NUMBER TO DYNNAME+40(4).
    EXPORT DYNPRO H F E M ID DYNNAME.
    SYSTEM-CALL GENERATE-SCREEN DYNNAME. "Up to rel 2.2
    GENERATE DYNPRO H F E M ID DYNNAME "R 3.0, 4.0, 4.5
    MESSAGE DYNPRO_MESSAGE
    LINE DYNPRO_LINE
    WORD DYNPRO_WORD.
    REFRESH: M, F, E.
    CLEAR: M, H, F, E.
    ENDLOOP.
    ENDFORM.
    / Re-build Fields table */
    FORM RECONSTRUCT_F.
    LOOP AT F1 WHERE NAME EQ H1-NAME AND
    NUMBER EQ H1-NUMBER.
    MOVE-CORRESPONDING F1 TO F.
    APPEND F.
    ENDLOOP.
    ENDFORM.
    / Re-build Logic table */
    FORM RECONSTRUCT_E.
    LOOP AT E1 WHERE NAME EQ H1-NAME AND
    NUMBER EQ H1-NUMBER.
    MOVE-CORRESPONDING E1 TO E.
    APPEND E.
    ENDLOOP.
    ENDFORM.
    / scan for included files (Upload) */
    FORM SCAN4-INCLUDES.
    IF FUNC = 'D'. "Downloads - whole table needs to be scanned
    LOOP AT S.
    PERFORM SEARCH-FUNC.
    ENDLOOP.
    ENDIF.
    IF FUNC = 'U'. "On upload scan line by line as we are re-building abap
    PERFORM SEARCH-FUNC.
    ENDIF.
    ENDFORM.
    / scan for text INCLUDE xxxxxxxx */
    / reject INCLUDE STRUCTURE as structure not a valid */
    / program name */
    FORM SEARCH-FUNC.
    CONDENSE S-TXT.
    SEARCH S-TXT FOR '.INCLUDE .'.
    CASE SY-SUBRC.
    WHEN 0.
    IF S-TXT+8(9) EQ 'STRUCTURE'
    OR S-TXT+8(9) EQ 'structure'
    OR S-TXT+8(6) EQ '<ICON>' "rel 3.0c 3.0d
    OR S-TXT+8(6) EQ '<icon>'
    OR S-TXT+8(6) EQ '<type>'
    OR S-TXT+8(6) EQ '<TYPE>'
    OR S-TXT+8(9) EQ '<methods>'
    OR S-TXT+8(9) EQ '<METHODS>'.
    EXIT.
    ENDIF.
    IF SY-FDPOS EQ 0. "INCLUDE must be in pos 1 (by reason of condense)
    PERFORM VALIDATE_INCLUDE.
    ELSE.
    EXIT.
    ENDIF.
    ENDCASE.
    ENDFORM.
    / Validate INCLUDES . */
    FORM VALIDATE_INCLUDE.
    SEARCH S-TXT FOR '...' STARTING AT 9 ENDING AT 39.
    CASE SY-SUBRC.
    WHEN 0.
    WHEN OTHERS.
    SEARCH S-TXT FOR '. .' STARTING AT 9 ENDING AT 38.
    IF SY-SUBRC NE 0.
    EXIT.
    ENDIF.
    ENDCASE.
    IX = SY-FDPOS.
    ASSIGN S-TXT+8(IX) TO <F>.
    Now check for Include Mask for example if include mask was set to
    Z* then only include programs whose first letter starts with a Z.
    1) get length of the INCLUDE program name. Must be less than or
    equal 40.
    2) Compare it with the Include mask.
    3) If Ok add include program name to include table
    clear i_include.
    move <f> to i_include-name.
    CLEAR I_INCL.
    SEARCH IMASK FOR '.*.'.
    IF SY-SUBRC = 0.
    CONDENSE IMASK.
    ENDIF.
    IF ( <F> CP IMASK OR IMASK = ' ' ).
    READ TABLE I_INCL WITH KEY = <F>.
    IF SY-SUBRC NE 0.
    MOVE <F> TO I_INCL-NAME.
    move 1 to i_include-count.
    collect i_include.
    APPEND I_INCL.
    ENDIF.
    ENDIF.
    ENDFORM.
    / Download table S. */
    FORM DOWNLOAD_DATA.
    CLEAR TXLINE.
    WRITE 'Downloading ' TO TXLINE.
    WRITE R1-NAME TO TXLINE+12.
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
    PERCENTAGE = 0
    TEXT = TXLINE
    EXCEPTIONS
    OTHERS = 1.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    FILENAME = FN3
    FILETYPE = 'ASC'
    TABLES
    DATA_TAB = S.
    ENDFORM.
    / Download Binary files H1 */
    FORM DOWNLOAD_BIN_H1.
    DESCRIBE FIELD H1 LENGTH J.
    DESCRIBE TABLE H1 LINES I.
    NR_OF_BYTES = I * J.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    FILENAME = FN1
    FILETYPE = 'BIN'
    BIN_FILESIZE = NR_OF_BYTES
    IMPORTING
    FILELENGTH = FILESIZE
    TABLES
    DATA_TAB = H1.
    ENDFORM.
    / Download Binary files F1 */
    FORM DOWNLOAD_BIN_F1.
    DESCRIBE FIELD F1 LENGTH J.
    DESCRIBE TABLE F1 LINES I.
    NR_OF_BYTES = I * J.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    FILENAME = FN2
    FILETYPE = 'BIN'
    BIN_FILESIZE = NR_OF_BYTES
    IMPORTING
    FILELENGTH = FILESIZE
    TABLES
    DATA_TAB = F1.
    ENDFORM.
    / Upload data from file .EEE */
    FORM UPLOAD_EEE.
    CLEAR TXLINE.
    WRITE 'Uploading ' TO TXLINE.
    WRITE R1-NAME TO TXLINE+10.
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
    PERCENTAGE = 0
    TEXT = TXLINE
    EXCEPTIONS
    OTHERS = 1.
    MOVE 'Y' TO FIRST-TIME.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    FILENAME = FN3
    FILETYPE = 'ASC'
    IMPORTING
    FILELENGTH = NR_OF_BYTES
    TABLES
    DATA_TAB = S1.
    LOOP AT S1.
    IF S1-TXT(4) = '????'.
    MOVE S1-TXT(8) TO NEW-FUNC.
    IF FIRST-TIME = 'Y'.
    MOVE S1-TXT(8) TO OLD-FUNC.
    MOVE 'N' TO FIRST-TIME.
    ELSE.
    PERFORM STORE_COMPONENT.
    MOVE NEW-FUNC TO OLD-FUNC.
    ENDIF.
    ENDIF.
    IF S1-TXT(4) NE '????'.
    PERFORM REBUILD-COMPONENT.
    ENDIF.
    ENDLOOP.
    PERFORM STORE_COMPONENT. "last component still to be processed
    PERFORM REBUILD-CUA. "re-build CUA, statuses, pfk etc
    ENDFORM.
    / Upload Dynpro headers (HHH) and fields (FFF) */
    / titles and dynpro logic is contained in file .EEE */
    / and has already been processed. */
    FORM UPLOAD_HHH.
    CASE REL3.
    WHEN 'X'.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    FILENAME = FN1
    FILETYPE = 'BIN'
    IMPORTING
    FILELENGTH = NR_OF_BYTES
    TABLES
    DATA_TAB = H2.
    LOOP AT H2.
    MOVE H2-CNAME TO H1-NAME.
    MOVE H2-CNUM TO H1-NUMBER.
    MOVE H2-NNAME TO H1-PROG.
    MOVE H2-NNUM TO H1-DNUM.
    MOVE H2-CTIM TO H1-TGEN.
    WRITE '19' TO H1-DGEN(2).
    WRITE H2-CDAT TO H1-DGEN+2(6).
    WRITE H2-FILL TO H1+88(39).
    APPEND H1.
    ENDLOOP.
    WHEN OTHERS.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    FILENAME = FN1
    FILETYPE = 'BIN'
    IMPORTING
    FILELENGTH = NR_OF_BYTES
    TABLES
    DATA_TAB = H1.
    ENDCASE.
    LOOP AT H1.
    MOVE H1-NAME TO T-NAME.
    MOVE H1-NUMBER TO T-NUMBER.
    APPEND T.
    ENDLOOP.
    ENDFORM.
    / Upload Binary file F1 - Dynpro fields */
    FORM UPLOAD_FFF.
    CASE REL3.
    WHEN 'X'.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    FILENAME = FN2
    FILETYPE = 'BIN'
    IMPORTING
    FILELENGTH = NR_OF_BYTES
    TABLES
    DATA_TAB = F2.
    LOOP AT F2.
    OLD_F1 = F2.
    APPEND OLD_F1.
    ENDLOOP.
    LOOP AT OLD_F1.
    MOVE-CORRESPONDING OLD_F1 TO F1.
    APPEND F1.
    ENDLOOP.
    WHEN OTHERS.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    FILENAME = FN2
    FILETYPE = 'BIN'
    IMPORTING
    FILELENGTH = NR_OF_BYTES
    TABLES
    DATA_TAB = F1.
    ENDCASE.
    ENDFORM.
    / Re-construct data from file .EEE */
    FORM REBUILD-COMPONENT.
    CASE OLD-FUNC.
    WHEN '????LOGC'. "Dynpro LOGIC.
    CASE REL3.
    WHEN 'X'.
    SHIFT S1-TXT+8 RIGHT BY 32 PLACES.
    ENDCASE.
    MOVE S1-TXT TO E1.
    APPEND E1.
    / Load ABAP Source code, CUA, pfkeys etc to int tables */
    WHEN '????SRCE'.
    MOVE S1-TXT TO S-TXT.
    APPEND S.
    CASE INCLUDES. "Included file wanted
    WHEN 'Y'.
    PERFORM SCAN4-INCLUDES.
    ENDCASE.
    if restoring / uploading rel 3.1 or lower different cua tables
    are used. At generate CUA time these will be converted by the
    system to rel 4.0
    WHEN '????STAT'.
    CASE REL3.
    WHEN 'X'.
    MOVE S1-TXT TO OLD_STA.
    APPEND OLD_STA.
    WHEN SPACE.
    MOVE S1-TXT TO STA.
    APPEND STA.
    ENDCASE.
    MOVE 'Y' TO CUA-FLAG.
    WHEN '????FUNC'.
    CASE REL3.
    WHEN 'X'.
    MOVE S1-TXT TO OLD_FUN.
    APPEND OLD_FUN.
    WHEN SPACE.
    MOVE S1-TXT TO FUN.
    APPEND FUN.
    ENDCASE.
    MOVE 'Y' TO CUA-FLAG.
    WHEN '????MEN1'.
    CASE REL3.
    WHEN 'X'.
    MOVE S1-TXT TO OLD_MEN.
    APPEND OLD_MEN.
    WHEN SPACE.
    MOVE S1-TXT TO MEN.
    APPEND

  • How to download a file to a predefined directory...

    Hi,
    I would like to download a file to a predefined directory, ie, instead of the prompt of asking the user, the directory to which he should download the file I would like to the temp folder of windows or any other directory...
    Can anyone please tell me how to do this....
    Thanks in advance...

    hi,
    Due to security issues you can not get programmatic access to local folders with flex web based applications. With Air you can do this as it behaves as a normal desktop application. One workaround which is only of value if the file you want to save is specifically going to be used by the app is to use shared Objects, even this will require user interaction the first time as the shared objects have a fairly small allowable space for saving and the user will be prompted to update that value if required.
    David.

  • Craete a simple abap object to select data from a table and display

    Hi,
    I know the concept of abap objects but i never worked on it,
    can any one give me simple example of how to create an abap object to display data from mara table.also please send me documents or info regd ABAP OBJECTS.
    I want to write a simple report in terms of abap object
    Regards,
    Sowjanya

    hi,
    Here is hte sample program in se38.
    REPORT ZFGLI00003
    *-- Include for data declarations and performs
    include ZFGLI00003_f01.
    *--Include for Classes and their Implementation
    include ZFGLI00003_cl.
    *                selection-screen                                      *
    *-- Selection Values : Block1
    selection-screen begin of block b1 with frame title text-001.
    *--         Ledger
    parameters: p_rldnr  like zzprodnt-rldnr default 'NP'.
    *--         Fiscal year
    parameters: p_ryear  like zzprodnt-ryear.
    *--         Period(month)
    parameters: p_rpmax  like zzprodnt-rpmax.
    selection-screen end of block b1.
    *-- Selection Values : Block2
    selection-screen begin of block b2 with frame title text-002.
    *--              Company ID's
    select-options : s_glcomp  for ZZPRODNT-ROBUKRS .
    *--              Profit Center
    select-options : s_prctr   for ZZPRODNT-RPRCTR .
    *--              Product Assignment
    select-options : s_prasn   for ZZPRODNT-RZZWWZ01 .
    *--              Corporate Brand
    select-options : s_crpbd   for ZZPRODNT-RZZWWZ05 .
    selection-screen end of block b2.
    *-- Selection Values : Block3  Download Options
    selection-screen begin of block b3 with frame title text-003.
    parameters : p_local radiobutton group 1,
                 p_unix  radiobutton group 1,
                 p_path  like rlgrap-filename obligatory
                         default 'C:P20Z_Formatted.txt'(009).
    selection-screen end of block b3.
    *            At Selection-Selection on value-request  for file path    *
    at selection-screen on value-request for p_path.
      if p_unix <> 'X'.
    *-- Getting F4 help for output file
        perform get_filename changing p_path.
      else.
        message i999(zi) with
              'Sorry !! Function not available for UNIX file.'(i01).
      endif.
    *-- At selection screen validations
    at selection-screen on p_path.
      if p_unix <> 'X'.
    *-- Validate local file
        if p_path+1(2) <> ':'.
          message e999(zi) with 'Invalid file path'(006).
        endif.
      else.
    *-- Validate unix file
        if p_path+0(1) <> '/'.
          message e999(zi) with 'Invalid file path'(006).
        endif.
      endif.
    *                   Initialization                                    *
    initialization.
    *-- Initialize the period
      perform init_period changing p_rpmax p_ryear.
    *                    start-of-selection                               *
    start-of-selection.
      data : o_tm1_intf type ref to lcl_tm1_intf.
      create object o_tm1_intf.
    *-- Extract the data from ZZPRODNT
      call method o_tm1_intf->get_data exporting e_rldnr  = p_rldnr
                                                 e_ryear  = p_ryear
                                                 e_rpmax  = p_rpmax
                                                 e_glcomp = s_glcomp[]
                                                 e_prctr  = s_prctr[]
                                                 e_prasn  = s_prasn[]
                                                 e_crpbd  = s_crpbd[]
                                       importing i_subrc  = v_subrc.
    *   INCLUDE ZFGLI00003_CL                                              *
    *       CLASS lcl_tm1_intf IMPLEMENTATION
    class lcl_tm1_intf definition.
      public section.
    *-- Data Declaration
        data  : lv_date     type sy-datum,       "Date
                lv_time     type sy-uzeit,       "Time
                lv_count    type i,              "Count for total records
                lv_acsline  type zfgl014-acsline,"ACS line code
                lv_amt_curr type zzprodnt-kslvt, "current month amount
                lv_amt_ytd  type zzprodnt-kslvt, "YTD Amount
                lv_check,                        "check if any record is
                                                 "downloaded
                lv_msg(100),                     "message
                lv_count_s(5)  ,                 "Count for total(char)
                lv_amt_curr_s(23),               "Current month amount(char)
                lv_amt_ytd_s(23),                "YTD Amount(char)
                lv_ksl_pd(17),                   "KSLxx
                lv_period(2) type n.             "month(period)
    *-- Types Declaration
        types : ty_rldnr type zzprodnt-rldnr,    "Type for Ledger
                ty_ryear type zzprodnt-ryear,    "Type for Fiscal Year
                ty_rpmax type zzprodnt-rpmax,    "Type for Period
                ty_glcomp type range of char4,   "Type for company selection
                ty_prctr type range of char10,   "Type for profit center sel
                ty_prasn type range of char6,    "Type for prod assignmt sel
                ty_crpbd type range of char4,    "Type for Corp Brand sel
                begin of ty_file,                "Type for File
                  line(150),
                end of ty_file,
                begin of ty_ZZPRODNT,            "Type-ledger summary table
                  company       type OBUKR,      "Company
                  gl_acct       type RACCT,      "GL Account
                  cst_ctr       type KOSTL,      "Cost Center
                  prt_ctr       type PRCTR,      "Profit Center
                  rfarea        type FKBER,      "Functional Area
                  wbs_ele       type PS_POSID,   "WBS Element
                  prd_***       type RKEG_WWZ01, "Product Assignment
                  corp_bd       type RKEG_WWZ05, "Corporate Brand
                  ksl01         type KSLXX9,     "Total of transactions - 01
                  ksl02         type KSLXX9,     "Total of transactions - 02
                  ksl03         type KSLXX9,     "Total of transactions - 03
                  ksl04         type KSLXX9,     "Total of transactions - 04
                  ksl05         type KSLXX9,     "Total of transactions - 05
                  ksl06         type KSLXX9,     "Total of transactions - 06
                  ksl07         type KSLXX9,     "Total of transactions - 07
                  ksl08         type KSLXX9,     "Total of transactions - 08
                  ksl09         type KSLXX9,     "Total of transactions - 09
                  ksl10         type KSLXX9,     "Total of transactions - 10
                  ksl11         type KSLXX9,     "Total of transactions - 11
                  ksl12         type KSLXX9,     "Total of transactions - 12
                  ksl13         type KSLXX9,     "Total of transactions - 13
                  ksl14         type KSLXX9,     "Total of transactions - 14
                  ksl15         type KSLXX9,     "Total of transactions - 15
                  ksl16         type KSLXX9,     "Total of transactions - 16
                end of ty_ZZPRODNT.
    *-- Structure Declaration
    *           Structure for final file
        data  : x_file         type ty_file,
    *           Structure for Product Ledger Summary table
                x_ZZPRODNT     type ty_ZZPRODNT,
    *           Structure for Functional Area to ACS line mapping
                x_zfgl014      type zfgl014.
    *-- Internal Table Declaration
    *           Table for records of Product Ledger Summary table
        data  : it_ZZPRODNT     type table of ty_ZZPRODNT,
    *           Table for final file
                it_file         type table of ty_file,
    *           Table for Functional Area to ACS line mapping
                it_zfgl014      type table of zfgl014.
    *-- Method Declaration.
        methods : get_data      importing e_rldnr  type ty_rldnr
                                          e_ryear  type ty_ryear
                                          e_rpmax  type ty_rpmax
                                          e_glcomp type ty_glcomp
                                          e_prctr  type ty_prctr
                                          e_prasn  type ty_prasn
                                          e_crpbd  type ty_crpbd
                                exporting i_subrc type sy-subrc.
    endclass.                    "lcl_tm1_intf DEFINITION
    *       CLASS lcl_tm1_intf IMPLEMENTATION
    class lcl_tm1_intf implementation.
    *-- Method get_data selects the North American Product Ledger Summary
    *   table data and then maps the Functional Area to ACS line to get
    *   the ACS line code
      method get_data.
    *-- Local Variable
        DATA: L_ZZPRODNT TYPE TY_ZZPRODNT.
    *-- Get the data from North American Product Ledger Summary table
        select robukrs
               racct
               rcntr
               rprctr
               rfarea
               rzzwbs_el
               rzzwwz01
               rzzwwz05
               ksl01
               ksl02
               ksl03
               ksl04
               ksl05
               ksl06
               ksl07
               ksl08
               ksl09
               ksl10
               ksl11
               ksl12
               ksl13
               ksl14
               ksl15
               ksl16
          from zzprodnt
          into table it_ZZPRODNT
         where rldnr    = e_rldnr
           and ryear    = e_ryear
           and rpmax    = e_rpmax
           and ROBUKRS  in e_glcomp
           and RPRCTR   in e_prctr
           and RZZWWZ01 in e_prasn
           and RZZWWZ05 in e_crpbd.
        if sy-subrc = 0.
          loop at it_ZZPRODNT into l_zzprodnt.
            condense l_ZZPRODNT-rfarea no-gaps.
            if l_ZZPRODNT-rfarea is initial.
              delete it_ZZPRODNT.
            endif.
          endloop.
    *-- Get the Functional Area to ACS line code mapping data
          select *
            from zfgl014
            into table it_zfgl014
             for all entries in it_ZZPRODNT
           where fkber = it_ZZPRODNT-rfarea .
          if sy-subrc = 0.
          endif.
        endif.
        i_subrc = sy-subrc.
      endmethod.                    "get_data
    endclass.                    "lcl_tm1_intf IMPLEMENTATION
    *   INCLUDE ZFGLI00003_F01                                             *
    *                             Table
    tables : zzprodnt.
    *                          Data Declaration
    data : v_subrc type sy-subrc.
    *&      Form  get_filename
    *  Description : This subroutine is used for F4 Prompting
    form get_filename changing p_path like rlgrap-filename.
    *-- Local variables
      data : lv_file  like ibipparms-path, "Local file for upload/download
             lv_repid like syst-cprog,     "ABAP program, caller in external
                                           "procedures
             lv_dynnr type syst-dynnr.     "Current screen No
      lv_repid = syst-cprog.
      lv_dynnr = syst-dynnr.
    *-- Function module used for F4 help
      call function 'F4_FILENAME'
           exporting
                program_name  = lv_repid
                dynpro_number = lv_dynnr
           importing
                file_name     = lv_file.
      move lv_file to p_path.
    endform.                    " get_filename
    *&      Form  init_period
    FORM init_period changing p_rpmax p_ryear.
      if sy-datum+4(2) = 01.
        p_rpmax = 12.
        p_ryear = sy-datum+0(4) - 1.
      else.
        p_rpmax = sy-datum+4(2) - 1.
        p_ryear = sy-datum+0(4).
      endif.
    ENDFORM.                    " init_period
    Hope this helps.
    Regards,
    Richa

Maybe you are looking for