Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9236

Re: Action for upload of files to table

$
0
0

I do something similar in several applications - works fine. get back to me if there is not enough clues in method below

 

method on_click_object.



  data:

    lv_col_id like r_param->column,

    lv_indx like r_param->index,

    lv_attr like r_param->attribute.



  lv_col_id = r_param->column.

  lv_indx = r_param->index.

  lv_attr = r_param->attribute.



  if r_param->column = 'SEQNR'.

    data:

      lo_nd_f type ref to if_wd_context_node,

      lo_el_f type ref to if_wd_context_element,

      ls_f type zzfile.



    " get the file uploaded

    lo_nd_f = go_main_context->get_child_node( 'F_UPLOAD' ).

    lo_el_f = lo_nd_f->get_element).

    lo_el_f->get_static_attributes(

      importing

        static_attributes = ls_f ).



    if ls_f is initial.

      " report message

      im_message_manager->report_attribute_error_message(

        exporting

          message_text   = 'No file to upload has been selected'

          element        = lo_el_f

          attribute_name = 'FILE_UP' ).

      return.

    endif.



    ls_f-filelen = xstrlen( ls_f-file_content ).



    data:

      lv_filename type dsvasdocid,

      lv_filetype type dsvasdocid.



    lv_filename = ls_f-filename.

    call function 'DSVAS_DOC_FILENAME_SPLIT'

      exporting

        pf_docid     = lv_filename

      importing

        pf_filename  = lv_filename

        pf_extension = lv_filetype.



    ls_f-filename = lv_filename.



    " update the object table with the file uploaded

    data:

      lo_nd_object type ref to if_wd_context_node,

      lo_el_object type ref to if_wd_context_element,

      ls_object type zautoauth_object_str.



    lo_nd_object = go_main_context->get_child_node( 'ZAUTOAUTH_OBJECT' ).

    lo_el_object = lo_nd_object->get_element( lv_indx ).

    lo_el_object->get_static_attributes(

      importing

        static_attributes = ls_object ).



    move-corresponding ls_f to ls_object.

    lo_el_object->set_static_attributes(

      exporting

        static_attributes = ls_object ).

    lo_el_object->set_changed_by_client( ).

  endif.


endmethod.


Viewing all articles
Browse latest Browse all 9236

Trending Articles