Skip to Content
-1

Download Multiples archived documents

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,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jun 02, 2017 at 08:45 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 05, 2017 at 03:25 PM

    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.
    
    Add comment
    10|10000 characters needed characters exceeded

    • 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.