Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

program download

Former Member
0 Kudos

Can anybody tell how to down load z multiple programs at a time on pc ?

not one by one.

Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

u have to create and package and keep all the z programs in that package u can download all the z programs in that package

&--------------------------------------------------------------------*
*& Program To Download All The Programs Present In A Package (Dev. Class) To Desktop
*&--------------------------------------------------------------------*

REPORT  z_downloadall_to_desktop.

***********************************************************************
*                           Table declaration                         *
***********************************************************************

TABLES: tadir.

***********************************************************************
*                           Data declaration                          *
***********************************************************************
TYPES: abapline(255) TYPE c.

TYPES: BEGIN OF ty_reposit,
         pgmid    TYPE tadir-pgmid,
         object   TYPE tadir-object,
         obj_name TYPE tadir-obj_name,
         devclass TYPE tadir-devclass,
      END OF ty_reposit.

DATA: it_reposit TYPE STANDARD TABLE OF ty_reposit,
      wa_reposit TYPE ty_reposit.

DATA: it_repsrc TYPE STANDARD TABLE OF abapline,
      wa_repsrc TYPE abapline.

DATA: prog(60)    TYPE c,
      mc_filename TYPE rlgrap-filename,
      filename    TYPE string.

***********************************************************************
*                           Selection Screen                          *
***********************************************************************
PARAMETERS: p_dev TYPE tadir-devclass.                    "Package Name

*****Program Logic

SELECT pgmid
       object
       obj_name
       devclass
  FROM tadir
  INTO TABLE it_reposit
  WHERE pgmid    = 'R3TR' AND
        object   = 'PROG' AND
        devclass = p_dev. 

IF sy-subrc NE 0.
  MESSAGE s001(00) WITH 'No programs available in the given package'.
  EXIT.
ENDIF.

LOOP AT it_reposit INTO wa_reposit.
  prog = wa_reposit-obj_name.
  READ REPORT prog INTO it_repsrc.

  CONCATENATE 'C:\Documents and Settings\Administrator\Desktop\My ABAP Programs\Report'
              prog
              '.txt'
         INTO mc_filename.

  filename = mc_filename.

*****Function module for download files into local system

  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = filename
    TABLES
      data_tab                = it_repsrc
    EXCEPTIONS
      file_write_error        = 1
      no_batch                = 2
      gui_refuse_filetransfer = 3
      invalid_type            = 4
      no_authority            = 5
      unknown_error           = 6
      header_not_allowed      = 7
      separator_not_allowed   = 8
      filesize_not_allowed    = 9
      header_too_long         = 10
      dp_error_create         = 11
      dp_error_send           = 12
      dp_error_write          = 13
      unknown_dp_error        = 14
      access_denied           = 15
      dp_out_of_memory        = 16
      disk_full               = 17
      dp_timeout              = 18
      file_not_found          = 19
      dataprovider_exception  = 20
      control_flush_error     = 21
      OTHERS                  = 22.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  CLEAR prog.
  CLEAR wa_repsrc.

ENDLOOP.

7 REPLIES 7

Former Member
0 Kudos

u have to create and package and keep all the z programs in that package u can download all the z programs in that package

&--------------------------------------------------------------------*
*& Program To Download All The Programs Present In A Package (Dev. Class) To Desktop
*&--------------------------------------------------------------------*

REPORT  z_downloadall_to_desktop.

***********************************************************************
*                           Table declaration                         *
***********************************************************************

TABLES: tadir.

***********************************************************************
*                           Data declaration                          *
***********************************************************************
TYPES: abapline(255) TYPE c.

TYPES: BEGIN OF ty_reposit,
         pgmid    TYPE tadir-pgmid,
         object   TYPE tadir-object,
         obj_name TYPE tadir-obj_name,
         devclass TYPE tadir-devclass,
      END OF ty_reposit.

DATA: it_reposit TYPE STANDARD TABLE OF ty_reposit,
      wa_reposit TYPE ty_reposit.

DATA: it_repsrc TYPE STANDARD TABLE OF abapline,
      wa_repsrc TYPE abapline.

