This website is not affiliated with, sponsored by, or approved by SAP AG.

Create eMail attachment/Close_FORM without SO_OBJECT_SEND

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Create eMail attachment/Close_FORM without SO_OBJECT_SEND

Postby Lipperland » Mon Mar 16, 2015 12:05 pm

Hello inclined reader,
I'm very new to this forum and already have a question I'd like your advice on. :)

Goal: What I'm trying to achieve is an email with both, an attachement and body text depending on the message type. Yes, quite something that it seems SAP didn't think too much about (or I don't have the latest news on this topic).
Quick version of what I think needs to be done: subdue call function SO_OBJECT_SEND in function close_form and call SO_OBJECT_SEND separately.

In detail:
I already followed certain OSS notes (and clues on a number of forums, found by google), e.g. 1086090 / SODIS which allows you to send certain informations, but not customized for the message type. Therefore, I followed another way - enhancing the function SO_OBJECT_SEND and filling table "note_text" which in general works fine, but I needed to use a rather dirty trick - filling the message type into the itcpo structure (output destination, tddest) - which works fine. But as mentioned - this is a little too dirty for my taste.
So what I'd like to do now is - call function SO_OBJECT_SEND separately and assign table "note_text" (the program for generation of Sales messages is already in Z-namespace - so no problem there concerning this topic). Right now, SO_OBJECT_SEND is called in close_form automatically (during processing of CONVERT_OTF_AND_MAIL which is started by close_form -> otf_resolve).

How can I close the form, create an OTF and then send the mail on it's own function call?
Am I on the right track? Can you give me feedback on how this might work? (The ideas mentioned above is more or less what I found in forums, I don't claim to have come up with those thoughts).

And yes, there are several topics concerning this issue, but unfortunately I wasn't able to find the right one or to get how it should be done. According to function SO_NEW_DOCUMENT_ATT_SEND_API1 - from my point of view, this would be the same problem as close_form will lead to sending of the mail anyway.

We are using SAP ERP ECC 6.0 without EPs.

Thanks in advance for your help,
Posts: 6
Joined: Thu Feb 07, 2013 2:17 am

Re: Create eMail attachment/Close_FORM without SO_OBJECT_SEND

Postby Gothmog » Tue Mar 17, 2015 5:57 am

The usual way to do this is to do it in the printing routine.
Instead of letting SAP send the mail, use parameter options-tdgetotf in OPEN_FORM, and get the OTF back in CLOSE_FORM.
Build the mail and send if yourself using SO_NEW_DOCUMENT_ATT_SEND_API1 or classes CL_BCS/Cl_DOCUMENT_BCS.

No need to mess with the standard code.
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Create eMail attachment/Close_FORM without SO_OBJECT_SEND

Postby Lipperland » Tue Mar 17, 2015 7:48 am

Wow, that was fast - thanks a lot, Gothmog!
This is working great. I don't really get where tdgetotf disrupts the programm flow (guess I need to do one more time of debugging, didn't see it myself while checking for variables that might do that trick), but it works great.
I used SO_NEW_DOCUMENT_ATT_SEND_API1 as suggested by you and can remove that messy extension. :)
So thanks again!

If anyone is struggeling to get that FM working (I hope this is not seen as advertisement) - please have a look at this thread in scn - there you will find a complete code to "reverse engineer":
or ... highlight=
though the last one might be a bit outdated, as a seperate call of "SX_OBJECT_CONVERT_OTF_PDF" seems to be (no longer?) necessary
Posts: 6
Joined: Thu Feb 07, 2013 2:17 am

Return to ABAP

Who is online

Users browsing this forum: No registered users and 8 guests


This website is not affiliated with, sponsored by, or approved by SAP AG.