It is possible to write abap programming lines in text element

Hi experts,
                   Can we write abap programming lines(loop command etc....) in text element in smart forms.
Thanks in adavnce,
Nag.
Moderator message: please search for available information/documentation.
Edited by: Thomas Zloch on May 17, 2011 11:44 AM

The lines on the DIO port respond to trhe MOMO (Must On, Must Off) protocol which is a tri state protocol. This allows each line on the DIO ports to be used individually. The lines, however, are by default static DIO which means that if you want to create a pulse train in them you must do it through a software routine where you change the states every time the set dio port momo call is executed. Another option is to use the PWM ouptut lines available on this port. You can use the lines specified as PWM outputs (check the 7344 hardware manual for this) so that in MAX you can generate a continous pulse train and then you can use NI-Motion's PWM fucntions to control the frequency and duty cycle of the train.

Similar Messages

  • Runtime error:ABAP program lines are longer than the internal table

    Hi all,
    Below is the code I have written,when Iam running it Iam getting
    'ABAP program lines are longer than the internal table' runtime error.How can I resolve it.
    REPORT  ZTEST1  NO STANDARD PAGE HEADING LINE-SIZE 255.
    TABLES:MARC,CDHDR,CDPOS.
    TYPE-POOLS:SLIS.
    DATA:HEADER TYPE SLIS_T_FIELDCAT_ALV,
         WA TYPE SLIS_FIELDCAT_ALV,
         LAYOUT TYPE SLIS_LAYOUT_ALV.
    TYPES:BEGIN OF MARC_TY,
            MATNR LIKE MARC-MATNR,
            WERKS LIKE MARC-WERKS,
            EKGRP LIKE MARC-EKGRP,
            MINBE LIKE MARC-MINBE,
            EISBE LIKE MARC-EISBE,
            MABST LIKE MARC-MABST,
           END OF MARC_TY.
    TYPES:BEGIN OF MATNR1_TY,
            MATNR1 LIKE CDHDR-OBJECTID,
          END OF MATNR1_TY.
    TYPES:BEGIN OF CDHDR_TY,
             OBJECTCLAS LIKE CDHDR-OBJECTCLAS,
             OBJECTID   LIKE CDHDR-OBJECTID,
             CHANGENR   LIKE CDHDR-CHANGENR,
             USERNAME   LIKE CDHDR-USERNAME,
             UDATE      LIKE CDHDR-UDATE,
            END OF CDHDR_TY.
    TYPES:BEGIN OF CDPOS_TY,
             OBJECTCLAS LIKE CDPOS-OBJECTCLAS,
             OBJECTID   LIKE CDPOS-OBJECTID,
             CHANGENR   LIKE CDPOS-CHANGENR,
             TABNAME    LIKE CDPOS-TABNAME,
             FNAME      LIKE CDPOS-FNAME,
             CHNGIND    LIKE CDPOS-CHNGIND,
             VALUE_NEW  LIKE CDPOS-VALUE_NEW,
             VALUE_OLD  LIKE CDPOS-VALUE_OLD,
            END OF CDPOS_TY.
    **************TABLE TYPES********************************************
    TYPES: MARC_TAB   TYPE TABLE OF MARC_TY,
           MATNR1_TAB TYPE TABLE OF MATNR1_TY,
           CDHDR_TAB  TYPE TABLE OF CDHDR_TY,
           CDPOS_TAB  TYPE TABLE OF CDPOS_TY.
    *******************INTERNAL TABLES************************************
    DATA:MARC_ITAB   TYPE MARC_TAB,
         MATNR1_ITAB TYPE MATNR1_TAB,
         CDHDR_ITAB  TYPE CDHDR_TAB,
         CDPOS_ITAB  TYPE CDPOS_TAB.
    ****************WORK AREAS********************************************
    DATA:MARC_WA   TYPE MARC_TY,
         MATNR1_WA TYPE MATNR1_TY,
         CDHDR_WA  TYPE CDHDR_TY,
         CDPOS_WA  TYPE CDPOS_TY.
    *******************SELECTION-SCREEN***********************************
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
      PARAMETERS:PLANT LIKE MARC-WERKS.
      SELECT-OPTIONS:MATERIAL FOR MARC-MATNR.
      SELECT-OPTIONS:DATE FOR CDHDR-UDATE.
    SELECTION-SCREEN END OF BLOCK B1.
    START-OF-SELECTION.
    SELECT MATNR
            WERKS
            EKGRP
            MINBE
            EISBE
            MABST
            FROM MARC INTO TABLE MARC_ITAB
            WHERE MATNR IN MATERIAL
            AND WERKS = PLANT.
      CHECK MARC_ITAB[] IS NOT INITIAL.
      LOOP AT MARC_ITAB INTO MARC_WA.
       MATNR1_WA-MATNR1 = MARC_WA-MATNR.
       APPEND MATNR1_WA TO MATNR1_ITAB.
       CLEAR MATNR1_WA.
    ENDLOOP.
    CHECK MATNR1_ITAB[] IS NOT INITIAL.
    SELECT OBJECTCLAS
            OBJECTID
            CHANGENR
            USERNAME
            UDATE
            FROM CDHDR INTO TABLE CDHDR_ITAB
            FOR ALL ENTRIES IN MATNR1_ITAB
            WHERE OBJECTCLAS = 'MATERIAL'
            AND OBJECTID = MATNR1_ITAB-MATNR1
            AND UDATE IN DATE.
    CHECK CDHDR_ITAB[] IS NOT INITIAL.
    SORT CDHDR_ITAB[]  DESCENDING BY OBJECTID  CHANGENR.
    DELETE ADJACENT DUPLICATES FROM CDHDR_ITAB[] COMPARING OBJECTID.
    SELECT OBJECTCLAS
           OBJECTID
           CHANGENR
           TABNAME
           FNAME
           CHNGIND
           VALUE_NEW
           VALUE_OLD
           FROM CDPOS INTO CORRESPONDING FIELDS OF TABLE CDPOS_ITAB
           FOR ALL ENTRIES IN CDHDR_ITAB
           WHERE OBJECTCLAS = CDHDR_ITAB-OBJECTCLAS
           AND OBJECTID = CDHDR_ITAB-OBJECTID
           AND CHANGENR = CDHDR_ITAB-CHANGENR
           AND TABNAME  = 'MARC'
           AND FNAME    IN ('MINBE','EISBE','MABST','LVORM')
           AND CHNGIND  = 'U'.
    CHECK CDPOS_ITAB[] IS NOT INITIAL.
    *LOOP AT CDPOS_ITAB INTO CDPOS_WA.
    WRITE: / CDPOS_WA-OBJECTCLAS,
             CDPOS_WA-OBJECTID,
             CDPOS_WA-CHANGENR,
             CDPOS_WA-TABNAME,
             CDPOS_WA-FNAME,
             CDPOS_WA-CHNGIND,
             CDPOS_WA-VALUE_NEW,
             CDPOS_WA-VALUE_OLD.
    *ENDLOOP.
    WA-SELTEXT_L = 'OBJECTCLAS'.
    WA-COL_POS   = '1'.
    WA-FIELDNAME = 'OBJECTCLAS'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '15'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'OBJECTID'.
    WA-COL_POS   = '2'.
    WA-FIELDNAME = 'OBJECTID'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '20'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'CHANGENR'.
    WA-COL_POS   = '3'.
    WA-FIELDNAME = 'CHANGENR'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '8'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'TABNAME'.
    WA-COL_POS   = '4'.
    WA-FIELDNAME = 'TABNAME'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '5'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'FNAME'.
    WA-COL_POS   = '5'.
    WA-FIELDNAME = 'FNAME'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '7'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'CHANGING'.
    WA-COL_POS   = '6'.
    WA-FIELDNAME = 'CHANGING'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '1'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'VALUE_NEW'.
    WA-COL_POS   = '7'.
    WA-FIELDNAME = 'VALUE_NEW'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '5'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'VALUE_OLD'.
    WA-COL_POS   = '8'.
    WA-FIELDNAME = 'VALUE_OLD'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '5'.
    APPEND WA TO HEADER.
    CLEAR WA.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
        I_PROGRAM_NAME               = SY-REPID
        I_INTERNAL_TABNAME           = 'CDPOS_ITAB'
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_INCLNAME                   = SY-REPID
      CHANGING
        CT_FIELDCAT                  = HEADER[]
    EXCEPTIONS
    IF SY-SUBRC <> 0.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM                = SY-REPID
        IT_FIELDCAT                       = HEADER[]
      TABLES
        T_OUTTAB                          = CDPOS_ITAB[]
    IF SY-SUBRC <> 0.
    ENDIF.

    Your select querry on MARC is not matching with MARC_TY.
    The field in the MARC table and MARC_TY should be same.
    and also, when you are making select querry on CDPOS table
    with all entries.
    When ever you are using all entries select statement, you should check whether the internal table is having value.
    you should check
    if CDPOS_IT[] is not initial.
    SELECT OBJECTCLAS
    OBJECTID
    CHANGENR
    TABNAME
    FNAME
    CHNGIND
    VALUE_NEW
    VALUE_OLD
    FROM CDPOS INTO CORRESPONDING FIELDS OF TABLE CDPOS_ITAB
    FOR ALL ENTRIES IN CDHDR_ITAB
    WHERE OBJECTCLAS = CDHDR_ITAB-OBJECTCLAS
    AND OBJECTID = CDHDR_ITAB-OBJECTID
    AND CHANGENR = CDHDR_ITAB-CHANGENR
    AND TABNAME = 'MARC'
    AND FNAME IN ('MINBE','EISBE','MABST','LVORM')
    AND CHNGIND = 'U'.
    endif.
    Regards
    Madhan D

  • I want to write ABAP Program in web dynpro Using se80 tra.code

    hi
    I want to write ABAP Program in web dynpro Using se80 tra.code and to Create URL for the same.
    Please let me know the steps to do.
    Thanks

    Hi Shiva,
    I understood ,  you want to create a Webdynpro Applicaiton and run it.
    this will help you
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cb243c45-0801-0010-eb9c-88669007f130
    Regards
    Abhimanyu

  • HOW TO WRITE ABAP PROGRAMMING IN JAVA BY USING NETWEAVER

    HI,
    i am working with bapi(mean is calling bapis in my java programs).
    please tell me the how to write abap programs in nwds
    Thanqqqqqqqqq
    Guru

    Hi,
    Refer the following links..
    http://manuals.sybase.com/onlinebooks/group-iaw/iag0203e/iadgen2/@Generic__BookTextView/24685
    and this blog
    /people/kathirvel.balakrishnan2/blog/2005/07/26/remote-enable-your-rfchosttoip-to-return-host-ip-to-jco
    Regards,
    Uma

  • Is it possible to write a program to unzip files in pl/sql or sql ?

    Morning Experts,
    I have a zip file on my Host which contains a list of files(reports). Each of those files have a distinct name and i have already written the codes to retreive data from those files.
    My oracle is installed on a linux server
    Now my question is as follows:
    is it possible to write a program in sql to unzip those .zip files (located on my host) and stores its content in that same folder?
    Thanks

    You can use Java like this:CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "Zipper"
    AS import java.io.ByteArrayInputStream;
    import java.io.IOException;
    import java.util.zip.ZipInputStream;
    import java.util.zip.ZipEntry;
    public class Zipper {
       public static String unzip(byte[] pBuf) throws IOException {
          ZipInputStream in = new ZipInputStream(new ByteArrayInputStream(pBuf));
          ZipEntry ze;
          byte[] buf = new byte[2048];
          StringBuffer stribu = new StringBuffer(pBuf.length * 5);
          while((ze = in.getNextEntry()) != null) {
             int bytesRead;
             while((bytesRead = in.read(buf, 0, 2048)) > 0) {
                for(int i = 0; i < bytesRead; i++) {
                   stribu.append((char)buf);
    in.closeEntry();
    in.close();
    return stribu.toString();
    CREATE OR REPLACE FUNCTION unzip(
    pData IN RAW)
    RETURN VARCHAR2
    AS
    LANGUAGE JAVA
    NAME 'Zipper.unzip(byte[]) return java.lang.String';
    In this example you can pass the content of a reltively small zip file and get the contents as VARCHAR2.
    It's just to show where to start.
    Hth, Urs                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to copy/download  all ABAP programs in a text with a single report  ?

    How to copy/download  all ABAP programs in a text format with a single report/TC  ?
    How to copy/download  ABAP source code with all include programs ?....
    we need to search & copy all include programs everytime....

    Hi,
    check this link
    downloading programs
    Regards

  • The ABAP program lines are wider than the internal table.

    Hello;
    i use FM REUSE_ALV_FIELDCATALOG_MERGE to fill in fieldcat from an internal table but i receive dump message  READ_REPORT_LINE_TOO_LONG. Is there smt. like a type mismatch or waht can that be?
    detail explanation of the dump is
    The internal table "\FUNCTION=K_KKB_FIELDCAT_MERGE\DATA=L_ABAP_SOURCE[]" is 72 characters wide. The program line is                                              
    81 characters wide.                                                                
    source of the call is like:
    DATA: ALV_FIELDCAT     TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          ALV_HEADER       TYPE SLIS_T_LISTHEADER WITH HEADER LINE,
          ALV_EVENTS       TYPE SLIS_T_EVENT WITH HEADER LINE,
          ALV_LAYOUT       TYPE SLIS_LAYOUT_ALV,
          ALV_PRINT        TYPE SLIS_PRINT_ALV,
          ALV_REPID        LIKE SY-REPID,    " program name
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          I_PROGRAM_NAME     = alv_repid
          I_INTERNAL_TABNAME = 'ITAB'
          I_INCLNAME         = alv_repid
        CHANGING
          CT_FIELDCAT        = alv_fieldcat[]
        EXCEPTIONS
          OTHERS             = 3.
    thx in advance
    Ali

    Hi,
    At least one line of the source text is longer than the lines of the internal table itab then,
    READ_REPORT_LINE_TOO_LONG.  error occurs.
    Cause: At least one line of the source text is longer than the lines of the internal table itab.
    Runtime Error: READ_REPORT_LINE_TOO_LONG
    check the link below for further info
    http://www.s001.org/ABAP-Hlp/abapread_report.htm
    one more thing, whether u have given report name
    ALV_REPID = 'ZXYZ'.  
    if ZXYZ is u r program name

  • Message: The ABAP program lines are wider than the internal table.

    sorry for stupid question.... can you please tell me what I need to check?
    The internal table "\FUNCTION=K_KKB_FIELDCAT_MERGE\DATA=L_ABAP_SOURCE[]" is 72
    characters wide. The program line is
    75 characters wide.
    Uf, I can't find the mistake
    BR

    Hi,
    please try to change some settings and see ...
    SE38->program->Display->Utilities->Settings->Abapeditor->editor, check the last check box (downwards-Comp Line Length)...
    If you are using merge fundtion module try to delcare the final internal table like this
    data : BEGIN OF i_final OCCURS 0,
            matnr LIKE mara-matnr,       "Material Number
            maktx LIKE makt-maktx,       "Material Description
            END OF i_final.
    Regards,
    Nagaraj

  • I want recover in ABAP program a "Long Text"

    Hi, 
    In FB01 transaction when you go to "Enter Fixed Asset posting: Correct G/L account item", there are a button with a label: "Long Text". When you push this button appear a little window with name "Long Text for Document Line Item" and you can write a long note for a document. I want to recover this long note in a ABAP program. I want know where SAP keeps this texts and how I can recover it. 
    A lot of thanks in advance. 
    Regards.

    Now, my code is:
    report zutil060.
    data: l_thead like thead.
    data: it_text like  tline occurs 0 with header line.
    call function 'ZREAD_TEXT'
         exporting
              id       = '0001'
              language = sy-langu
              name     = 'EV1000000811282006001'
              object   = 'DOC_ITEM'
         tables
              lines    = it_text.
      l_thead-tdobject = 'DOC_ITEM'.
      l_thead-tdspras = 'ES'.
      l_thead-tdid = '0001'.
      l_thead-tdname = 'EV1000000811282006001'.
      refresh it_text.
      clear it_text.
      it_text-tdline = 'Hola caracola'.
      it_text-TDFORMAT = '*'.
      append it_text.
      call function 'SAVE_TEXT'
        exporting
          client          = sy-mandt
          header          = l_thead
         insert          = 'X'
          savemode_direct = 'X'
        tables
          lines           = it_text
        exceptions
          id              = 1
          language        = 2
          name            = 3
          object          = 4
          others          = 5.
      if sy-subrc <> 0.
      write:/ sy-subrc.
      endif.
    If i comment "insert          = 'X'" sy-subrc is 0 but text note dont change.
    My finally mission is to makes an interface (ABAP program) and this program should pick up the long notes from another system and to create new ABAP notes.
    Now i only need to know how i can insert or change a new long note.
    a lot of thanks for your time.
    regards.

  • Problem in line items(text elements printing) in smartform

    Hi all
    Here iam printing line item data in invoice form
    around 7 fields(text elements) iam having  the fileds are displaying one by one
    I need to diplay all 7 fields one after another with some gaps in the same line
    can u please let me know how to do it with text elements
    thank you

    Hi,
      create a table. In once line type(Line type 1)  create 7 different cells (Columns) for a single row.
    For eg:
    Line typ1 :  cell1 cell2 cell3 cell4 cell5 cell6 cell 7.
    cell1 : &mara-matnr&
    cell2 : &mara-ersda&.
    like soon in 7 different cells.
    Br,
    Laxmi.

  • How to write to multiple lines in text item?

    I tried to write 2 lines in the text item, however only return one line:
    :myqueues.queue :=      'hello' || chr(10) ||'world';
    It gives me only 'hello' in the first line and nothing else in the 2nd line.
    Is there any settings needs to be activated in the property of text item?

    I'm reading a file and imports the strings:
    DECLARE
         v_filename VARCHAR(50);
         v_handle text_io.file_type;
         readline varchar(50);
    BEGIN
         v_filename := get_file_name(file_filter=>'All files(*.*)|*.txt|');
         v_handle := text_io.fopen(v_filename, 'r');
    text_io.get_line(v_handle, readline);
    :myqueues.queue := rtrim(readline);
    text_io.get_line(v_handle, readline);
    :myqueues.queue := :myqueues.queue || chr(10) || rtrim(readline) ;
    text_io.get_line(v_handle, readline);
    :myqueues.queue := :myqueues.queue || chr(10) || rtrim(readline) ;
         text_io.get_line(v_handle, readline);
    :myqueues.queue := :myqueues.queue || chr(10) || rtrim(readline) ;
         text_io.fclose(v_handle);
    END;
    This function reads the file and returns 4 strings, each of which takes one line in one record of text item.
    My question is: can I get 4 records, assigning each with one string from the input file?
    Thanks a lot.

  • Does it possible to modify calendar object into a text element?

    hi to everyone....
    i have to create a stupid function that show me sysdate -1 year....
    (today is 10/15/2012)... i want to see 10/15/2011.
    in sql i get this date with this simple syntax:
    select TRUNC (ADD_MONTHS (SYSDATE, -12)) from dual
    how can i add this field into the report?
    i saw there is also an object that show me the calendar where i can change the format... can i make some kind of changing using this object?
    can i see oct/15/2011?
    thanks guys

    hi to everyone....
    i have to create a stupid function that show me sysdate -1 year....
    (today is 10/15/2012)... i want to see 10/15/2011.
    in sql i get this date with this simple syntax:
    select TRUNC (ADD_MONTHS (SYSDATE, -12)) from dual
    how can i add this field into the report?
    i saw there is also an object that show me the calendar where i can change the format... can i make some kind of changing using this object?
    can i see oct/15/2011?
    thanks guys

  • Download/Upload ABAP Programs, screens, texts, etc

    Hi Experts,
    Is there any standard program or any tool by which we can download/ upload ABAP programs, sapscripts, Screens, text-elements, Webdynpro for ABAP applications to a local file????
    The Download to local server option in SE38 just gives a text copy of program without any screens, text eleemnts, etc which is not as per my requirement.
    Points will be rewarded.
    Regards,
    Mansi.

    use This
    REPORT  ZDOWNLOAD.
    *& Report  ZDOWNLAOD
                     I N F O R M A T I O N                            *
    Module             :
    FUNCTIONAL         :
    Developer          :
    Functional Spec#   :
    Date Of Creation   :
    Transport Request# :
    Program NAME       :
    Transaction Code   :
    DEVELOPMENT CLASS  :
    DESCRIPTION        :
                     Change History
    FUNCTIONAL         :
    Developer          :
    Functional Spec#   :
    Date Of Change     :
    Transport Request# :
    Change DESCRIPTION :
    *======================================================================================================================
    Direct Download Enterprise version 1.3.1.
    THIS SOFTWARE IS FOR PERSONAL USE ONLY.
    THIS PROGRAM IS FREEWARE AND IS PROVIDED ON AN AS-IS BASIS WITHOUT WARRANTY OF ANY KIND.
    THE PROVIDER SPECIFICALLY DISCLAIMS ANY OTHER WARRANTY, EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY
    OR FITNESS FOR A PARTICULAR PURPOSE.
    IN NO EVENT SHALL THE PROVIDER BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, SPECIAL OR INCIDENTAL DAMAGES, EVEN IF PROVIDER
    HAS BEEN ADVISED BY CLIENT OF THE POSSIBILITY OF SUCH POTENTIAL LOSS OR DAMAGE.
    CLIENT AGREES TO HOLD PROVIDER HARMLESS FROM AND AGAINST ANY AND ALL CLAIMS, LOSSES, LIABILITIES AND EXPENSES.  BY
    INSTALLING OR RUNNING THIS PROGRAM YOU ARE AGREEING TO THE TERMS AND CONDITONS STATED ABOVE.
    PROGRAM DESCRIPTION & USE
    Allows a user to download programs, Functions, DD definitions, etc to the presentation server.  This version searches
    recursively for nested includes and function modules, and allows you to download the resulting code as standard text
    or HTML web pages within a suitable directory structure.
    You can either search by object name, using wildcards if you wish, or a combination of Author and object name.  If
    you want all objects returned for a particular author then select the author name and choose the most suitable
    radiobutton.  All objects will be returned if the fields to the right hand side of the radiobutton are left completely
    blank.
    Compatible with R/3 Enterprise only, for older versions of SAP you will need Direct Download version 5.xx.
    This version removes the programming limitations imposed by developing across SAP releases 3 to 4.6.
    In order to be able to download files to the SAP server you must first set up a logical filepath within transaction
    'FILE', or use an existing one.  You must also create a external operating system command in SM69 called ZMKDIR. This
    will then be used to create any directories needed on the SAP server
    This program is intended to allow a person to keep a visual representation of a program for backup purposes only as
    has not been designed to allow programs to be uploaded to SAP systems.
    author          : E.G.Mellodew
    program cont
    SAP Tables
    TABLES: TRDIR, SEOCLASS, TFDIR, ENLFDIR, DD02L.
    Types
    text element structure
    TYPES: TTEXTTABLE LIKE TEXTPOOL.
    GUI titles
    TYPES: TGUITITLE LIKE D347T.
    Message classes
    TYPES: BEGIN OF TMESSAGE,
             ARBGB LIKE T100-ARBGB,
             STEXT LIKE T100A-STEXT,
             MSGNR LIKE T100-MSGNR,
             TEXT  LIKE T100-TEXT,
           END OF TMESSAGE.
    Screen flow.
    TYPES: BEGIN OF TSCREENFLOW,
             SCREEN LIKE D020S-DNUM,
             CODE LIKE D022S-LINE,
           END OF TSCREENFLOW.
    Holds a table\structure definition
    TYPES: BEGIN OF TDICTTABLESTRUCTURE,
             FIELDNAME LIKE DD03L-FIELDNAME,
             POSITION  LIKE DD03L-POSITION,
             KEYFLAG   LIKE DD03L-KEYFLAG,
             ROLLNAME  LIKE DD03L-ROLLNAME,
             DOMNAME   LIKE DD03L-DOMNAME,
             DATATYPE  LIKE DD03L-DATATYPE,
             LENG      LIKE DD03L-LENG,
             DDTEXT    LIKE DD04T-DDTEXT,
           END OF TDICTTABLESTRUCTURE.
    Holds a tables attributes + its definition
    TYPES: BEGIN OF TDICTTABLE,
             TABLENAME    LIKE DD03L-TABNAME,
             TABLETITLE   LIKE DD02T-DDTEXT,
             ISTRUCTURE TYPE TDICTTABLESTRUCTURE OCCURS 0,
           END OF TDICTTABLE.
    Include program names
    TYPES: BEGIN OF TINCLUDE,
             INCLUDENAME LIKE TRDIR-NAME,
             INCLUDETITLE LIKE TFTIT-STEXT,
           END OF TINCLUDE.
    Exception class texts
    TYPES: BEGIN OF TCONCEPT,
             CONSTNAME TYPE STRING,
             CONCEPT TYPE SOTR_CONC,
           END OF TCONCEPT.
    Method
    TYPES: BEGIN OF TMETHOD,
             CMPNAME LIKE VSEOMETHOD-CMPNAME,
             DESCRIPT LIKE VSEOMETHOD-DESCRIPT,
             EXPOSURE LIKE VSEOMETHOD-EXPOSURE,
             METHODKEY TYPE STRING,
           END OF TMETHOD.
    Class
    TYPES: BEGIN OF TCLASS,
             SCANNED(1),
             CLSNAME LIKE VSEOCLASS-CLSNAME,
             DESCRIPT LIKE VSEOCLASS-DESCRIPT,
             MSG_ID LIKE VSEOCLASS-MSG_ID,
             EXPOSURE LIKE VSEOCLASS-EXPOSURE,
             STATE LIKE VSEOCLASS-STATE,
             CLSFINAL LIKE VSEOCLASS-CLSFINAL,
             R3RELEASE LIKE VSEOCLASS-R3RELEASE,
             IMETHODS TYPE TMETHOD OCCURS 0,
             IDICTSTRUCT TYPE TDICTTABLE OCCURS 0,
             ITEXTELEMENTS TYPE TTEXTTABLE OCCURS 0,
             IMESSAGES TYPE TMESSAGE OCCURS 0,
             ICONCEPTS TYPE TCONCEPT OCCURS 0,
             TEXTELEMENTKEY TYPE STRING,
             PUBLICCLASSKEY TYPE STRING,
             PRIVATECLASSKEY TYPE STRING,
             PROTECTEDCLASSKEY TYPE STRING,
             TYPESCLASSKEY TYPE STRING,
             EXCEPTIONCLASS TYPE I,
           END OF TCLASS.
    function modules
    TYPES: BEGIN OF TFUNCTION,
             FUNCTIONNAME LIKE TFDIR-FUNCNAME,
             FUNCTIONGROUP LIKE ENLFDIR-AREA,
             INCLUDENUMBER LIKE TFDIR-INCLUDE,
             FUNCTIONMAININCLUDE LIKE TFDIR-FUNCNAME,
             FUNCTIONTITLE LIKE TFTIT-STEXT,
             TOPINCLUDENAME LIKE TFDIR-FUNCNAME,
             PROGNAME LIKE TFDIR-PNAME,
             PROGRAMLINKNAME LIKE TFDIR-PNAME,
             MESSAGECLASS LIKE T100-ARBGB,
             ITEXTELEMENTS TYPE TTEXTTABLE OCCURS 0,
             ISELECTIONTEXTS TYPE TTEXTTABLE OCCURS 0,
             IMESSAGES TYPE TMESSAGE OCCURS 0,
             IINCLUDES TYPE TINCLUDE OCCURS 0,
             IDICTSTRUCT TYPE TDICTTABLE OCCURS 0,
             IGUITITLE TYPE TGUITITLE OCCURS 0,
             ISCREENFLOW TYPE TSCREENFLOW OCCURS 0,
           END OF TFUNCTION.
    TYPES: BEGIN OF TPROGRAM,
             PROGNAME LIKE TRDIR-NAME,
             PROGRAMTITLE LIKE TFTIT-STEXT,
             SUBC LIKE TRDIR-SUBC,
             MESSAGECLASS LIKE T100-ARBGB,
             IMESSAGES TYPE TMESSAGE OCCURS 0,
             ITEXTELEMENTS TYPE TTEXTTABLE OCCURS 0,
             ISELECTIONTEXTS TYPE TTEXTTABLE OCCURS 0,
             IGUITITLE TYPE TGUITITLE OCCURS 0,
             ISCREENFLOW TYPE TSCREENFLOW OCCURS 0,
             IINCLUDES TYPE TINCLUDE OCCURS 0,
             IDICTSTRUCT TYPE TDICTTABLE OCCURS 0,
           END OF TPROGRAM.
    Internal tables
    Dictionary object
    DATA: IDICTIONARY TYPE STANDARD TABLE OF TDICTTABLE WITH HEADER LINE.
    Function modules.
    DATA: IFUNCTIONS TYPE STANDARD TABLE OF TFUNCTION WITH HEADER LINE.
    Tree display structure.
    DATA: ITREEDISPLAY TYPE STANDARD TABLE OF SNODETEXT WITH HEADER LINE.
    Message class data
    DATA: IMESSAGES TYPE STANDARD TABLE OF TMESSAGE WITH HEADER LINE.
    Holds a single message class an all of its messages
    DATA: ISINGLEMESSAGECLASS TYPE STANDARD TABLE OF TMESSAGE WITH HEADER LINE.
    Holds program related data
    DATA: IPROGRAMS TYPE STANDARD TABLE OF TPROGRAM WITH HEADER LINE.
    Classes
    DATA: ICLASSES TYPE STANDARD TABLE OF TCLASS WITH HEADER LINE.
    Table of paths created on the SAP server
    DATA: ISERVERPATHS TYPE STANDARD TABLE OF STRING WITH HEADER LINE.
    Table prototypes
    DATA: DUMIDICTSTRUCTURE TYPE STANDARD TABLE OF TDICTTABLESTRUCTURE.
    DATA: DUMITEXTTAB TYPE STANDARD TABLE OF TTEXTTABLE.
    DATA: DUMIINCLUDES TYPE STANDARD TABLE OF TINCLUDE.
    DATA: DUMIHTML TYPE STANDARD TABLE OF STRING.
    DATA: DUMIHEADER TYPE STANDARD TABLE OF STRING .
    DATA: DUMISCREEN TYPE STANDARD TABLE OF TSCREENFLOW .
    DATA: DUMIGUITITLE TYPE STANDARD TABLE OF TGUITITLE.
    DATA: DUMIMETHODS TYPE STANDARD TABLE OF TMETHOD.
    DATA: DUMICONCEPTS TYPE STANDARD TABLE OF TCONCEPT.
      Global objects
    DATA: OBJFILE TYPE REF TO CL_GUI_FRONTEND_SERVICES.
    DATA: OBJRUNTIMEERROR TYPE REF TO CX_ROOT.
    Constants
    CONSTANTS: VERSIONNO TYPE STRING VALUE '1.3.1'.
    CONSTANTS: TABLES TYPE STRING VALUE 'TABLES'.
    CONSTANTS: TABLE TYPE STRING VALUE 'TABLE'.
    CONSTANTS: LIKE TYPE STRING VALUE 'LIKE'.
    CONSTANTS: TYPE TYPE STRING VALUE 'TYPE'.
    CONSTANTS: TYPEREFTO TYPE STRING VALUE 'TYPE REF TO'.
    CONSTANTS: STRUCTURE TYPE STRING VALUE 'STRUCTURE'.
    CONSTANTS: LOWSTRUCTURE TYPE STRING VALUE 'structure'.
    CONSTANTS: OCCURS TYPE STRING VALUE 'OCCURS'.
    CONSTANTS: FUNCTION TYPE STRING VALUE 'FUNCTION'.
    CONSTANTS: CALLFUNCTION TYPE STRING VALUE ' CALL FUNCTION'.
    CONSTANTS: MESSAGE TYPE STRING  VALUE 'MESSAGE'.
    CONSTANTS: INCLUDE TYPE STRING VALUE 'INCLUDE'.
    CONSTANTS: LOWINCLUDE TYPE STRING VALUE 'include'.
    CONSTANTS: DESTINATION TYPE STRING VALUE 'DESTINATION'.
    CONSTANTS: IS_TABLE TYPE STRING VALUE 'T'.
    CONSTANTS: IS_PROGRAM TYPE STRING VALUE 'P'.
    CONSTANTS: IS_SCREEN TYPE STRING VALUE 'S'.
    CONSTANTS: IS_GUITITLE TYPE STRING VALUE 'G'.
    CONSTANTS: IS_DOCUMENTATION TYPE STRING VALUE 'D'.
    CONSTANTS: IS_MESSAGECLASS TYPE STRING VALUE 'MC'.
    CONSTANTS: IS_FUNCTION TYPE STRING VALUE 'F'.
    CONSTANTS: IS_CLASS TYPE STRING VALUE 'C'.
    CONSTANTS: IS_METHOD TYPE STRING VALUE 'M'.
    CONSTANTS: ASTERIX TYPE STRING VALUE '*'.
    CONSTANTS: COMMA TYPE STRING VALUE ','.
    CONSTANTS: PERIOD TYPE STRING VALUE '.'.
    CONSTANTS: DASH TYPE STRING VALUE '-'.
    CONSTANTS: TRUE TYPE I VALUE 1.
    CONSTANTS: FALSE TYPE I VALUE 0.
    CONSTANTS: LT TYPE STRING VALUE '&lt;'.
    CONSTANTS: GT TYPE STRING VALUE '&gt;'.
    CONSTANTS: UNIX TYPE STRING VALUE 'UNIX'.
    CONSTANTS: NON_UNIX TYPE STRING VALUE 'not UNIX'.
    CONSTANTS: BACKGROUND_COLOUR TYPE STRING VALUE '#FFFFE0'.
    CONSTANTS: COLOUR_WHITE TYPE STRING VALUE '#FFFFFF'.
    CONSTANTS: COLOUR_BLACK TYPE STRING VALUE '#000000'.
    CONSTANTS: COLOUR_YELLOW TYPE STRING VALUE '#FFFF00'.
    CONSTANTS: COMMENT_COLOUR TYPE STRING VALUE '#0000FF'.
    CONSTANTS: HTMLEXTENSION TYPE STRING VALUE 'html'.
    CONSTANTS: TEXTEXTENSION TYPE STRING VALUE 'txt'.
    Global variables
    DATA: STATUSBARMESSAGE(100).
    DATA: FORCEDEXIT TYPE I VALUE 0.
    DATA: STARTTIME LIKE SY-UZEIT.
    DATA: RUNTIME LIKE SY-UZEIT.
    DATA: DOWNLOADFILEEXTENSION TYPE STRING.
    DATA: DOWNLOADFOLDER TYPE STRING.
    DATA: SERVERSLASHSEPARATOR TYPE STRING.
    DATA: FRONTENDSLASHSEPARATOR TYPE STRING.
    DATA: SLASHSEPARATORTOUSE TYPE STRING.
    DATA: SERVERFILESYSTEM TYPE FILESYS_D.
    DATA: SERVERFOLDER TYPE STRING.
    DATA: FRONTENDOPSYSTEM TYPE STRING.
    DATA: SERVEROPSYSTEM TYPE STRING.
    DATA: CUSTOMERNAMESPACE TYPE STRING.
    RANGES: SOPROGRAMNAME FOR TRDIR-NAME.
    RANGES: SOAUTHOR FOR USR02-BNAME.
    RANGES: SOTABLENAMES FOR DD02L-TABNAME.
    RANGES: SOFUNCTIONNAME  FOR TFDIR-FUNCNAME.
    RANGES: SOCLASSNAME FOR VSEOCLASS-CLSNAME.
    RANGES: SOFUNCTIONGROUP FOR ENLFDIR-AREA.
    FIELD-SYMBOLS: <WADICTSTRUCT> TYPE TDICTTABLE.
    Selection screen declaration
    Author
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TBLOCK1.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(23) TAUTH.
    PARAMETERS: PAUTH LIKE USR02-BNAME MEMORY ID MAUTH.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(36) TPMOD.
    PARAMETERS: PMOD AS CHECKBOX.
    SELECTION-SCREEN END OF LINE.
    Local objects
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(36) T$TMP.
    PARAMETERS: P$TMP AS CHECKBOX DEFAULT ''.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN: END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TBLOCK2.
    Tables
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RTABLE RADIOBUTTON GROUP R1.
    SELECTION-SCREEN COMMENT 5(15) TRTABLE.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(15) TPTABLE.
    SELECT-OPTIONS: SOTABLE FOR DD02L-TABNAME.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(79) TTNOTE.
    SELECTION-SCREEN END OF LINE.
    Message classes
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RMESS RADIOBUTTON GROUP R1.
    SELECTION-SCREEN COMMENT 5(18) TPMES.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(18) TMNAME.
    PARAMETERS: PMNAME LIKE T100-ARBGB MEMORY ID MMNAME.
    SELECTION-SCREEN END OF LINE.
    Function modules
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RFUNC RADIOBUTTON GROUP R1.
    SELECTION-SCREEN COMMENT 5(30) TRFUNC.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(15) TPFNAME.
    SELECT-OPTIONS: SOFNAME FOR TFDIR-FUNCNAME.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(15) TFGROUP.
    SELECT-OPTIONS: SOFGROUP FOR ENLFDIR-AREA.
    SELECTION-SCREEN END OF LINE.
    Classes
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RCLASS RADIOBUTTON GROUP R1.
    SELECTION-SCREEN COMMENT 5(30) TRCLASS.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(15) TPCNAME.
    SELECT-OPTIONS: SOCLASS FOR SEOCLASS-CLSNAME.
    SELECTION-SCREEN END OF LINE.
    Programs / includes
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RPROG RADIOBUTTON GROUP R1 DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 5(18) TPROG.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(15) TRPNAME.
    SELECT-OPTIONS: SOPROG FOR TRDIR-NAME.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP.
    Language
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(18) TMLANG.
    PARAMETERS: PMLANG LIKE T100-SPRSL DEFAULT 'EN'.
    SELECTION-SCREEN END OF LINE.
    Package
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(18) TPACK.
    PARAMETERS: PPACK LIKE TADIV-DEVCLASS MEMORY ID MPACK.
    SELECTION-SCREEN END OF LINE.
    Customer objects
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(27) TCUST.
    PARAMETERS: PCUST AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 32(25) TNRANGE.
    PARAMETERS: PCNAME TYPE NAMESPACE MEMORY ID MNAMESPACE.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN: END OF BLOCK B2.
    Additional things to download.
    SELECTION-SCREEN: BEGIN OF BLOCK B3 WITH FRAME TITLE TBLOCK3.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TPTEXT.
    PARAMETERS: PTEXT AS CHECKBOX DEFAULT 'X' MEMORY ID MTEXT.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TMESS.
    PARAMETERS: PMESS AS CHECKBOX DEFAULT 'X' MEMORY ID MMESS.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TPINC.
    PARAMETERS: PINC AS CHECKBOX DEFAULT 'X' MEMORY ID MINC.
    SELECTION-SCREEN COMMENT 40(20) TRECC.
    PARAMETERS: PRECI AS CHECKBOX DEFAULT 'X' MEMORY ID MRECI.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TPFUNC.
    PARAMETERS: PFUNC AS CHECKBOX DEFAULT 'X' MEMORY ID MFUNC.
    SELECTION-SCREEN COMMENT 40(20) TRECF.
    PARAMETERS: PRECF AS CHECKBOX DEFAULT 'X' MEMORY ID MRECF.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TDOC.
    PARAMETERS: PDOC AS CHECKBOX DEFAULT 'X' MEMORY ID MDOC.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TPSCR.
    PARAMETERS: PSCR AS CHECKBOX DEFAULT 'X' MEMORY ID MSCR.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TPDICT.
    PARAMETERS: PDICT AS CHECKBOX DEFAULT 'X' MEMORY ID MDICT.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TSORTT.
    PARAMETERS: PSORTT AS CHECKBOX DEFAULT ' ' MEMORY ID MSORTT.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN: END OF BLOCK B3.
    File details
    SELECTION-SCREEN: BEGIN OF BLOCK B4 WITH FRAME TITLE TBLOCK4.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) TPHTML.
    PARAMETERS: PHTML RADIOBUTTON GROUP G1 DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) TCOMM.
    PARAMETERS: PCOMM AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) TBACK.
    PARAMETERS: PBACK AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) TPTXT.
    PARAMETERS: PTXT RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP.
    Download to SAP server
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(25) TSERV.
    PARAMETERS: PSERV RADIOBUTTON GROUP G2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 8(20) TSPATH.
    PARAMETERS: PLOGICAL LIKE FILENAME-FILEINTERN MEMORY ID MLOGICAL.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN COMMENT /28(60) TSDPATH.
    Download to PC
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(25) TPC.
    PARAMETERS: PPC RADIOBUTTON GROUP G2 DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 8(20) TPPATH.
    PARAMETERS: PFOLDER LIKE RLGRAP-FILENAME MEMORY ID MFOLDER.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN: END OF BLOCK B4.
    Display options
    SELECTION-SCREEN: BEGIN OF BLOCK B5 WITH FRAME TITLE TBLOCK5.
    Display final report
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TREP.
    PARAMETERS: PREP AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    Display progress messages
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TPROMESS.
    PARAMETERS: PPROMESS AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN: END OF BLOCK B5.
    Display a directory picker window
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR PFOLDER.
      DATA: OBJFILE TYPE REF TO CL_GUI_FRONTEND_SERVICES.
      DATA: PICKEDFOLDER TYPE STRING.
      DATA: INITIALFOLDER TYPE STRING.
      IF SY-BATCH IS INITIAL.
        CREATE OBJECT OBJFILE.
        IF NOT PFOLDER IS INITIAL.
          INITIALFOLDER = PFOLDER.
        ELSE.
          OBJFILE->GET_TEMP_DIRECTORY( CHANGING TEMP_DIR = INITIALFOLDER
                                       EXCEPTIONS CNTL_ERROR = 1
                                                 ERROR_NO_GUI = 2
                                                 NOT_SUPPORTED_BY_GUI = 3 ).
        ENDIF.
        OBJFILE->DIRECTORY_BROWSE( EXPORTING INITIAL_FOLDER = INITIALFOLDER
                                   CHANGING SELECTED_FOLDER = PICKEDFOLDER
                                   EXCEPTIONS CNTL_ERROR = 1
                                              ERROR_NO_GUI = 2
                                              NOT_SUPPORTED_BY_GUI = 3 ).
        IF SY-SUBRC = 0.
          PFOLDER = PICKEDFOLDER.
        ELSE.
          WRITE: / 'An error has occured picking a folder'.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN.
      CASE 'X'.
        WHEN PPC.
          IF PFOLDER IS INITIAL.
          User must enter a path to save to
            MESSAGE E000(OO) WITH 'You must enter a file path'.
          ENDIF.
        WHEN PSERV.
          IF PLOGICAL IS INITIAL.
          User must enter a logical path to save to
            MESSAGE E000(OO) WITH 'You must enter a logical file name'.
          ENDIF.
      ENDCASE.
    AT SELECTION-SCREEN ON PLOGICAL.
      IF NOT PSERV IS INITIAL.
        CALL FUNCTION 'FILE_GET_NAME'
          EXPORTING
            LOGICAL_FILENAME = PLOGICAL
          IMPORTING
            FILE_NAME        = SERVERFOLDER
          EXCEPTIONS
            FILE_NOT_FOUND   = 1
            OTHERS           = 2.
        IF SY-SUBRC = 0.
          IF SERVERFOLDER IS INITIAL.
            MESSAGE E000(OO) WITH 'No file path returned from logical filename'.
          ELSE.
          Path to display on the selection screen
            TSDPATH = SERVERFOLDER.
          Remove the trailing slash off the path as the subroutine buildFilename will add an extra one
            SHIFT SERVERFOLDER RIGHT DELETING TRAILING SERVERSLASHSEPARATOR.
            SHIFT SERVERFOLDER LEFT DELETING LEADING SPACE.
          ENDIF.
        ELSE.
          MESSAGE E000(OO) WITH 'Logical filename does not exist'.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOPROG-LOW.
      CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
        EXPORTING
          OBJECT_TYPE           = 'PROG'
          OBJECT_NAME           = SOPROG-LOW
          SUPPRESS_SELECTION    = 'X'
          USE_ALV_GRID          = ''
          WITHOUT_PERSONAL_LIST = ''
        IMPORTING
          OBJECT_NAME_SELECTED  = SOPROG-LOW
        EXCEPTIONS
          CANCEL                = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOPROG-HIGH.
      CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
        EXPORTING
          OBJECT_TYPE           = 'PROG'
          OBJECT_NAME           = SOPROG-HIGH
          SUPPRESS_SELECTION    = 'X'
          USE_ALV_GRID          = ''
          WITHOUT_PERSONAL_LIST = ''
        IMPORTING
          OBJECT_NAME_SELECTED  = SOPROG-HIGH
        EXCEPTIONS
          CANCEL                = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOCLASS-LOW.
      CALL FUNCTION 'F4_DD_ALLTYPES'
        EXPORTING
          OBJECT               = SOCLASS-LOW
          SUPPRESS_SELECTION   = 'X'
          DISPLAY_ONLY         = ''
          ONLY_TYPES_FOR_CLIFS = 'X'
        IMPORTING
          RESULT               = SOCLASS-LOW.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOCLASS-HIGH.
      CALL FUNCTION 'F4_DD_ALLTYPES'
        EXPORTING
          OBJECT               = SOCLASS-HIGH
          SUPPRESS_SELECTION   = 'X'
          DISPLAY_ONLY         = ''
          ONLY_TYPES_FOR_CLIFS = 'X'
        IMPORTING
          RESULT               = SOCLASS-HIGH.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOFNAME-LOW.
      CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
        EXPORTING
          OBJECT_TYPE           = 'FUNC'
          OBJECT_NAME           = SOFNAME-LOW
          SUPPRESS_SELECTION    = 'X'
          USE_ALV_GRID          = ''
          WITHOUT_PERSONAL_LIST = ''
        IMPORTING
          OBJECT_NAME_SELECTED  = SOFNAME-LOW
        EXCEPTIONS
          CANCEL                = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOFNAME-HIGH.
      CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
        EXPORTING
          OBJECT_TYPE           = 'FUNC'
          OBJECT_NAME           = SOFNAME-HIGH
          SUPPRESS_SELECTION    = 'X'
          USE_ALV_GRID          = ''
          WITHOUT_PERSONAL_LIST = ''
        IMPORTING
          OBJECT_NAME_SELECTED  = SOFNAME-HIGH
        EXCEPTIONS
          CANCEL                = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOFGROUP-LOW.
      CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
        EXPORTING
          OBJECT_TYPE           = 'FUGR'
          OBJECT_NAME           = SOFGROUP-LOW
          SUPPRESS_SELECTION    = 'X'
          USE_ALV_GRID          = ''
          WITHOUT_PERSONAL_LIST = ''
        IMPORTING
          OBJECT_NAME_SELECTED  = SOFGROUP-LOW
        EXCEPTIONS
          CANCEL                = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOFGROUP-HIGH.
      CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
        EXPORTING
          OBJECT_TYPE           = 'FUGR'
          OBJECT_NAME           = SOFGROUP-HIGH
          SUPPRESS_SELECTION    = 'X'
          USE_ALV_GRID          = ''
          WITHOUT_PERSONAL_LIST = ''
        IMPORTING
          OBJECT_NAME_SELECTED  = SOFGROUP-HIGH
        EXCEPTIONS
          CANCEL                = 1.
    initialisation
    INITIALIZATION.
    Parameter screen texts.
      TBLOCK1 = 'Author (Optional)'.
      T$TMP   = 'Programs only: include local objects'.
      TBLOCK2 = 'Objects to download'.
      TBLOCK3 = 'Additional downloads for programs, function modules and classes'.
      TBLOCK4 = 'Download parameters'.
      TBLOCK5 = 'Display options'.
      TAUTH   = 'Author name'.
      TPMOD   = 'Include programs modified by author'.
      TCUST   = 'Only customer objects'.
      TNRANGE = 'Alt customer name range'.
      TRTABLE = 'Tables / Structures'.
      TPTABLE = 'Table name'.
      TTNOTE  = 'Note: tables are stored under the username of the last person who modified them'.
      TRFUNC  = 'Function modules'.
      TPFNAME = 'Function name'.
      TFGROUP = 'Function group'.
      TRCLASS  = 'Classes'.
      TPCNAME = 'Class name'.
      TMESS   = 'Message class'.
      TMNAME  = 'Class name'.
      TMLANG  = 'Language'.
      TPROG   = 'Programs'.
      TRPNAME = 'Program name'.
      TPACK   = 'Package'.
      TPTXT   = 'Text document'.
      TPHTML  = 'HTML document'.
      TCOMM   = 'Highlight comments'.
      TBACK   = 'Include background colour'.
      TPTEXT  = 'Text elements'.
      TPINC   = 'Include programs'.
      TRECC   = 'Recursive search'.
      TPPATH  = 'File path'.
      TSPATH  = 'Logical file name'.
      TPMES   = 'Message classes'.
      TPFUNC  = 'Function modules'.
      TDOC    = 'Function module documentation'.
      TRECF   = 'Recursive search'.
      TPSCR   = 'Screens'.
      TPDICT  = 'Dictionary structures'.
      TSORTT  = 'Sort table fields alphabetically'.
      TSERV   = 'Download to server'.
      TPC     = 'Download to PC'.
      TREP    = 'Display download report'.
      TPROMESS  = 'Display progress messages'.
    Determine the frontend operating system type.
      IF SY-BATCH IS INITIAL.
        PERFORM DETERMINEFRONTENDOPSYSTEM USING FRONTENDSLASHSEPARATOR FRONTENDOPSYSTEM.
      ENDIF.
      PERFORM DETERMINESERVEROPSYSTEM USING SERVERSLASHSEPARATOR SERVERFILESYSTEM SERVEROPSYSTEM.
    Determine if the external command exists.  If it doesn't then disable the server input field
      PERFORM FINDEXTERNALCOMMAND.
    start-of-selection.
    START-OF-SELECTION.
      PERFORM CHECKCOMBOBOXES.
      PERFORM FILLSELECTIONRANGES.
      STARTTIME = SY-UZEIT.
    Don't display status messages if we are running in the background
      IF NOT SY-BATCH IS INITIAL.
        PPROMESS = ''.
      ENDIF.
    Fool the HTML routines to stop them hyperlinking anything with a space in them
      IF PCNAME IS INITIAL.
        CUSTOMERNAMESPACE  = '^'.
      ELSE.
        CUSTOMERNAMESPACE = PCNAME.
      ENDIF.
    Determine which operating slash and download directory to use
      CASE 'X'.
        WHEN PPC.
          SLASHSEPARATORTOUSE = FRONTENDSLASHSEPARATOR.
          DOWNLOADFOLDER = PFOLDER.
        WHEN PSERV.
          SLASHSEPARATORTOUSE = SERVERSLASHSEPARATOR.
          DOWNLOADFOLDER = SERVERFOLDER.
      ENDCASE.
    Main program flow.
      CASE 'X'.
      Select tables
        WHEN RTABLE.
          PERFORM RETRIEVETABLES USING IDICTIONARY[]
                                       SOTABLENAMES[]
                                       SOAUTHOR[].
      Select message classes tables
        WHEN RMESS.
          PERFORM RETRIEVEMESSAGECLASS USING IMESSAGES[]
                                             SOAUTHOR[]      "Author
                                             PMNAME          "Message class name
                                             PMLANG          "Message class language
                                             PMOD.           "Modified by author
      Select function modules
        WHEN RFUNC.
          PERFORM RETRIEVEFUNCTIONS USING SOFUNCTIONNAME[]   "Function name
                                          SOFUNCTIONGROUP[]  "Function group
                                          IFUNCTIONS[]       "Found functions
                                          SOAUTHOR[]         "Author
                                          PTEXT              "Get text elements
                                          PSCR               "Get screens
                                          PCUST              "Customer data only
                                          CUSTOMERNAMESPACE. "Customer name range
          LOOP AT IFUNCTIONS.
          Find Dict structures, messages, functions, includes etc.
            PERFORM SCANFORADDITIONALFUNCSTUFF USING IFUNCTIONS[]
                                                     PRECI                   "Search for includes recursively
                                                     PRECF                   "Search for functions recursively
                                                     PINC                    "Search for includes
                                                     PFUNC                   "Search for functions
                                                     PDICT                   "search for dictionary objects
                                                     PMESS                   "Search for messages
                                                     PCUST                   "Customer data only
                                                     CUSTOMERNAMESPACE.      "Customer name range
          ENDLOOP.
      Select Classes
        WHEN RCLASS.
          PERFORM RETRIEVECLASSES USING ICLASSES[]
                                        IFUNCTIONS[]
                                        SOCLASSNAME[]       "Class name
                                        SOAUTHOR[]          "Author
                                        CUSTOMERNAMESPACE   "Customer name range
                                        PMOD                "Also modified by author
                                        PCUST               "Customer object only
                                        PMESS               "Find messages
                                        PTEXT               "Text Elements
                                        PDICT               "Dictionary structures
                                        PFUNC               "Get functions
                                        PINC                "Get includes
                                        PRECF               "Search recursively for functions
                                        PRECI               "Search recursively for includes
                                        'X'                 "Search recursively for classes
                                        PMLANG.             "Language
          LOOP AT IFUNCTIONS.
          Find Dict structures, messages, functions, includes etc.
            PERFORM SCANFORADDITIONALFUNCSTUFF USING IFUNCTIONS[]
                                                     PRECI                   "Search for includes recursively
                                                     PRECF                   "Search for functions recursively
                                                     PINC                    "Search for includes
                                                     PFUNC                   "Search for functions
                                                     PDICT                   "search for dictionary objects
                                                     PMESS                   "Search for messages
                                                     PCUST                   "Customer data only
                                                     CUSTOMERNAMESPACE.      "Customer name range
          ENDLOOP.
      Select programs
        WHEN RPROG.
          PERFORM RETRIEVEPROGRAMS USING IPROGRAMS[]
                                         IFUNCTIONS[]
                                         SOPROGRAMNAME[]    "Program name
                                         SOAUTHOR[]         "Author
                                         CUSTOMERNAMESPACE  "Customer name range
                                         PMOD               "Also modified by author
                                         PCUST              "Customer object only
                                         PMESS              "Find messages
                                         PTEXT              "Text Elements
                                         PDICT              "Dictionay structures
                                         PFUNC              "Get functions
                                         PINC               "Get includes
                                         PSCR               "Get screens
                                         PRECF              "Search recursively for functions
                                         PRECI              "Search recursively for includes
                                         P$TMP              "local objects
                                         PPACK.             "Package
      ENDCASE.
    end-of-selection
    END-OF-SELECTION.
      IF FORCEDEXIT = 0.
      Set the file extension and output type of the file
        IF PTXT IS INITIAL.
          DOWNLOADFILEEXTENSION = HTMLEXTENSION.
        ELSE.
          DOWNLOADFILEEXTENSION = TEXTEXTENSION.
        ENDIF.
      Decide what to download
        CASE 'X'.
        Download tables
          WHEN RTABLE.
            IF NOT ( IDICTIONARY[] IS INITIAL ).
              PERFORM DOWNLOADDDSTRUCTURES USING IDICTIONARY[]
                                                 DOWNLOADFOLDER
                                                 HTMLEXTENSION
                                                 SPACE
                                                 PSORTT
                                                 SLASHSEPARATORTOUSE
                                                 PSERV
                                                 PPROMESS.
            Free up any memory used for caching HTML versions of tables
              LOOP AT IDICTIONARY.
                FREE MEMORY ID IDICTIONARY-TABLENAME.
              ENDLOOP.
            Display donwload report
              IF NOT PREP IS INITIAL.
                GET TIME.
                RUNTIME = SY-UZEIT - STARTTIME.
                PERFORM FILLTREENODETABLES USING IDICTIONARY[]
                                                 ITREEDISPLAY[]
                                                 RUNTIME.
              ENDIF.
              CLEAR IDICTIONARY[].
            ENDIF.
        Download message class
          WHEN RMESS.
            IF NOT ( IMESSAGES[] IS INITIAL ).
              SORT IMESSAGES ASCENDING BY ARBGB MSGNR.
              LOOP AT IMESSAGES.
                APPEND IMESSAGES TO ISINGLEMESSAGECLASS.
                AT END OF ARBGB.
                  PERFORM DOWNLOADMESSAGECLASS USING ISINGLEMESSAGECLASS[]
                                                     IMESSAGES-ARBGB
                                                     DOWNLOADFOLDER
                                                     DOWNLOADFILEEXTENSION
                                                     PHTML
                                                     SPACE
                                                     PCOMM
                                                     CUSTOMERNAMESPACE
                                                     PINC
                                                     PDICT
                                                     PMESS
                                                     SLASHSEPARATORTOUSE
                                                     PSERV
                                                     PPROMESS.
                  CLEAR ISINGLEMESSAGECLASS[].
                ENDAT.
              ENDLOOP.
            Display download report
              IF NOT PREP IS INITIAL.
                GET TIME.
                RUNTIME = SY-UZEIT - STARTTIME.
                PERFORM FILLTREENODEMESSAGES USING IMESSAGES[]
                                                   ITREEDISPLAY[]
                                                   RUNTIME.
              ENDIF.
              CLEAR IMESSAGES[].
            ENDIF.
        Download functions
          WHEN RFUNC.
            IF NOT ( IFUNCTIONS[] IS INITIAL ).
              PERFORM DOWNLOADFUNCTIONS USING IFUNCTIONS[]
                                              DOWNLOADFOLDER
                                              DOWNLOADFILEEXTENSION
                                              SPACE
                                              PDOC
                                              PHTML
                                              PCOMM
          

  • Downloading and Uploading ABAP programs

    I need to move a new GUI program (including all screens, include, subroutines, etc.) that was developed on our SAP 4.5 system to our new, upgraded, ECC 6.0 system.
    There is an old ABAP program that we use to use called ZSABAPUPDOWNLOAD, but it no longer seem to work between these two SAP versions.
    Because of the version differences between these tow systems, our BASIS group does not want us to use a transport to move this code.
    Other than completely recreating this program on the ECC60 system, does anyone know of a program (like the old ZSABAPUPDOWNLOAD) or utility that I could use to transfer this program to the new system?

    welcome to SDN.
    is this the program do u have.
    if not check it with this.
    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.

  • Performance of ABAP program

    How do you take care of performance issues in your abap programs?

    HI
    and you can see this also
    Ways of Performance Tuning
    1.     Selection Criteria
    2.     Select Statements
    •     Select Queries
    •     SQL Interface
    •     Aggregate Functions
    •     For all Entries
    Select Over more than one Internal table
    Selection Criteria
    1.     Restrict the data to the selection criteria itself, rather than filtering it out using the ABAP code using CHECK statement. 
    2.     Select with selection list.
    Points # 1/2
    SELECT * FROM SBOOK INTO SBOOK_WA.
      CHECK: SBOOK_WA-CARRID = 'LH' AND
             SBOOK_WA-CONNID = '0400'.
    ENDSELECT.
    The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list
    SELECT  CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
      WHERE SBOOK_WA-CARRID = 'LH' AND
                  SBOOK_WA-CONNID = '0400'.
    Select Statements   Select Queries
    1.     Avoid nested selects
    2.     Select all the records in a single shot using into table clause of select statement rather than to use Append statements.
    3.     When a base table has multiple indices, the where clause should be in the order of the index, either a primary or a secondary index.
    4.     For testing existence , use Select.. Up to 1 rows statement instead of a Select-Endselect-loop with an Exit. 
    5.     Use Select Single if all primary key fields are supplied in the Where condition .
    Point # 1
    SELECT * FROM EKKO INTO EKKO_WA.
      SELECT * FROM EKAN INTO EKAN_WA
          WHERE EBELN = EKKO_WA-EBELN.
      ENDSELECT.
    ENDSELECT.
    The above code can be much more optimized by the code written below.
    SELECT PF1 PF2 FF3 FF4 INTO TABLE ITAB
        FROM EKKO AS P INNER JOIN EKAN AS F
          ON PEBELN = FEBELN.
    Note: A simple SELECT loop is a single database access whose result is passed to the ABAP program line by line. Nested SELECT loops mean that the number of accesses in the inner loop is multiplied by the number of accesses in the outer loop. One should therefore use nested SELECT loops  only if the selection in the outer loop contains very few lines or the outer loop is a SELECT SINGLE statement.
    Point # 2
    SELECT * FROM SBOOK INTO SBOOK_WA.
      CHECK: SBOOK_WA-CARRID = 'LH' AND
             SBOOK_WA-CONNID = '0400'.
    ENDSELECT.
    The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list and puts the data in one shot using into table
    SELECT  CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
      WHERE SBOOK_WA-CARRID = 'LH' AND
                  SBOOK_WA-CONNID = '0400'.
    Point # 3
    To choose an index, the optimizer checks the field names specified in the where clause and then uses an index that has the same order of the fields . In certain scenarios, it is advisable to check whether a new index can speed up the performance of a program. This will come handy in programs that access data from the finance tables.
    Point # 4
    SELECT * FROM SBOOK INTO SBOOK_WA
      UP TO 1 ROWS
      WHERE CARRID = 'LH'.
    ENDSELECT.
    The above code is more optimized as compared to the code mentioned below for testing existence of a record.
    SELECT * FROM SBOOK INTO SBOOK_WA
        WHERE CARRID = 'LH'.
      EXIT.
    ENDSELECT.
    Point # 5
    If all primary key fields are supplied in the Where condition you can even use Select Single.
    Select Single requires one communication with the database system, whereas Select-Endselect needs two.
    Select Statements           contd..  SQL Interface
    1.     Use column updates instead of single-row updates
    to update your database tables.
    2.     For all frequently used Select statements, try to use an index.
    3.     Using buffered tables improves the performance considerably.
    Point # 1
    SELECT * FROM SFLIGHT INTO SFLIGHT_WA.
      SFLIGHT_WA-SEATSOCC =
        SFLIGHT_WA-SEATSOCC - 1.
      UPDATE SFLIGHT FROM SFLIGHT_WA.
    ENDSELECT.
    The above mentioned code can be more optimized by using the following code
    UPDATE SFLIGHT
           SET SEATSOCC = SEATSOCC - 1.
    Point # 2
    SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA
      WHERE CARRID = 'LH'
        AND CONNID = '0400'.
    ENDSELECT.
    The above mentioned code can be more optimized by using the following code
    SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA
      WHERE MANDT IN ( SELECT MANDT FROM T000 )
        AND CARRID = 'LH'
        AND CONNID = '0400'.
    ENDSELECT.
    Point # 3
    Bypassing the buffer increases the network considerably
    SELECT SINGLE * FROM T100 INTO T100_WA
      BYPASSING BUFFER
      WHERE     SPRSL = 'D'
            AND ARBGB = '00'
            AND MSGNR = '999'.
    The above mentioned code can be more optimized by using the following code
    SELECT SINGLE * FROM T100  INTO T100_WA
      WHERE     SPRSL = 'D'
            AND ARBGB = '00'
            AND MSGNR = '999'.
    Select Statements       contd…           Aggregate Functions
    •     If you want to find the maximum, minimum, sum and average value or the count of a database column, use a select list with aggregate functions instead of computing the aggregates yourself.
    Some of the Aggregate functions allowed in SAP are  MAX, MIN, AVG, SUM, COUNT, COUNT( * )
    Consider the following extract.
                Maxno = 0.
                Select * from zflight where airln = ‘LF’ and cntry = ‘IN’.
                 Check zflight-fligh > maxno.
                 Maxno = zflight-fligh.
                Endselect.
    The  above mentioned code can be much more optimized by using the following code.
    Select max( fligh ) from zflight into maxno where airln = ‘LF’ and cntry = ‘IN’.
    Select Statements    contd…For All Entries
    •     The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause.
         The plus
    •     Large amount of data
    •     Mixing processing and reading of data
    •     Fast internal reprocessing of data
    •     Fast
         The Minus
    •     Difficult to program/understand
    •     Memory could be critical (use FREE or PACKAGE size)
    Points to be must considered FOR ALL ENTRIES
    •     Check that data is present in the driver table
    •     Sorting the driver table
    •     Removing duplicates from the driver table
    Consider the following piece of extract
    Loop at int_cntry.
           Select single * from zfligh into int_fligh
    where cntry = int_cntry-cntry.
    Append int_fligh.
    Endloop.
    The above mentioned can be more optimized by using the following code.
    Sort int_cntry by cntry.
    Delete adjacent duplicates from int_cntry.
    If NOT int_cntry[] is INITIAL.
                Select * from zfligh appending table int_fligh
                For all entries in int_cntry
                Where cntry = int_cntry-cntry.
    Endif.
    Select Statements    contd…  Select Over more than one Internal table
    1.     Its better to use a views instead of nested Select statements.
    2.     To read data from several logically connected tables use a join instead of nested Select statements. Joins are preferred only if all the primary key are available in WHERE clause for the tables that are joined. If the primary keys are not provided in join the Joining of tables itself takes time.
    3.     Instead of using nested Select loops it is often better to use subqueries.
    Point # 1
    SELECT * FROM DD01L INTO DD01L_WA
      WHERE DOMNAME LIKE 'CHAR%'
            AND AS4LOCAL = 'A'.
      SELECT SINGLE * FROM DD01T INTO DD01T_WA
        WHERE   DOMNAME    = DD01L_WA-DOMNAME
            AND AS4LOCAL   = 'A'
            AND AS4VERS    = DD01L_WA-AS4VERS
            AND DDLANGUAGE = SY-LANGU.
    ENDSELECT.
    The above code can be more optimized by extracting all the data from view DD01V_WA
    SELECT * FROM DD01V INTO  DD01V_WA
      WHERE DOMNAME LIKE 'CHAR%'
            AND DDLANGUAGE = SY-LANGU.
    ENDSELECT
    Point # 2
    SELECT * FROM EKKO INTO EKKO_WA.
      SELECT * FROM EKAN INTO EKAN_WA
          WHERE EBELN = EKKO_WA-EBELN.
      ENDSELECT.
    ENDSELECT.
    The above code can be much more optimized by the code written below.
    SELECT PF1 PF2 FF3 FF4 INTO TABLE ITAB
        FROM EKKO AS P INNER JOIN EKAN AS F
          ON PEBELN = FEBELN.
    Point # 3
    SELECT * FROM SPFLI
      INTO TABLE T_SPFLI
      WHERE CITYFROM = 'FRANKFURT'
        AND CITYTO = 'NEW YORK'.
    SELECT * FROM SFLIGHT AS F
        INTO SFLIGHT_WA
        FOR ALL ENTRIES IN T_SPFLI
        WHERE SEATSOCC < F~SEATSMAX
          AND CARRID = T_SPFLI-CARRID
          AND CONNID = T_SPFLI-CONNID
          AND FLDATE BETWEEN '19990101' AND '19990331'.
    ENDSELECT.
    The above mentioned code can be even more optimized by using subqueries instead of for all entries.
    SELECT * FROM SFLIGHT AS F INTO SFLIGHT_WA
        WHERE SEATSOCC < F~SEATSMAX
          AND EXISTS ( SELECT * FROM SPFLI
                         WHERE CARRID = F~CARRID
                           AND CONNID = F~CONNID
                           AND CITYFROM = 'FRANKFURT'
                           AND CITYTO = 'NEW YORK' )
          AND FLDATE BETWEEN '19990101' AND '19990331'.
    ENDSELECT.
    1.     Table operations should be done using explicit work areas rather than via header lines.
    2.     Always try to use binary search instead of linear search. But don’t forget to sort your internal table before that.
    3.     A dynamic key access is slower than a static one, since the key specification must be evaluated at runtime.
    4.     A binary search using secondary index takes considerably less time.
    5.     LOOP ... WHERE is faster than LOOP/CHECK because LOOP ... WHERE evaluates the specified condition internally.
    6.     Modifying selected components using “ MODIFY itab …TRANSPORTING f1 f2.. “ accelerates the task of updating  a line of an internal table.
    Point # 2
    READ TABLE ITAB INTO WA WITH KEY K = 'X‘ BINARY SEARCH.
    IS MUCH FASTER THAN USING
    READ TABLE ITAB INTO WA WITH KEY K = 'X'.
    If TAB has n entries, linear search runs in O( n ) time, whereas binary search takes only O( log2( n ) ).
    Point # 3
    READ TABLE ITAB INTO WA WITH KEY K = 'X'. IS FASTER THAN USING
    READ TABLE ITAB INTO WA WITH KEY (NAME) = 'X'.
    Point # 5
    LOOP AT ITAB INTO WA WHERE K = 'X'.
    ENDLOOP.
    The above code is much faster than using
    LOOP AT ITAB INTO WA.
      CHECK WA-K = 'X'.
    ENDLOOP.
    Point # 6
    WA-DATE = SY-DATUM.
    MODIFY ITAB FROM WA INDEX 1 TRANSPORTING DATE.
    The above code is more optimized as compared to
    WA-DATE = SY-DATUM.
    MODIFY ITAB FROM WA INDEX 1.
    7.     Accessing the table entries directly in a "LOOP ... ASSIGNING ..." accelerates the task of updating a set of lines of an internal table considerably
    8.    If collect semantics is required, it is always better to use to COLLECT rather than READ BINARY and then ADD.
    9.    "APPEND LINES OF itab1 TO itab2" accelerates the task of appending a table to another table considerably as compared to “ LOOP-APPEND-ENDLOOP.”
    10.   “DELETE ADJACENT DUPLICATES“ accelerates the task of deleting duplicate entries considerably as compared to “ READ-LOOP-DELETE-ENDLOOP”.
    11.   "DELETE itab FROM ... TO ..." accelerates the task of deleting a sequence of lines considerably as compared to “  DO -DELETE-ENDDO”.
    Point # 7
    Modifying selected components only makes the program faster as compared to Modifying all lines completely.
    e.g,
    LOOP AT ITAB ASSIGNING <WA>.
      I = SY-TABIX MOD 2.
      IF I = 0.
        <WA>-FLAG = 'X'.
      ENDIF.
    ENDLOOP.
    The above code works faster as compared to
    LOOP AT ITAB INTO WA.
      I = SY-TABIX MOD 2.
      IF I = 0.
        WA-FLAG = 'X'.
        MODIFY ITAB FROM WA.
      ENDIF.
    ENDLOOP.
    Point # 8
    LOOP AT ITAB1 INTO WA1.
      READ TABLE ITAB2 INTO WA2 WITH KEY K = WA1-K BINARY SEARCH.
      IF SY-SUBRC = 0.
        ADD: WA1-VAL1 TO WA2-VAL1,
             WA1-VAL2 TO WA2-VAL2.
        MODIFY ITAB2 FROM WA2 INDEX SY-TABIX TRANSPORTING VAL1 VAL2.
      ELSE.
        INSERT WA1 INTO ITAB2 INDEX SY-TABIX.
      ENDIF.
    ENDLOOP.
    The above code uses BINARY SEARCH for collect semantics. READ BINARY runs in O( log2(n) ) time. The above piece of code can be more optimized by
    LOOP AT ITAB1 INTO WA.
      COLLECT WA INTO ITAB2.
    ENDLOOP.
    SORT ITAB2 BY K.
    COLLECT, however, uses a hash algorithm and is therefore independent
    of the number of entries (i.e. O(1)) .
    Point # 9
    APPEND LINES OF ITAB1 TO ITAB2.
    This is more optimized as compared to
    LOOP AT ITAB1 INTO WA.
      APPEND WA TO ITAB2.
    ENDLOOP.
    Point # 10
    DELETE ADJACENT DUPLICATES FROM ITAB COMPARING K.
    This is much more optimized as compared to
    READ TABLE ITAB INDEX 1 INTO PREV_LINE.
    LOOP AT ITAB FROM 2 INTO WA.
      IF WA = PREV_LINE.
        DELETE ITAB.
      ELSE.
        PREV_LINE = WA.
      ENDIF.
    ENDLOOP.
    Point # 11
    DELETE ITAB FROM 450 TO 550.
    This is much more optimized as compared to
    DO 101 TIMES.
      DELETE ITAB INDEX 450.
    ENDDO.
    12.   Copying internal tables by using “ITAB2[ ] = ITAB1[ ]” as compared to “LOOP-APPEND-ENDLOOP”.
    13.   Specify the sort key as restrictively as possible to run the program faster.
    Point # 12
    ITAB2[] = ITAB1[].
    This is much more optimized as compared to
    REFRESH ITAB2.
    LOOP AT ITAB1 INTO WA.
      APPEND WA TO ITAB2.
    ENDLOOP.
    Point # 13
    “SORT ITAB BY K.” makes the program runs faster as compared to “SORT ITAB.”
    Internal Tables         contd…
    Hashed and Sorted tables
    1.     For single read access hashed tables are more optimized as compared to sorted tables.
    2.      For partial sequential access sorted tables are more optimized as compared to hashed tables
    Hashed And Sorted Tables
    Point # 1
    Consider the following example where HTAB is a hashed table and STAB is a sorted table
    DO 250 TIMES.
      N = 4 * SY-INDEX.
      READ TABLE HTAB INTO WA WITH TABLE KEY K = N.
      IF SY-SUBRC = 0.
      ENDIF.
    ENDDO.
    This runs faster for single read access as compared to the following same code for sorted table
    DO 250 TIMES.
      N = 4 * SY-INDEX.
      READ TABLE STAB INTO WA WITH TABLE KEY K = N.
      IF SY-SUBRC = 0.
      ENDIF.
    ENDDO.
    Point # 2
    Similarly for Partial Sequential access the STAB runs faster as compared to HTAB
    LOOP AT STAB INTO WA WHERE K = SUBKEY.
    ENDLOOP.
    This runs faster as compared to
    LOOP AT HTAB INTO WA WHERE K = SUBKEY.
    ENDLOOP.

Maybe you are looking for