cancel
Showing results for 
Search instead for 
Did you mean: 

Send pdf (Adobe Form) as email attachment using BCS

Former Member
0 Kudos

Hello everybody!

I want to send a pdf, generated by Adobe Forms function module, as an email attachment to a certain external mail receiver. I have read that the methods of the Business Communication Services can render this, but I couldn't create a working solution. Can somebody give me a coding example for this scenario?

I would be very happy if somebody could help me!

Best regards,

Markus

Accepted Solutions (1)

Accepted Solutions (1)

alex_cook
Active Participant
0 Kudos

Howdy

The mail request should be in the queue (transaction code SOST), but if you can also try the following before you call the send method:


lo_send_request->set_send_immediately( 'X' );

This will cause the mail to bypass the queue and send straight away. If that doesn't work make sure you catch any exceptions and see if there is an error message.

Cheers

Alex

Former Member
0 Kudos

Hi Alex,

the problem is, that the mail entry isn't in the SOST. It seems to me as if no mail is sent, even if no errors seem to occur during the generation of the mail.

Very strange effect...

Greetings!

Markus

0 Kudos

Hi Markus,

have you set the mail sender properly?


DATA:
        lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
        l_send    TYPE adr6-smtp_addr VALUE 'email of sender'.
  lo_sender = cl_cam_address_bcs=>create_internet_address( l_send ).

  lo_send_request->set_sender(
    EXPORTING
        i_sender = lo_sender ).

You need both, sender and recipient defined in the coding. In your example there is a comment "Set sender" but you define the recipient. So you should check your coding if you create both objects.

Regards

Ralf

alex_cook
Active Participant
0 Kudos

Howdy,

Apart from the above the only things I can suggest are seemingly obvious:

1) Make sure you are calling the lo_send_request->send( ); method

2) Have you got a COMMIT WORK after the send?

3) Are the any other similar reports using CL_BCS that are working in your system (ie is there definitely not a basis issue?)

Cheers

Alex

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi markus.birner,

You mentioned that you generated Adobe Forms using FM what is the FM you used? I have attached PDF from Script and Spool.

If you could send me the FM, so that can give you idea how to attach it to mail.

Regards,

Suneel Kumar G

david_liu1
Advisor
Advisor
0 Kudos

Hello,

Note 190669 contains additional options for sending lists from

customer-specific programs.

Comments concerning Release 6.10 and higher

The SBCOMS package in your system contains sample reports for sending documents using BCS.

The reports are named BCS_EXAMPLE_* where * denotes 1 to 5.

Regards,

David

alex_cook
Active Participant
0 Kudos

Howdy,

I found this contribution to be valuable - coded this yesterday based off the code starting on page 8 and it works a treat.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c2567f2b-0b01-0010-b7b5-977cbf806...

Cheers

Alex

Former Member
0 Kudos

Hello Alex!

your link to this document was very helpful. The scenario described in the pdf is almost what I was looking for. The only problem is, that the mail is sent to the Business Workplace Inbox. I want to send it to an external e-mail address. When I change the programm part where the recipient is defined like this:

  • Create recipient

DATA lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.

DATA l_reci TYPE adr6-smtp_addr VALUE 'somemailaddress'.

lo_recipient = cl_cam_address_bcs=>create_internet_address( l_reci ).

  • Set sender

lo_send_request->add_recipient(

EXPORTING

i_recipient = lo_recipient ).

then no mail is sent to the recipients mailbox. I tried several variants but no mail is sent. Does somebody know how to set an external e-mail as recipient in this case?

Best regards!

Markus