cancel
Showing results for 
Search instead for 
Did you mean: 

How to attache a file and where to save the file

Former Member
0 Kudos

hi ,

i have created a webdynpro component for customer creation. while creation , he has to upload some files specific to thast customer.when the other person opens the customer for display , he has to choose specific file and he should be able to download the file.

Do i need to save the files in the database table specific to the customer? if , so in which form i have to save the files.

suggest me how to solve this problem.?

thanks,

Raghu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi, You can use FileUpload and FileDownload uielement for this scenario. You file would be saved in Database table in XSTRING format. For displaying the file later on, just fetch the data from the table and pass it do filedownload uielement. Radhika.

Former Member
0 Kudos

hi,

i tried to create a field with name CONTENT with type XSTRING in the data base table .

but its not allowing me to create, its saying that XSTRING is not active .

suggest me..

Raghu

Former Member
0 Kudos

In your database table create a field of type RAWSTRING. Radhika

Former Member
0 Kudos

even i tried to create the field CONTENT with type RAWSTRING.

its not allowing me to create ..

suggest me..

Raghu

Former Member
0 Kudos

is there any limit for the size of file to be loaded in the database table in the form of XSTRING?

Raghu

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Please describe what you are doing and what the error you are receiving. It should be perfectly fine to insert at least 3 STRING or RAWSTRING fields into a Database table (number increases to 16 in 7.02). Perhaps you already have too many STRING based columns? There is no size limit to the RAWSTRING storage in the database. However you should consider the impact on ABAP server memory (especially if your system is 32-bit) and processing time to manipulate the content into and out of the database table.

Former Member
0 Kudos

Hi Thomas,

My sytem is of 32 bit. I am using the database table with 2 fields as string and 1 field for content (of type rawstring ).

when i am uploading big file , its putting the content into database table. but whe i try to download the same file , its taking very long time . how i can reduce the time for download?

Raghu

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

How big a file? Have you traced to see where the time is being spent? Is it in the SQL to read from the DB? Is it in memory to allocate the necessary memory? Are you using so much session memory that you are swapping to disk? Is the time in the transfer across the network? How are you downloading the file? - Is it WDA (I assume) and you are using FileDownload?

There isn't much you can do if the problem is the network. Nor is there much you can do if the problem is memory - at least not much from a programming standpoint. More physical memory is probably the only help there.

If the problem is the SQL/DB then you might consider an alternative approach to how you store the file. In 7.02 we have database locators and streams that help with the processing of large STRINGS/XSTRINGS. Before then you might consider storing the data in a cluster table 1Kb per row instead of as a RAW STRING.

Also have you considered compressing the data using the CL_ABAP_ZIP class - before storage. This can help if the content is good for compression.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Raghu,

updates ?

Former Member
0 Kudos

Follow these steps; 1.create a node 'FILEUPLOAD' with 2 attributes a) FILECONTENT type XSTRING b) FILENAME type STRING 2. Create a Node 'FILEDOWNLOAD' with 1 attribute a) FILE type XSTRING 3. Create a fileuplaod uielement a) bind the data property with attribute 'FILECONTENT' b) bind the filename property with attribute 'FILENAME' 4. Create a filedownload uielement a) bind the data property with the attribute 'FILE' 3. Create a button 'UPLOAD' a) create the action method for this button Paste the following code in this method

Data l_node type ref to if_wd_context_node.
Data l_stru type wd_this->elements_cn_fileupload.
 
l_node = wd_context->get_child_node( 'FILEUPLOAD' ).
l_node->get_static_attributes( importing static_attributes = l_stru ).
"save l_stru-fielcontent in database.
Radhika