Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

E-Mail Attachment is missing

0 Likes
1,687

Hi experts,

in our system, we get e-mails from another SAP machine.

In the transaction "SOIN" the e-mails are displayed correctly.

The e-mail should be forwarded to external recipients.

With help of "If_document_bc help" we were able to determine all the necessary data (body, receiver).

Unfortunately we can not determine the attachment (a zip-archive).

When creating our documents the attachments are missing.

We could determined information about the attachments by using the FM  "SO_ATTACHMENT_READ" and "SO_ATTACHMENT_LIST_READ" .

Code sample to create the document with an empty attachment

DATA: document TYPE REF TO cl_document_bcs.

document = cl_document_bcs=>create_document(  i_type    = me->soodk-objtp

                                                i_text    = me->mail_body-cont_text

                                                i_subject = subject

                                             ).

CALL METHOD document->add_attachment

  EXPORTING

    i_attachment_type     = 'EXT'

    i_attachment_subject  = '0SRCT_DS1_Q003'

*    i_attachment_size     =

*    i_attachment_language = SPACE

*    i_att_content_text    =

*    i_att_content_hex     =

*    i_attachment_header   =

And here i need the content of the attachment.

The class "CL_DOCUMENT_BCS" includes the method "add_attachment". I can add an attachment but i need the content from the original mail

How can I add the attachment to the document?

Best regards

David

Hi Bendale,

we get e-mail's from a other sap machine.

The e-mail should be forwarded to external recipients.

I must determine the attachment from this mail. Without the attachment i can't create a binary string and i haven't the text_content. ( necessary parameter for add_attachment method)

I search a FM or a class which determine the content of the attachment. I Know the name,type and the size from the attachment. But i don't know where the attachments are stored.

Can you help me?

Thanks,

David

6 REPLIES 6
Read only

Former Member
0 Likes
1,278

Hi David,

Check the include LCNTXF19 which will be helpful.

Hope it helps.

Thanks,

Tooshar Bendale

Read only

0 Likes
1,278

Hi Bendale,

I can't find the include "LCNTXF19". Where can i find it?

I think, the table "D010INC" contains all "includes" but the "LCNTXF19" isn't traceable.

Can you help me?

Thanks,

David

Read only

0 Likes
1,278

Hi David,

Seems that the main program of the include is assosiacted PS module.

However i have copying the part of content here.

*----------------------------------------------------------------------*

* Send by using BCS and Sendscreen

  TRY.

*     -------- create persistent send request ------------------------

      send_request = cl_bcs=>create_persistent( ).



*     -------- create and set document with attachment ---------------

*     create document from internal table with text

      document = cl_document_bcs=>create_document(

                      i_type    = 'RAW'

                      i_subject = lv_subject ).



*     add attachment to document

*     BCS expects document content here e.g. from document upload

*     binary_content = ...

      CALL METHOD document->add_attachment

        EXPORTING

          i_attachment_type    = lv_file_ext

          i_attachment_subject = lv_subject

          i_att_content_hex    = binary_content

          i_att_content_text   = text_content.



*     add document to send request

      CALL METHOD send_request->set_document( document ).



*     ---------- send document ---------------------------------------

      CALL METHOD send_request->edit

        EXPORTING

          i_hide_note = 'X'.



      COMMIT WORK.

* -----------------------------------------------------------

* *                     exception handling

* -----------------------------------------------------------

    CATCH cx_bcs INTO bcs_exception.

      WRITE: 'Fehler aufgetreten.'(001).

      WRITE: 'Fehlertyp:'(002), bcs_exception->error_type.

      EXIT.

  ENDTRY.

Thanks,

Tooshar Bendale

Read only

0 Likes
1,278

Hi Bendale,

we get e-mail's from a other sap machine.

The e-mail should be forwarded to external recipients.

I must determine the attachment from this mail. Without the attachment i can't create a binary string and i haven't the text_content. ( necessary parameter for add_attachment method)

I search a FM or a class which determine the content of the attachment. I Know the name,type and the size from the attachment. But i don't know where the attachments are stored.

Can you help me?

Thanks,

David

Read only

0 Likes
1,278

Hi David,

You are getting Email's from other SAP machine, so to determine the Attachment you can use the function module /OSP/GET_WORKITEM_ATTACHMENT or FM SAP_WAPI_GET_ATTACHMENTS you will need to pass the work item no to it.

You can go to SBWP ( SAP Business Workplace) and download the attachments locally and then use FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send.

Thanks,

Tooshar Bendale

Read only

0 Likes
1,278

Hello Bendale,


In the TA "Soin" i don't find information about the workitem.

In the TA "SWIA" I find no further information

About the FM "SO_ATTACHMENT_READ" and "SO_ATTACHMENT_LIST_READ"  i get some information about the attachment.

Now i need the binary string and text content. It must be possible without a workflow/workitem or?

How can i determine the workitem number?

Thanks

David