DATA: prog(60)    TYPE c,
      mc_filename TYPE rlgrap-filename,
      filename    TYPE string.

***********************************************************************
*                           Selection Screen                          *
***********************************************************************
PARAMETERS: p_dev TYPE tadir-devclass.                    "Package Name

*****Program Logic

SELECT pgmid
       object
       obj_name
       devclass
  FROM tadir
  INTO TABLE it_reposit
  WHERE pgmid    = 'R3TR' AND
        object   = 'PROG' AND
        devclass = p_dev. 

IF sy-subrc NE 0.
  MESSAGE s001(00) WITH 'No programs available in the given package'.
  EXIT.
ENDIF.

LOOP AT it_reposit INTO wa_reposit.
  prog = wa_reposit-obj_name.
  READ REPORT prog INTO it_repsrc.

  CONCATENATE 'C:\Documents and Settings\Administrator\Desktop\My ABAP Programs\Report'
              prog
              '.txt'
         INTO mc_filename.

  filename = mc_filename.

*****Function module for download files into local system

  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = filename
    TABLES
      data_tab                = it_repsrc
    EXCEPTIONS
      file_write_error        = 1
      no_batch                = 2
      gui_refuse_filetransfer = 3
      invalid_type            = 4
      no_authority            = 5
      unknown_error           = 6
      header_not_allowed      = 7
      separator_not_allowed   = 8
      filesize_not_allowed    = 9
      header_too_long         = 10
      dp_error_create         = 11
      dp_error_send           = 12
      dp_error_write          = 13
      unknown_dp_error        = 14
      access_denied           = 15
      dp_out_of_memory        = 16
      disk_full               = 17
      dp_timeout              = 18
      file_not_found          = 19
      dataprovider_exception  = 20
      control_flush_error     = 21
      OTHERS                  = 22.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  CLEAR prog.
  CLEAR wa_repsrc.

ENDLOOP.

Former Member
0 Kudos
REPORT  Y_DOWNLOAD.



TABLES:
   TADIR.

DATA: LINES TYPE SY-INDEX.

DATA:

  BEGIN OF T_TADIR OCCURS 10,

    DEVCLASS LIKE TADIR-DEVCLASS,
    OBJ_NAME TYPE TADIR-OBJ_NAME,
    AUTHOR TYPE TADIR-AUTHOR,

  END OF T_TADIR.

DATA: ITAB TYPE TABLE OF STRING WITH HEADER LINE.
DATA:
   BEGIN OF T_REPOSRC OCCURS 10,
     PROGNAME TYPE REPOSRC-PROGNAME,
     SUBC TYPE REPOSRC-SUBC,
     CNAM TYPE REPOSRC-CNAM,
     CDAT TYPE REPOSRC-CDAT,
     R3STATE TYPE REPOSRC-R3STATE,
     UNAM TYPE REPOSRC-UNAM,
     UDAT TYPE REPOSRC-UDAT,
   END OF T_REPOSRC.

DATA:
  BOX1,
  BOX2,
  W_BOX ,
  W_NO TYPE I VALUE 1,
  W_DEVCLASS LIKE TADIR-DEVCLASS,
  W_AUTHOR     LIKE TADIR-AUTHOR,
  W_LINES TYPE I,
  W_LINE1 TYPE I,

  W_NEXTREC TYPE I,
  W_INDEX TYPE I.
SELECTION-SCREEN  BEGIN OF BLOCK B1 WITH FRAME  TITLE TEXT-001.
SELECT-OPTIONS:
  S_AUTHOR FOR TADIR-AUTHOR ,
  S_DCLASS FOR TADIR-DEVCLASS ,
  S_PROG   FOR TADIR-OBJ_NAME.
SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN  BEGIN OF BLOCK B2 WITH FRAME  TITLE TEXT-002.
PARAMETERS:
    R1  RADIOBUTTON GROUP G1,
    R2  RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.

