Application Development and Automation 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: 
Read only

Downloading Source code and text elements through ws_download

Former Member
0 Likes
1,173

Can anyone give any example of a program which used for downloading ABAP/4 Source Code and Text Elements to the desktop using WS_DOWNLOAD Function Module. The Program should run in foreground only.

Can anyone give any example of a program which used for downloading ABAP/4 Source Code and Text Elements to the desktop using WS_DOWNLOAD Function Module. The Program should run in foreground only.

3 REPLIES 3
Read only

Former Member
0 Likes
808

[Link to Downloading Source code and text elements through ws_download|https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/downloadProgramwithincludestoafolderinPC]

Prabhu

Read only

Former Member
0 Likes
808

Hi CHeena,

Try to use GUI_DOENLOAD instead of WS_DOWNLOAD as it is a Obsolute one.

You can use this function module 'DYNP_VALUES_READ'

Dileep

Read only

Former Member
0 Likes
808

Hi...

Try this code. I m using this code to download ABAP/4 code and I m able to do it but it does not download the text element.

REPORT ZDOWNLOAD_PROGRAMS .

TABLES : D010SINF.

TYPES : ABAPLINE(255).

DATA: I_REPSRC TYPE STANDARD TABLE OF ABAPLINE  WITH HEADER LINE,
           IT_D010SINF TYPE STANDARD TABLE OF D010SINF  WITH HEADER LINE.

DATA: PROG(60) .

DATA : MC_FILENAME LIKE RLGRAP-FILENAME,
       FILENAME LIKE RLGRAP-FILENAME,
       FILENAME1 LIKE RLGRAP-FILENAME.

SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-101.
SELECT-OPTIONS : S_OBJECT FOR D010SINF-PROG,
                 S_AUTHOR FOR D010SINF-CNAM OBLIGATORY,
                 S_DEV FOR IT_D010SINF-CLAS.

PARAMETER : P_DATE LIKE SY-DATUM OBLIGATORY.

SELECTION-SCREEN : END OF BLOCK B1.

SELECTION-SCREEN : BEGIN OF BLOCK B2 WITH FRAME.
PARAMETER : P_FNAME LIKE RLGRAP-FILENAME.
SELECTION-SCREEN : END OF BLOCK B2.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
       EXPORTING
            STATIC    = 'X'
       CHANGING
            FILE_NAME = P_FNAME.

START-OF-SELECTION.


  SELECT * FROM D010SINF INTO TABLE IT_D010SINF
                         WHERE PROG IN S_OBJECT AND
                               CNAM IN S_AUTHOR AND
                               CLAS IN S_DEV.


  IF SY-SUBRC NE 0.
    MESSAGE S001(00) WITH 'No programs available in the given package'.
    EXIT.
  ENDIF.

  LOOP AT IT_D010SINF.
    PROG = IT_D010SINF-PROG.

    READ REPORT PROG INTO I_REPSRC.
    CLEAR MC_FILENAME.

    CONCATENATE P_FNAME
                P_DATE '\prog\'
                   PROG
                  '.txt'
        INTO MC_FILENAME.

    DATA : FILE TYPE STRING.
    FILE = MC_FILENAME.

    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                = FILE
*        FILETYPE                = 'DAT'
        TABLES
          DATA_TAB                = I_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.


    CLEAR PROG.
    CLEAR I_REPSRC.
    CLEAR FILE.

  ENDLOOP.

*after download all the programs to intimate user.

  MESSAGE S001(00) WITH 'Check your folder for the Programs downloaded'.

Hope, it will help u.

Thanks,

Poonam.