cancel
Showing results for 
Search instead for 
Did you mean: 

Upload Documents via WD

Former Member
0 Kudos

Hi all,

i want to upload documents via WD, i have more than 2 (UPLOAD- BROWSER) Buttoms , and all of this bottoms are binded to one(same) Action, which is mean that in the end , all the uploaded documents will be processed by the same Action, and at once, is that possible, is it possible to loop around a method ( get_attribute)?

is ther any way to do this?

thank you very much

Natel

Edited by: Natel Bargach on Sep 9, 2010 9:35 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can create a context of cardinality 0:n and

Create attributes for data , file path , mime etc bind all the FileUpload UI element (assuming that you are using it) to it.

then in the Onaction event of the upload button , you can call method GET_ELEMENTS of IF_WD_NODE for the context created above.

Then LOOP through the elements and call GET_STATIC_ATTRIBUTES() of IF_WD_ELEMENT to get the values of file uploaded (like data , path , mime) etc..

Thanks,

Aditya.

Former Member
0 Kudos

Hi, this IF_WD_NODE doesnt exist !!!

Former Member
0 Kudos

hi,

Very sorry ,

Its IF_WD_CONTEXT_NODE and IF_WD_CONTEXT_ELEMENT...missed it while typing.

Aditya.

Former Member
0 Kudos

LOOP at elem_context TYPE REF TO if_wd_context_element, dosnt work this is not ITable

Former Member
0 Kudos

Hi ,

The following code shows the looping part.Please have a look.

DATA lo_nd_table_node TYPE REF TO if_wd_context_node.
DATA lo_el_table_node TYPE REF TO if_wd_context_element.
DATA ls_table_node TYPE wd_this->element_table_node.
DATA lt_table_node TYPE wd_this->elements_table_node.
DATA lt_table TYPE wdr_context_element_set.

lo_nd_table_node = wd_context->get_child_node( name = wd_this->wdctx_table_node ).//Your node

lt_table = lo_nd_table_node->get_elements( including_lead_selection = abap_true ).//getting all elements

LOOP AT lt_table INTO lo_el_table_node.//looping

lo_el_table_node->get_static_attributes(
IMPORTING
static_attributes = ls_table_node ).

ENDLOOP.

Thanks,

Aditya.

Former Member
0 Kudos

something is wrrong, because i got an error message says: Context binding of property FILE_NAME cannot be resolved: Node

VIEW_M_UPLOAD_1.1.TABLE_NODE does not contain any elements

i lready binded the table_node with Upload,

Former Member
0 Kudos

What is the cardinality of the node?

0:n??

Aditya.

Former Member
0 Kudos

yes i did it cardinality 0..n and selection 0..1 this table_node containes the data, mymetype...

Edited by: Natel Bargach on Sep 9, 2010 11:06 AM

Former Member
0 Kudos

What is the cardinality of the node?

If it is 0:n...make it 1:n and also check initialization lead selection.

Try setting initialisation lead selection to true, and then see if it works

This kind of error occurs mainly because of cardinality errors.

Aditya.

Former Member
0 Kudos

always the same problem, i am getting only one path, from two UPLOAD UIelements i amgetting only one path, the ITable has always one value

Former Member
0 Kudos

Hi,

Have you binded both the FileUploadUI elements to the same context??

If possible pls post the code of your "Onaction" event handler.

Aditya.

Former Member
0 Kudos

yes all of the uploads are binded to one action, and the code is that one you send to me, no changes,

Former Member
0 Kudos

Hi,

The action is fine.What about the context.All are bound to the same context??

And how many elements is get_elements() returning?Or how many times is your loop executing??

This is another way of doing the same process.May be you can also try this.


DATA : lo_nd_upload_file      TYPE REF TO if_wd_context_node,
DATA : lt_upload_file         TYPE wd_this->Elements_upload_file,
lo_nd_upload_file = wd_context->get_child_node( name = wd_this->wdctx_upload_file ).


  lo_nd_upload_file->get_static_attributes_table( importing table = lt_upload_file ).

Aditya.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Binding two UI elements to the same context node isn't going to create two elements in the context. Instead both UI elements will be bound to the same element and overwrite each other. This is why you are recieving only one element back.

You probably should use two different context node in this case.

Former Member
0 Kudos

Hallo Mr Jung,

yes tha is right, so do you mean, i have to create two differents context for two UPLOAD UIelements and binded them to the same ACTION? i dont think that it will work, cause in the end i have to read only from one context, one IF, or it will be better for me if could read separately from each UPLOAD UI-ELEMEENT, this means that the path of the first ULPOAD UI will be read separately from the other one, but only with one ACTION , both will be generated from one ACTION , is this possible ? is there a way to know which UPLOAD UI-Element is filled ? if its the first or the second that is filled or containg a path? means which path belongs to which UPLOAD UI_Element?

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Yes you can still use one action. Just read each context node and see which one has data in the bound context attribute. Since you are bidning each UI element to a different context, you will know exactly which one was filled.

Former Member
0 Kudos

Problem Solved, thank you very much for your help

Answers (0)