Skip to main content

SAP/SD - Sending order/delivery/invoice via email with body text

This is surely not new, most of us ABAP developers will somehow come across this requirement in some of our project/implementation/support. For those who're on the latest SAP platform, probably you guys are lucky to have the IMPLICIT/EXPLICIT enhancement which you could do to enhance standard SAP function module. But for some of us who're still stuck with 620 or below, we're not so lucky.

Anyway, to share some of the thing that I've done to get the body text work:

  1. You can't use body text in NACE, it just doesn't work that way. Tried it so many times and given up. SAP has a note which says that no matter what you do, it will not work for you :) SAP Note 753622.
  2. Next best thing to do is, to go ahead and change the way the standard SAP send out email in the print program, create an OTF, and just after CLOSE_FORM, use SO_NEW_DOCUMENT_ATT_SEND_API1 or BCS to send the email out. For me, this is too much too.
  3. Probably the best option, do this in FORM_OPEN subroutine in the print program. This is what I've done and it works. Copy the standard RVADOPF0 into customer namespace and replace this in FROM_OPEN subroutine. Add the following code just after the check for retcode eq 0. Create a standard text using SO10 .. text name will be your (output type)_BODY_TEXT.
Here is the code that I've:

             obj_name LIKE thead-tdname,
             email_body_text TYPE TABLE OF soli,
             email_line TYPE soli.

CONCATENATE nast-kschl '_BODY_TEXT' INTO obj_name.
                id = 'ST'
                language = nast-spras
                name = obj_name
                object = 'TEXT'
                lines = lines_tab
                id = 1
                language = 2
                name = 3
                not_found = 4
                object = 5
                reference_check = 6
                wrong_access_to_archive = 7
                OTHERS = 8.
LOOP AT lines_tab.
  email_line = lines_tab-tdline.
  APPEND email_line TO email_body_text.
IF email_body_text[] IS NOT INITIAL.
  swc_object_from_persistent lvs_recipient recipient.
  swc_clear_container container.
  swc_set_element container 'NoteText' email_body_text.
  swc_call_method recipient 'AddNote' container.
  swc_object_to_persistent recipient lvs_recipient.


Anonymous said…

I followed your steps and tried to use your code, but I got error message: SWC_OBJECT_FROM_PERSISTENT" is not defined.

How should I define this and propably next statemens?

Thank you,
Anonymous said…
Hello. I tried to use your example, but I have problems with:
swc_object_from_persistent lvs_recipient swc_recipient.
swc_clear_container swc_container.
swc_set_element swc_container 'NoteText' email_body_text.
swc_call_method swc_recipient 'AddNote' swc_container.
swc_object_to_persistent swc_recipient lvs_recipient.

I don't know how to use it. I suppose there should be any declaration.

Could you plese help me with this?

Thank you. David
9W2TPT said…
Hi David,

I guess you missed the include. Check the following on how to use the swc macros.
Anonymous said…
Hi, I red the SAP help, but it didn't explain how to declare swc_object_from_persistent, can you help me ? Thanks in advance.
9W2TPT said…
If you look at the SAP Help.. to enable the macro, you need to add the pre-requisite INCLUDE ..


Somehow, blogspot won't allow me to have that < and >, guess it tought its a HTML tag .. it will get deleted, so .. add the above .. and don't forget to remove the "
9W2TPT said…
Oh .. dammit blogspot .. 'INCLUDE .' if this is failed .. read back the help page, it has that pre-req. INCLUDE ..
Anonymous said…
Works fine for me, thanks from Austria!

Popular posts from this blog

Raspberry Pi + svxlink = Low power echolink node

What is the easiest way to get echolink node up and running on raspberry pi? Surely, get a premade image which has everything inside. I've created one image which can fit into 2GB SD card for this, just follow the following steps to get it up and running:

For hardware, you need to have the following:
Raspberry Pi for sure, with a minimum 4GB SD cardA USB echolink interface, can be commercially sourced or DIY. There are many DIY schematics out there that you could follow.  Here is the configuration on how to get the things working together, courtesy of website:

For software:
Download the following prepared image from google drive, it is based on raspbian-2015-02-16 image and has pre-installed svxlink-14.08. raspi-wheezy-svxlink.img.zipUnzip the file and copy it to your SD card using the following instructions that can be found here.Boot up the RasPi, if you do not have an HDMI monitor, you may want to access the RasPi from your terminal emulator (putty or the like), connec…

Configuring TechniColor TG784N V3 (Maxis issued broadband router) to use different DNS servers

Previous write up deleted. It seems to change the DNS servers in as shown on the status, but it does not really work.

Check the following website, this seems to work:

This can be done from the WEB GUI too, go into the following configuration path:

In my example above, I'm using paid service unblock-us instead of google public DNS servers.

Debugging DMEE

I've come across many posting on the Internet (via google search), people asking on how to debug a DMEE for payment program. One of the few suggestion was to create a user exit just before the node that we would like to debug and put our breakpoint there. It seems that SAP has built-in this feature without needing us to create a user exit (available in ECC 6, have no idea if this is available on prior releases). Here is how you can put your breakpoint without any coding.

1. Display your DMEE tree using transaction: DMEE_DEBUG.

2. Click on the node that you would like to debug.
3. Go to conditions tab, you could see the Set Breakpoint button. Click to set.

4. Run the SAPFPAYM and specified the payment run date/id, payment format etc. SAP will stop at the node which you point your breakpoint at, as in 2.
5. To remove your breakpoint, just run the DMEE_DEBUG again, there is an option to delete all own breakpoints or all.