cancel
Showing results for 
Search instead for 
Did you mean: 

Creating attachment in Webdynpro for ABAP

former_member696081
Participant
0 Kudos

Hi Expertrs,

I am new to webdynpro for ABAP. I have a requirement like I need to create an attachment in webdynpro screen. I have searched the forums and I got the class CL_GOS_SRV_ATTACHMENT_CREATE and method EXECUTE_ITS. but when I call this method I am getting dump in the method.

Can anybody please suggest me how to create attachment in webdynpro for ABAP?

When ever attachment is created and clicks on save button workflow will be triggered and a workitem appears portal when ever the user click on the display attachment I need to display the created attachemnt.

Please suggest me.

Thank You.

Ranganadh

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi ,

do it in this way :

1 insert a file upload UI element

2 bind the DATA property of the element with context attribute of type string

3 in the Onaction method for uplaodaing ur file element , write the corresponding code

use FM 'HR_KR_XSTRING_TO_STRING' .

to convert XSTING FORMAT DATA into STRING FORMAT.

regards,

amit

Former Member
0 Kudos

Hi Ranga ,

http://help.sap.com/saphelp_nw04s/helpdata/en/f6/501b42b5815133e10000000a155106/frameset.htm

You can also find an example of this in the view FILEUPLOAD of web dynpro component WDR_TEST_EVENTS.

http://help.sap.com/saphelp_nw04s/helpdata/en/f6/501b42b5815133e10000000a155106/frameset.htm

FileUpload UI element can be used here. Please refer to view FILEUPLOAD of web dynpro component WDR_TEST_EVENTS for an example.

I hope it wud help u .

regards,

amit

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

You want to upload some file and show it as an attachment ?

What exactly is your req .can be more clear..

Regards,

Chaitanya Priya

former_member696081
Participant
0 Kudos

Hi Chaitanya,

Thank you for the reply. You are right. I have upload a file and I need to display it later. Can you please help me to resolve this issue.

Thank you.

Ranganadh.

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

To upload the file, you can upload it using FILE UPLAOD UI element.

You can refer the WD comp WDR_TEST_EVENTS.

Now after uploading where do you want to display the attachment?in some table?

Regards,

Priya

Former Member
0 Kudos

Hi,

Please follow the steps below;

Follow these steps;

1.create a node 'FILEUPLOAD' with 2 attributes

a) FILECONTENT type XSTRING

b) FILENAME type STRING

2. Create a fileuplaod uielement

a) bind the data property with attribute 'FILECONTENT'

b) bind the filename property with attribute 'FILENAME'

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. Your file will be saved in the database in XSTRING format.

Now when you want to display this file;

1. Create a Node 'FILEDOWNLOAD' with 1 attribute

a) FILE type XSTRING

2. Create a filedownload uielement

a) bind the data property with the attribute 'FILE'

Fetch the file from databased and set the File attribute of teh filedownload uielemnt to display the file.

Hope this helps!

Radhika.

former_member696081
Participant
0 Kudos

Hi Priya, Amit and Radhika,

Thank you verymuch for your valuable inputs. I will try it out and if I face any issues I will let you know.

Thank you.

Regards.

Ranganadh.

Former Member
0 Kudos

Hi ,

how can we read the file content from server location .

please give the solution for this and send the code to my mail ID : ravi2389@gmail.com

Thanks in Advance it is very urgent.

Regards.

Ravi.