Skip to Content

cl_crm_documents->create_with_file does not create attachment

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jan 07, 2014 at 02:43 PM

    DATA: ls_bor type sibflporb,

    lv_bor TYPE SWO_OBJTYP,

    lv_loio TYPE skwf_io,

    lv_phio TYPE skwf_io,

    lv_error TYPE skwf_error.

    DATA: wa_result_tab TYPE string,

    result_tab TYPE STANDARD TABLE OF string,

    lin TYPE i,

    long_nombre TYPE i,

    long_total TYPE i,

    desplazamiento TYPE i,

    filename_aux TYPE skwf_descr.

    CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'

    EXPORTING

    iv_orderadm_h_guid = guid

    IMPORTING

    EV_OBJECT_TYPE = lv_bor

    EXCEPTIONS

    ADMIN_HEADER_NOT_FOUND = 1

    OTHERS = 2

    .

    IF sy-subrc <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    MOVE:lv_bor TO ls_bor-typeid,

    'BO' TO ls_bor-catid,

    guid TO ls_bor-instid.

    CALL METHOD cl_crm_documents=>create_with_file

    EXPORTING

    file_name = filename

    directory = path

    business_object = ls_bor

    IMPORTING

    loio = lv_loio

    phio = lv_phio

    error = lv_error.

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

    EXPORTING

    wait = 'X'.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.