Anyway, to share some of the thing that I've done to get the body text work:
- 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.
- 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.
- 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:
DATA: lines_tab LIKE tline OCCURS 0 WITH HEADER LINE,
obj_name LIKE thead-tdname,
email_body_text TYPE TABLE OF soli,
email_line TYPE soli.
CONCATENATE nast-kschl '_BODY_TEXT' INTO obj_name.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'ST'
language = nast-spras
name = obj_name
object = 'TEXT'
TABLES
lines = lines_tab
EXCEPTIONS
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.
ENDLOOP.
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.
ENDIF.
7 comments:
Hello,
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,
David
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
Hi David,
I guess you missed the include. Check the following on how to use the swc macros.
http://help.sap.com/saphelp_nwpi71/helpdata/en/c5/e4b130453d11d189430000e829fbbd/content.htm
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.
If you look at the SAP Help.. to enable the macro, you need to add the pre-requisite INCLUDE ..
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 "
Oh .. dammit blogspot .. 'INCLUDE .' if this is failed .. read back the help page, it has that pre-req. INCLUDE ..
Works fine for me, thanks from Austria!
Post a Comment