cancel
Showing results for 
Search instead for 
Did you mean: 

VERY VERY URGENT Attachment for Opportunity

Former Member
0 Kudos

I want to attach a file using a RFC/BAPI to an opportunity in CRM backend. The file will come in binary format/stream from a .NET iview.

Currently we are trying out the BAPI CRM_ICSS_UPLOAD_SR_ATTACHMENT. The file data that we given in binary format seems to go into CRM tables but when we see the opportunity through the front end transaction we dont see the file in the Attachments tab.

Please help as we want the solution urgently. Once this BAPI works we plan to make a WSDL out of it to be called from the .NET iview.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello sanjay,

As already pointed out you would need to use the method

CREATE_WITH_TABLE of the class CL_CRM_DOCUMENTS.

Below is the code sample that should help you achieve this(lt_file_content conatins the file content in binary).

ls_bo-instid = iv_parent_guid."header guid of oppt

ls_bo-typeid = 'BUS2000120'.

ls_bo-catid = 'BO'.

ls_file_info-file_size = lv_length.

ls_file_info-file_name = lv_name.

ls_file_info-mimetype = lv_content_type.

ls_file_info-binary_flg = 'X'.

APPEND ls_file_info TO lt_file_info.

CALL METHOD cl_crm_documents=>create_with_table

EXPORTING

business_object = ls_bo

file_access_info = lt_file_info

file_content_binary = lt_file_content

raw_mode = 'X'

parent_folder = ls_doc_info-loio

IMPORTING

error = ls_error.

I hope this helps you.

Best Regards,

Tanmaya

Former Member
0 Kudos

hi varma,

Even my requirement is same, thanks for the steps you have mentioned.

I called the method cl_crm_document->create_with_table.

I have handled all the parameters mentioned by you except PARENT_FOLDER.

for MIME_TYPE am passing, the value 'application/winword',

i pass the binary content to file_content_binary.

When i check the opportunity, its getting attached, but the data is in binary format.

Do i need to handle any other parameters or parent_folder parameter has to be handled?

Please do suggest.

Thanks & Regards,

Karthik.

Former Member
0 Kudos

sorry for mylast post, i got it, there was a small mistake in file uploading...

Thanks for the inputs varma..

Regards,

Karthik.

P000636
Active Contributor
0 Kudos

Well maybe this is a good opportunity to work with abap.. This is a forum no your programmer team.

Regards.

Manuel.

Wolfgang_Mayer
Active Participant
0 Kudos

Hi,

try methods CREATE_WITH* of class CL_CRM_DOCUMENTS.

Fill parameter BUSINESS_OBJECT with:

INSTID = <GUID of opportunity>

TYPEID = BUS2000111

CATID = BO

Pass the binary content to the corresponding parameters.

Regards

Wolfgang

Former Member
0 Kudos

Thanks for your reply. But can you give me an example as I am new to CRM coding and classes. I saw the parameters of the create_with_file method and following are the parameters. Can you indicate which parameters I need to use specifically as I dont find a parameter to pass the binary content.

I have removed the optinal parameters assuming that they wont be required.

FILE_NAME

DIRECTORY

BUSINESS_OBJECT

LOIO

PHIO

ERROR

Which is the parameter for passing binary content

Wolfgang_Mayer
Active Participant
0 Kudos

Hi,

I can't give you an example because I would have to write the coding myself first since I've never used this class the way you want to.

Regards

Wolfgang

Former Member
0 Kudos

Well this might be a good opp for you to earn points.

I anyways dont have the answer thats why I posted the query on the forum.

gregorw
Active Contributor
0 Kudos

Hi Sanjay,

have a look at my Weblog:

<a href="/people/gregor.wolf3/blog/2005/10/02/inbound-mail-processing-150-attach-files-to-opportunity">CRM: Inbound mail processing – Attach files to Opportunity</a>

there you find the complete code needed. Have you tried the search in SDN? You would have found the solution by searching for "Attachment Opportunity" or use Google with "Attachment Opportunity sap crm".

Regards

Gregor