cancel
Showing results for 
Search instead for 
Did you mean: 

How to add an attachement ?

boolan
Participant
0 Kudos

Hello,

I need to add an attachement (file) to a complaint, just like You normally do in transaction CRMD_ORDER.

But I want to do it programmatically (through a call to a function module or method).

Which function(method can I use for that ?

How to do it having only complaint number ? (Which tables to search for necessary data)

Code snippets would be appreciated !

The best answer will be rewarded.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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'.

ENDFUNCTION.

Former Member
0 Kudos

Hi,

use class CL_CRM_DOCUMENTS to create attachement.

Thanks,

Ravi

boolan
Participant
0 Kudos

Hello Velaki,

I already know which class to use.

But I don't know which method of this class I should use.

And what exactly should I provide as parameters and in which tables to find them having only complaint number (I suppose I should start from CRMD_ORDERADM_H).

kind regards,