AT SELECTION-SCREEN.
  SELECT   DEVCLASS
           OBJ_NAME
           AUTHOR
    INTO TABLE T_TADIR
    FROM  TADIR
    WHERE
    PGMID  EQ 'R3TR'
    AND OBJECT = 'PROG'
    AND   DEVCLASS IN S_DCLASS
    AND  OBJ_NAME IN S_PROG
    AND AUTHOR IN S_AUTHOR.

  IF  SY-SUBRC  NE 0.
    MESSAGE  E014(YESWAR).
  ENDIF.

TOP-OF-PAGE.
  WRITE:/ TEXT-005 COLOR 4 ,SY-SYSID COLOR 3.

  WRITE:/ TEXT-006 COLOR 5, SY-DBCNT COLOR 3.

TOP-OF-PAGE DURING LINE-SELECTION.

  WRITE:/ TEXT-005 COLOR 4 ,SY-SYSID COLOR 3.

  WRITE:/ TEXT-006, SY-DBCNT COLOR 5.
*    WRITE:/ text-007, w_line1 COLOR 5.
*
  ULINE.

START-OF-SELECTION.

  IF R1 = 'X'.

      PERFORM SELECT.
      PERFORM OUTPUT1.



  ELSE.


    PERFORM SELECT.
    PERFORM OUTPUT2.

  ENDIF.

  SET PF-STATUS 'ABCD'.
  CASE SY-UCOMM.
   WHEN 'EXIT'.
   LEAVE TO SCREEN 0.
   ENDCASE.

FORM SELECT .


  SELECT   DEVCLASS
           OBJ_NAME
           AUTHOR

    INTO TABLE T_TADIR
    FROM  TADIR
    WHERE
    PGMID  EQ 'R3TR'
    AND OBJECT = 'PROG'
    AND   DEVCLASS IN S_DCLASS
    AND  OBJ_NAME IN S_PROG
    AND AUTHOR IN S_AUTHOR.

  LINES = SY-DBCNT + 5.

ENDFORM.                    " SELECT

*&--------------------------------------------------------------------*
*&      Form  OUTPUT1
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM OUTPUT1 .

  SORT T_TADIR BY DEVCLASS.

  LOOP AT T_TADIR.
    AT NEW DEVCLASS.
      SET BLANK LINES ON.

      WRITE:/ BOX1 AS CHECKBOX,
             T_TADIR-DEVCLASS.
    ENDAT.

    WRITE:/40  BOX2 AS CHECKBOX,
              T_TADIR-OBJ_NAME.
    HIDE : T_TADIR-OBJ_NAME,
            T_TADIR-AUTHOR..
  ENDLOOP.
ENDFORM.                                                    " OUTPUT1
*&---------------------------------------------------------------------*
*&      Form  MODIFY_LIST
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*

FORM MODIFY_LIST.
  DO LINES TIMES.
    READ LINE SY-INDEX.
    IF SY-UCOMM EQ 'SALL'.

      MODIFY LINE SY-INDEX FIELD VALUE BOX1 FROM 'X'.
      MODIFY LINE SY-INDEX FIELD VALUE BOX2 FROM 'X'.
*      ENDIF.
    ENDIF.
    IF SY-UCOMM EQ 'DALL'.
      MODIFY LINE SY-INDEX FIELD VALUE BOX1  FROM ' '.
      MODIFY LINE SY-INDEX FIELD VALUE BOX2  FROM ' '.
    ENDIF.

  ENDDO.

ENDFORM.                    " MODIFY_LIST


