cancel
Showing results for 
Search instead for 
Did you mean: 

Reg:Uploading of documents on webdynpro

former_member1193316
Participant
0 Kudos

Dear SDNers,

I need a application to upload documents from my desktop to webdynpro application. When I upload, it should show on the screen what I have uploaded. I want the way which I attached below.

Is it possible. Please guide me.

Regards,

Venkat

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Dear Venkat,

Try this code.

  Create one custom method with parameter lv_path as type string.

method ZZSPLIT_PATH .

  data lv_len       type i.

  data lv_delimiter type c VALUE '\'.

  data lv_lines     type i.

  data ls_split     type string.

  data lt_split     type table of string.

  check iv_path is not initial.

* get path/file separator

*  cl_gui_frontend_services=>get_file_separator(

*    changing

*      file_separator       = lv_delimiter

*    exceptions

*      cntl_error           = 1

*      error_no_gui         = 2

*      not_supported_by_gui = 3

*      others               = 99

*      ).

*  if sy-subrc <> 0.

*    raise_exception( sy-subrc ).

*  endif.

* check last char for delimiter

  lv_len = strlen( iv_path ) - 1.

  if iv_path+lv_len eq lv_delimiter

    or lv_delimiter is initial.

*   last char = delimiter, so most likely only path has been given

   " ev_path = iv_path.

    clear ev_name.

    return.

  endif.

  split iv_path at lv_delimiter into table lt_split.

  describe table lt_split lines lv_lines.

  if lv_lines eq 1.

*   only path has been given

   " ev_path = iv_path.

    clear ev_name.

  else.

*   path and name have been found

    loop at lt_split into ls_split.

      if sy-tabix < lv_lines.

       " concatenate ev_path ls_split lv_delimiter into ev_path.

      else.

        ev_name = ls_split.

      endif.

    endloop.

  endif.

endmethod.

on action upload.

Data:lv_text1 type string,

     lv_text2 type string.

get the file path.

  lo_el_n_upload->get_static_attributes(

    importing

      static_attributes = ls_n_upload ).

ls_file_details-file_name =  wd_this->zzsplit_path( iv_path = ls_n_upload-file_name ).

split ls_file_details-file_name at '.' into lv_text1 lv_text2.

  clear: ls_file_details-file_name.

move lv_text1 to ls_file_details-file_name.

append ls_file to lt_file.

  lo_nd_file_details->bind_table( new_items = lt_file_details set_initial_elements = abap_true ).

endmethod.

Regards

Jayaprakash T

Former Member
0 Kudos

There is no direct way you can use a FILE UPLOAD  for this purpose and get the file name attached to it and then you can use the SYST fields for time and date.

Phani

former_member1193316
Participant
0 Kudos

But I want to see the uploaded document by clicking against the file name. When I click on it, the file should open. Please let me know how to do that.

Regards,

Venkat

ramakrishnappa
Active Contributor
0 Kudos

Hi Venkat,

Please check the below document in which I have demonstrated the steps involved for attachment of files

Hope this helps you.

Regards,

Rama

Former Member
0 Kudos

My suggestion would be if you can get the stream convert it into Xstring and then use the method:

cl_wd_runtime_services=>attach_file_to_response( EXPORTING i_filename      = lv_filename

                                                                    i_content       = l_bin_content

                                                                    i_mime_type     = lv_mimetype

                                                                    i_in_new_window = abap_true ).