Skip to Content
avatar image
Former Member

Table UI element

Hi,

I have one file upload UI element and Upload button.Once I select the file and click upload, Im appendig it to a table. So each file uploaded will be a row in the table. Now, I would like to have link for each row for one column called filename. Once I click on that link I should be able to open the file.

can any one tell me how to get links for each file in the table?

Regards,

Ravi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Feb 27, 2009 at 09:08 AM

    take LinkToAction as Cell editor instead textView and bind the file_name attribute to the text

    create action handler for the LinkToAction, and code to view the file

    CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE(

    EXPORTING I_FILENAME = LV_FILENAME

    I_CONTENT = LS_ATTACH-FILE_CONTENT

    I_MIME_TYPE = LV_CTYPE

    I_IN_NEW_WINDOW = ABAP_TRUE ).

    Abhi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 27, 2009 at 10:44 AM

    Hi Ravi,

    Each row of your table effectively has all the content of one completely uploaded file, you need to read all this content into a STRING or XSTRING variable.

    You can read the entire row where the filename was clicked , by using the below code in

    onAction of LTA

    Data : lr_elem type ref to if_wd_context_element,
             ls_data type ZST_MYDATA.  
      
    CALL METHOD WDEVENT->GET_CONTEXT_ELEMENT
      EXPORTING
        NAME   = 'CONTEXT_ELEMENT'
      RECEIVING
        VALUE  = lr_elem.
    
    CALL METHOD LR_ELEM->GET_STATIC_ATTRIBUTES
      IMPORTING
        STATIC_ATTRIBUTES = ls_data.

    move this ls_data to you single STRING variable lets call it data_string.

    convert this to xstring type

    call function 'SCMS_STRING_TO_XSTRING'
        exporting
          text   = data_string
        importing
          buffer = data_xstring.

    depending on the MIME type of initial file uploaded change the value of i_mime_type parameter

    before calling.

    cl_wd_runtime_services=>attach_file_to_response( i_filename  = lv_file_name
                                                       i_content   = data_xstring
                                                       i_mime_type = 'EXCEL' ).

    on IE you would get a pop-up blocker message, accept it before you can see saves/open promt.

    Greetings

    Prashant

    Add comment
    10|10000 characters needed characters exceeded