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: 

Download Multiples archived documents

former_member421809
Participant
0 Kudos

Hello All ,

I try to download multiple archived documents using this function module and it works , but the problem is that it download files in another place not in 'C:\'

thanks in advance,

5 REPLIES 5

Sandra_Rossi
Active Contributor

If you had taken the 10 seconds to debug it, you'd have seen that DTPATH parameter doesn't work, and that you must pass the path using SET PARAMETER ID 'OAP' FIELD 'C:\PATH' before calling the function module.

But, of course, this function module is not released, so I hope that you won't see this function module being deleted in a future release.

0 Kudos

Ok , so i have to found an alternative to download the multiple archive files in a single folder on the local

thanks Sandra

0 Kudos
Sorry, I don't know what the issue is.

former_member421809
Participant
0 Kudos

I try to download multiple files in local , but after i implement this code i have just the last selected document in local !

 CALL METHOD cl_gui_frontend_services=>directory_browse
    EXPORTING
*window_title = l_title
      initial_folder  = dir
    CHANGING
      selected_folder = l_string
    EXCEPTIONS
      cntl_error      = 1
      error_no_gui    = 2
      OTHERS          = 3.


  IF sy-subrc <> 0.


    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno


    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.


  ENDIF.




  REFRESH downdocs. CLEAR downdocs.


   LOOP AT int_conn  WHERE selfield = 'X'.
    MOVE-CORRESPONDING int_conn TO downdocs.






* check free space on client disk
* check size of document (print lists)
* if size of document exceeds x KB , dont transfer
    CALL FUNCTION 'SCMS_HTTP_GET'
      EXPORTING
        mandt                 = sy-mandt
        crep_id               = downdocs-archiv_id
        doc_id                = downdocs-arc_doc_id
*       COMP_ID               =
*       OFFSET                = 0
*       LENGTH                = -1
*       SIGNATURE             = 'X'
*       ACCESSMODE            = 'r'
*       SECURITY              = ' '
*       BLANKSTOCRLF          = ' '
*       NO_CACHE              = ' '
*       CREPHTTP              =
      IMPORTING
        length                = length_1
*       MIMETYPE              =
*       CHARSET               =
*       VERSION               =
*       FROM_CACHE            =
*       DOC_PROT              =
      TABLES
        data                  = data_tab
      EXCEPTIONS
        bad_request           = 1
        unauthorized          = 2
        not_found             = 3
        conflict              = 4
        internal_server_error = 5
        error_http            = 6
        error_url             = 7
        error_signature       = 8
        OTHERS                = 9.
    IF sy-subrc <> 0.
* Implement suitable error handling here
    ENDIF.


CONCATENATE l_string part2 INTO filename.


    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        bin_filesize = length_1
        filename     = filename
        filetype     = 'BIN'
      TABLES
        data_tab     = data_tab.
    IF sy-subrc = 0.
    counter = counter + 1.
    ENDIF.
    CLEAR : filename, int_conn , ls_conn.




  ENDLOOP.

0 Kudos

To quote Sandra, "if you had taken the 10 seconds to debug it" I'm sure you'd come up with at least one possible reason and solution.

From what I see, there is nothing extremely challenging in this task. Debugger is your friend.