Application Development 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: 

Emailing GOS docs as attchmts/issue is .txt attchmt

Former Member
0 Kudos

I have created a class to read the GOS documents in a specific folder and attach them to a send_request created with cl_bcs and email created with cl_document_bcs. 

The issue my users have identified is an extra, blank attachment to the email which is named <subject>.txt.  The <subject> is the text entered into the subject of the email document. 

Can anyone advise me how to set up the email document so that the extra attachment is Not created?

Patsy

1 ACCEPTED SOLUTION

FredericGirod
Active Contributor
0 Kudos

Hi Pasty,

maybe it's in the cl_document_bcs used your problem occurs. Can you give us this part of code ?

Regards

Fred

7 REPLIES 7

FredericGirod
Active Contributor
0 Kudos

Hi Pasty,

maybe it's in the cl_document_bcs used your problem occurs. Can you give us this part of code ?

Regards

Fred

0 Kudos

These are the instructions used to create the send_request and the email.

    send_request = cl_bcs=>create_persistent( ).
    email = cl_document_bcs=>create_document(
      i_type = 'RAW'
      i_subject = l_subj
     ).

    send_request->set_document( i_document = email ).


0 Kudos

I have already post an example code for this class : http://scn.sap.com/message/13850390#13845471

and this example is for adding GOS attachment

if you didn't find your problem I could send you the whole code (quite long)

regards

Fred

0 Kudos

Thank you Fred.  Your post appears to be the answer.  I really appreciate learning about class cl_gbt_multirelated_service.

0 Kudos

I could send you the code if you want, I think my email is in my profile.

it's an old code to send from the QM module the certificat of analysis.

Fred

arindam_m
Active Contributor
0 Kudos

Hi,

Check your code I think your code is processing the subject text as an attachment. Often happens with CL_BCS usage.

Check the SCN wiki post below and compare with your steps for the email creation

http://wiki.sdn.sap.com/wiki/display/Snippets/Send+email+from+ABAP+with+class+CL_BCS

Cheers,

Arindam

Former Member
0 Kudos

I think the real key here is keeping the method calls to cl_bcs and cl_document_bcs together within a try / endtry group.  The example in the wiki has a good many method calls within a single try/endtry group.  If, like me, you prefer to keep your try/endtry groups small - I think you will have to nest groups.  That is, if your users don't want the extra bogus attachment.