on 10-24-2008 12:04 PM
Hi Experts,
Iam new to WD ABAP.
Iam uploading one file from my local system using FileUpload.
i need to do following things.
1: I should get Only name and type of file ( when getting from context that is binded, It's giving full path of file )..
2: I should upload this file from context to specified directory (say 'TEST' )location at server.
Could anybody please guide me in this regard..
Please share some code.. because Iam new to WDABAP
Regards
Narayana
hi,
what properties you use in layout.
use fileupload.
bind filename to FILE_NAME (type xstring).
bing data to DATA( type string)
Edited by: kk on Oct 24, 2008 2:15 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> By using the method FILE_GET_SIZEof class CL_GUI_FRONTEND_SERVICES you will get file size.
>
> Thanks,
This absolutely will NOT work! Abap WD please not suggest solutions unless you have have tried them yourself. The frontend services will not work from Web Dynpro because they require a connection to the SAPGUI. They use the control framework to access the frontend. We have no such capabilities when running inside a browser.
For Web Dynpro ABAP you would use the fileUpload. Once the content is available in the context attribute (of type XSTRING), just read the context attribute into a local variable of type XSTRING like normal. To get the lenght use the ABAP keyword XSTRLEN. This will return the lenght in bytes of the uploaded file content.
>
> Hi ,
>
> Can you post sample statement here..
> for example my content is stored in a variable 'FILECONTENT' of type XSTRING.
>
> Thanks in advance
> Narayana
Ok, there isn't much to it but here is an example:
data filecontent type xstring.
data numbytes type i.
numbytes = xstrlen( filecontent ).
hi use this code
types: begin of t_header_text,
text0 type string,
text1 type string,
text2 type string,
end of t_header_text.
data: it_header_text type standard table of t_header_text.
data: wa_header_text like line of it_header_text.
data: node_file type ref to if_wd_context_node.
node_file = wd_context->get_child_node( 'FILE_UPLOAD' ).
node_file->get_attribute( exporting name = 'DATA' Importing value = value ).
node_file->get_attribute( exporting name = 'FILE_NAME' Importing value = FILE_NAME ).
node_file->set_attribute( name = 'FILE_NAME' value = FILE_NAME ).
conv = CL_ABAP_CONV_IN_CE=>CREATE( input = value ).
conv->READ( importing data = content ).
split content at cl_abap_char_utilities=>cr_lf into table rows .
read table rows into wa_rows index 1.
split wa_rows at '|' into:
wa_header_text-text0
wa_header_text-text1
wa_header_text-text2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Narayana,
Chek this standard document
[http://help.sap.com/saphelp_nw70/helpdata/EN/b3/be7941601b1d09e10000000a155106/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/EN/b3/be7941601b1d09e10000000a155106/frameset.htm]
Also check these forum threads
for file upload control you can look at WDR_TEST_EVENTS component
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Narayana,
The file content will be uploaded and placed into the context attribute that you bind to the data property of the FileUpload UI element. Once the data in the context, you should take care of handling the data. You can then try save it in the location that you want. If you intend you may try having another input field where the user can enter the path to save the file in. You can then try save the data from the context attribute in that specified path.
Regards,
Uday
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.