FORM EXTRA_LIST .


 SELECT PROGNAME
        SUBC
        CNAM
        CDAT
        R3STATE
        UNAM
        UDAT
   FROM REPOSRC
   INTO
   TABLE T_REPOSRC
   WHERE PROGNAME EQ T_TADIR-OBJ_NAME
     AND CNAM     EQ T_TADIR-AUTHOR.


  WINDOW STARTING AT 1 50
         ENDING  AT 60 60.

  LOOP AT T_REPOSRC .

    WRITE:/ TEXT-101 COLOR 1, T_REPOSRC-PROGNAME  COLOR 1,
          / TEXT-102 COLOR 2 ,T_REPOSRC-SUBC  COLOR 1,
          / TEXT-103 COLOR 3, T_REPOSRC-CNAM  COLOR 1,
          / TEXT-104 COLOR 4 , T_REPOSRC-CDAT  COLOR 1,
          / TEXT-105 COLOR 5, T_REPOSRC-R3STATE  COLOR 1,
          / TEXT-106  COLOR 6,T_REPOSRC-UNAM  COLOR 1,
          / TEXT-107 COLOR 7,T_REPOSRC-UDAT  COLOR 1.

    ULINE.

  ENDLOOP.




ENDFORM.                    " EXTRA_LIST

*&--------------------------------------------------------------------*
*&      Form  APPLY_LIST
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM APPLY_LIST .
  DATA: W_SEL TYPE C.


  IF SY-UCOMM EQ 'APPLY' .
    DO.
      READ LINE SY-INDEX FIELD VALUE BOX1.

      IF SY-SUBRC NE 0.
        EXIT.
      ENDIF.
      IF SY-SUBRC EQ 0.
        W_SEL = 'X'.
        MODIFY LINE SY-INDEX FIELD VALUE BOX1  FROM W_SEL.
        MODIFY LINE SY-INDEX FIELD VALUE BOX2 FROM W_SEL.
      ENDIF.
      IF BOX1 NE 'X'.
        W_SEL = ' '.
        MODIFY LINE SY-INDEX FIELD VALUE BOX1  FROM W_SEL.
        MODIFY LINE SY-INDEX FIELD VALUE BOX2 FROM W_SEL.

      ENDIF.
    ENDDO.
  ENDIF.

ENDFORM.                    " APPLY_LIST

*&--------------------------------------------------------------------*
*&      Form  R1_X
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*


AT USER-COMMAND.
  CASE SY-UCOMM.
    WHEN 'SALL' ..
      PERFORM MODIFY_LIST.
      SET PF-STATUS 'ABCD' EXCLUDING 'SALL' IMMEDIATELY.
    WHEN 'DALL' .
      PERFORM MODIFY_LIST.
      SET PF-STATUS 'ABCD' EXCLUDING 'DALL'  IMMEDIATELY..
    WHEN 'APPLY'.
      PERFORM APPLY_LIST.
    WHEN 'EXTRA'.

      DO.
        READ LINE SY-INDEX FIELD VALUE BOX2.
        IF SY-SUBRC NE 0. EXIT. ENDIF.
        IF BOX2 EQ 'X'.

          PERFORM  EXTRA_LIST .
          CLEAR BOX2.

          MODIFY LINE SY-INDEX
                      FIELD VALUE  BOX2
                      FIELD FORMAT BOX2 INPUT OFF
                                  T_TADIR-OBJ_NAME  COLOR COL_NEGATIVE
INVERSE ON.

        ENDIF.

      ENDDO.
    WHEN 'DOWN'.

      DO .
        READ LINE SY-INDEX FIELD VALUE BOX2 INTO W_BOX.
        IF SY-SUBRC NE 0.
             EXIT.
             ENDIF.

        IF W_BOX = 'X'.

        PERFORM DOWNLOAD.
        ENDIF.
        ENDDO.
      ENDCASE.
*&---------------------------------------------------------------------*
*&      Form  MODIFY_LIST1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MODIFY_LIST1 .
  DO LINES TIMES.
    READ LINE SY-INDEX.
    IF SY-UCOMM EQ 'SELLALL'.
      MODIFY LINE SY-INDEX FIELD VALUE BOX1 FROM 'X'.
      MODIFY LINE SY-INDEX FIELD VALUE BOX2 FROM 'X'.
    ENDIF.
    IF SY-UCOMM EQ 'DSELLALL'.
      MODIFY LINE SY-INDEX FIELD VALUE BOX1  FROM ' '.
      MODIFY LINE SY-INDEX FIELD VALUE BOX2  FROM ' '.
    ENDIF.

  ENDDO.



