cancel
Showing results for 
Search instead for 
Did you mean: 

Browse the file using button

Former Member
0 Kudos

In My requirement is should browse the file using button,I attach the image below,

If i click the add file button it should browse the below screen like that,

In that i want to select multiple file.Please send the method or sample code for my requirement..In webdynpro

Accepted Solutions (0)

Answers (1)

Answers (1)

bharath_k6
Active Participant
0 Kudos

Hi Prabhu,

You can have like this or it should work like this.

When you use File Upload UI element in Web Dynpro you will get Browse option as shown in the below screenshot. Upon cilcking Browse , browser window opens where you can select a required file. Here you can select only one single file.

Place a Upload button beside the Browse option. Click on Upload button after file has been selected from the browser window.

Use the below code to attach File information to internalt table.

   METHOD onactionupload .
  TYPES: BEGIN OF ty_file,
          file_name TYPE string,
          file_data TYPE xstring,
         END OF ty_file.

  DATA: ls_files TYPE ty_file,
        lt_files TYPE TABLE OF ty_file.

  DATA lo_nd_file_attach TYPE REF TO if_wd_context_node.

  DATA lo_el_file_attach TYPE REF TO if_wd_context_element.
  DATA ls_file_attach TYPE wd_this->element_file_attach.

  lo_nd_file_attach = wd_context->get_child_node( name = wd_this->wdctx_file_attach ).
  lo_el_file_attach = lo_nd_file_attach->get_element( ).
  lo_el_file_attach->get_static_attributes(
    IMPORTING
      static_attributes = ls_file_attach ).

  CHECK ls_file_attach-file_data IS NOT INITIAL.

  IF ls_file_attach-file_data =  wd_this->mv_file_data.
    ls_files-file_name = ls_file_attach-file_path.
    ls_files-file_data = ls_file_attach-file_data.

  ELSE.

    APPEND ls_file_attach TO lt_files.
  ENDIF.
  wd_this->mv_file_data = ls_file_attach-file_data.

  IF lt_files IS NOT INITIAL.
    APPEND LINES OF lt_files TO wd_this->mt_files.
  ENDIF.
  DELETE ADJACENT DUPLICATES FROM wd_this->mt_files COMPARING ALL FIELDS.
ENDMETHOD.

Upon clicking SAVE or Submit button as shown in the below screenshot, you send the File data from internal table wd_this->mt_files, to DMS system where attached document data gets stored.

You can use FM - BAPI_DOCUMENT_CREATE2 for creating documents in DMS system.

You can even store the selected file directly in to the DMS system everytime you select a file upon clicking Upload button, if you feel you dont need other button like SAVE or SUBMIT.

We had implemented the same for my customer. It is working fine for me.

Regards,

bharath.

Former Member
0 Kudos

i try this but i want to select multiple file.In my requirement instead of click the browse button.We have to press the addfile button.then the browse should open..

bharath_k6
Active Participant
0 Kudos

Hi,

I dont think it is possible. When something(Solution which is close to the expected) is already made available in the standard system, we should make use of it and should convince the customer the way it works.

Hope you have already seen the reply from Thomas in other thread Multiple file upload in webdynpro with flex.

Best Wishes,

Bharath.

bharath_k6
Active Participant
0 Kudos

Hi,

You may try with UI element - AcfUPDownload.

Please check the sample component - WD_TEST_APPL_ACFUPDOWN if it helps.

Best Wishes,

Bharath.