on 12-17-2014 10:57 AM
Hi,
I have an action used by a button to upload files. I am reprogramming it to Work with internal tables instead of a transparent table with the uploaded files.
The problem is that it does not add the files to the internal table, so there is always only one record in the itab. I must be doing something wrong here. If you can see it, please let me know. See source in the attached file.
Thanks; Peter
Thanks all,
The essence of this is that I have to reorganize the code from using a z-table in dictionary to use oi only internal tabels.
This Means that I have a record in LT_FILE_UPLOADS of the type TY_FILE_UPLOAD that is defined like my z-table, but now as a type.
Before when I used the z-table I could select into the LT_N_FILE_DOWNLOAD without problems. If I now try to move the data from LT_FILE_UPLOADS to LT_N_FILE_DOWNLOAD, I get a type mismatch and for that I would like advice. Hence the attached file.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter,
You mean if file1 is already attached/exists in internal table and if you attach new file say file2,
Does it should add file1,file2 to your internal tab?.
Thanks
KH
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter,
To achieve your requirment follow the below steps.
1) On your button action, first read the table UI element into one temp itab using GET_STATIC_ATTRIBUTES_TABLE.
i.e LO_ND_<NODE>->GET_STATIC_ATTRIBUTES_TABLE( IMPORTING TABLE = <TEMP_TAB>).
2) Now if <TEMP_TAB1> is not initial i.e if already files are attached, just try to APPEND your new attachment to <TEMP_TAB1>
3) Now your <TEMP_TAB1> consists of already attached file and new files which are attached.Just try to bind this <TEMP_TAB1> to your internal table.
Check the attachment which contains code for your reference.
Thanks
KH
I do something similar in several applications - works fine. get back to me if there is not enough clues in method below
my zzfile is defined as
FILENAME ZZFILENAME STRING 0 0 Filename
FILETYPE ZZFILETYPE STRING 0 0 Filetype
FILELEN ZZFILELEN CHAR 10 0 Filelength
FILE_CONTENT ZZFILE_CONTENT RAWSTRING 0 0 Filecontent
______________________________ ______________________________ ____________________________________________________________________________________________________________________________________ ______ ______ ____________________________________________________________
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.