ENDFORM.                    " MODIFY_LIST1


*&--------------------------------------------------------------------*
*&      Form  OUTPUT_12
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM OUTPUT2.

  WRITE:/ SY-DBCNT COLOR 5.

  SORT T_TADIR BY AUTHOR.


  LOOP AT T_TADIR.
    ON CHANGE OF T_TADIR-AUTHOR.
      WRITE:/10 BOX1 AS CHECKBOX,
             15 T_TADIR-AUTHOR.
    ENDON.
    WRITE:/50 BOX2 AS CHECKBOX,
           55 T_TADIR-OBJ_NAME.
    HIDE T_TADIR-OBJ_NAME.
  ENDLOOP.



ENDFORM.                                                    "OUTPUT_12
*&---------------------------------------------------------------------*
*&      Form  DOWNLOAD
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM DOWNLOAD .
DATA: W_FILE TYPE STRING,

         W_PROGRAM(30).

      READ REPORT  T_TADIR-OBJ_NAME INTO ITAB..


CONCATENATE 'D:\DOWNLOAD_PROGRAM\' T_TADIR-OBJ_NAME  '.TXT' INTO W_FILE.
.
       WRITE:/ W_FILE.
           CALL FUNCTION 'GUI_DOWNLOAD'
             EXPORTING
               FILENAME   =  W_FILE
              FILETYPE     = 'ASC'
             TABLES
             DATA_TAB         = ITAB.
ENDFORM.                    " DOWNLOAD

try this code we can download all wht u want..

regards

Sunil Kumar Mutyala.

Former Member
0 Kudos

hi,

Plz check out the link.

http://www.sap-img.com/abap/download-and-upload-your-abap-program.htm

Regards

Sumit Agarwal

Former Member
0 Kudos

i want to download program with all respective include programs.

0 Kudos

yes it is possible using the link I provided or [this link|http://www.dalestech.com/downloads/Mass%20Download%20143.zip]

0 Kudos

Hi,

U can do that by the code provided by me..

copy that code and execute it u can dowlload all the programs including INCLUDE programs....

Regards,

Sunil Kumar Mutyala.....

Former Member
0 Kudos

To download all the Z-programs from a respective package use the below code.

&----


*& Report ZNILPRGPKG

*&

&----


*&

*&

&----


REPORT ZNILPRGPKG.

TABLES: tadir.

***********************************************************************

  • Data declaration *

***********************************************************************

TYPES: abapline(255) TYPE c.

TYPES: BEGIN OF ty_reposit,

pgmid TYPE tadir-pgmid,

object TYPE tadir-object,

obj_name TYPE tadir-obj_name,

devclass TYPE tadir-devclass,

END OF ty_reposit.

DATA: it_reposit TYPE STANDARD TABLE OF ty_reposit,

wa_reposit TYPE ty_reposit.DATA: it_repsrc TYPE STANDARD TABLE OF abapline,

wa_repsrc TYPE abapline.

DATA: prog(60) TYPE c,

mc_filename TYPE rlgrap-filename,

filename TYPE string.

************************************************************************

  • Selection Screen *

***********************************************************************

PARAMETERS: p_dev TYPE tadir-devclass."Package Name

*****Program Logic

SELECT pgmid

object

obj_name

devclass

FROM tadir

INTO TABLE it_reposit

WHERE pgmid = 'R3TR' AND

object = 'PROG' AND

devclass = p_dev.

IF sy-subrc NE 0.

MESSAGE s001(00) WITH 'No programs available in the given package'.

EXIT.

ENDIF.

LOOP AT it_reposit INTO wa_reposit.

prog = wa_reposit-obj_name.

READ REPORT prog INTO it_repsrc.

CONCATENATE 'E:\My ABAP Programs\'

prog

'.txt'

INTO mc_filename.

filename = mc_filename.

******Function module for download files into local system

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = filename

TABLES

data_tab = it_repsrc

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CLEAR prog.

CLEAR wa_repsrc.

ENDLOOP.

Only the code where you are specifying the path,change (if required) the drivename according to your system configuration.