cancel
Showing results for 
Search instead for 
Did you mean: 

call method cl_crm_documents->create_with_file not creating attachment

Former Member
0 Kudos

Hi,

I am trying to create attachment in a transaction type using cl_crm_documents->create_with_file. But it is not creating the same, instead gives error "Error loading file &".

I am uploading a file with fields object_id, text, file name, description and category.

I have passed the parameters as follows:

data: gref_obj type ref to cl_crm_documents.

create object gref_obj.

gw_prop_attr-name = 'BDS_KEYWORD'.

gw_prop_attr-value = gw_attach-category.

append gw_prop_attr to gt_prop_attr.

gs_business_object-instid = gw_guid-guid.(object guid)

gs_business_object-typeid = gv_object_type.(object type)

gs_business_object-catid = 'BO'.

call method gref_obj->create_with_file

exporting

file_name = gw_attach-f_name (name as provided in my uploaded file, in my case it is test)

directory = p_floder (C:\Attachment\)

properties = gt_prop_attr

business_object = gs_business_object

importing

phio = gs_phio_id

loio = gs_loio_id

error = ls_error.

Please help me on this. I doubt the directory that I am giving is wrong.

Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You marked your question as closed but unanswered. It seems to me that the primary inquiry was answered. The class and method you are trying to use is for SAPGUI usage only. Remember that you are in a web browser and don't have direct access to the client machine. You can't just specify c:\filename. Uploads must be done via the FileUpload UI element or the ACFUpDownload (7.01 and higher) UI Element.

Former Member
0 Kudos

Hi,

Please go through this...

Cheers,

Kris.