Changes in function module SO_DOCUMENT_SEND_API1
Hi all,
I've been using function module SO_DOCUMENT_SEND_API1 to send e-mail (containing some simple text) with an Excel file attached to it. As of 01.11.2009 SAP has changed a lot of the function module code - and now the Excel file contents has become faulty (rows missing).
Can anyone give me code examples on how to use the new version of the function module?
Regards,
MV
Hi all,
I've been using function module SO_DOCUMENT_SEND_API1 to send e-mail (containing some simple text) with an Excel file attached to it. As of 01.11.2009 SAP has changed a lot of the function module code - and now the Excel file contents has become faulty (rows missing).
Can anyone give me code examples on how to use the new version of the function module?
Regards,
MV
Similar Messages
-
Regarding a Change Document Function Module ----- VERY VERY Urgent
I am using a Change Document Function module "CHANGEDOCUMENT_READ". It is taking a long time.
I am using the parameters:
Start date is the first date of the current month
Enddate as last date of the current month
Object class as 'MATERIAL'
Table Name as 'MBEW'Hi ,
When you want to read the change documents, please follow the below process.
1. Read the change documents headers with function modules
call function 'CHANGEDOCUMENT_READ_HEADERS'
exporting
date_of_change = cdhdr-udate
objectclass = cdhdr-objectclas
objectid = cdhdr-objectid
time_of_change = '000000'
username = cdhdr-username
tables
i_cdhdr = gt_cdhdr
exceptions
no_position_found = 1
wrong_access_to_archive = 2
time_zone_conversion_error = 3
others = 4.
2. From above step you will get data of change documents very quickly into Itab (gt_cdhdr)
3. Read the details on change documents with functiion module by using Itab in loop for each document.
loop at gt_cdhdr.
call function 'CHANGEDOCUMENT_READ_POSITIONS'
exporting
changenumber = gt_cdhdr-changenr
importing
header = cdhdr
tables
editpos = gt_cdshw
exceptions
no_position_found = 1
wrong_access_to_archive = 2
others = 3.
Above is the best way to read the change documents.
Rewards please if above info is useful.
Thanks. -
Hello abap Gurus,
My Zdevelopment reports shows the runtime errors due to
changes in this function module :-
ZCFM_HIDE_INITIALFIELD_ALV
So anybody pls. suggest me what i can do for this.I m attaching the coding also.
FUNCTION ZCFM_HIDE_INITIALFIELD_ALV.
""Local Interface:
*" IMPORTING
*" REFERENCE(STRUC)
*" REFERENCE(FIELDCAT) TYPE SLIS_T_FIELDCAT_ALV
*" REFERENCE(HIDE) OPTIONAL
*" EXPORTING
*" REFERENCE(FIELDCAT_E) TYPE SLIS_T_FIELDCAT_ALV
*" TABLES
*" IT_TAB
*" IT_TAB1
DATA S_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
FIELD-SYMBOLS <F1>.
FIELD-SYMBOLS <F2>.
DATA FIELDNAME(30).
DATA VALUE(100).
DATA : BEGIN OF DISPLAY OCCURS 0,
FIELDNAME LIKE DD03L-FIELDNAME,
END OF DISPLAY.
LOOP AT IT_TAB.
DO .
READ TABLE FIELDCAT INDEX SY-INDEX
INTO S_FIELDCAT.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
ASSIGN SY-INDEX OF STRUCTURE IT_TAB1 TO <F1>.
CONCATENATE 'IT_TAB-' S_FIELDCAT-FIELDNAME INTO
FIELDNAME.
ASSIGN (FIELDNAME) TO <F1>.
IF NOT <F1> IS INITIAL.
DISPLAY-FIELDNAME = S_FIELDCAT-FIELDNAME.
COLLECT DISPLAY.
ENDIF.
ENDDO.
ENDLOOP.
FIELDCAT_E = FIELDCAT.
LOOP AT FIELDCAT_E INTO S_FIELDCAT .
READ TABLE DISPLAY WITH KEY FIELDNAME = S_FIELDCAT-FIELDNAME.
IF SY-SUBRC NE 0.
IF HIDE IS INITIAL.
DELETE FIELDCAT_E.
ELSE.
S_FIELDCAT-NO_OUT = 'X'.
CLEAR S_FIELDCAT-KEY .
MODIFY FIELDCAT_E FROM S_FIELDCAT TRANSPORTING NO_OUT
KEY.
ENDIF.
ENDIF.
ENDLOOP.
endfunction.This is all about the runtime error :-
Incorrect parameter with CALL FUNCTION
Error analysis :-
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYN_CALL_PARAM_MISSING', was
not caught in
procedure "HIDE_FIELDS" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
When calling the function module "ZCFM_HIDE_INITIALFIELD_ALV", one of the
parameters
needed according to the interface description was not specified.
This parameter was "IT_TAB1".
I am not changing the function module, my couligue has change this he leave it & he doesn't tel to me. So pls. give some sol. to me.
Thanks,
Sumit. -
Problem with the function module SO_DOCUMENT_SEND_API1
Hi Friends,
I am facing the problem wiht the function module SO_DOCUMENT_SEND_API1,
My actull requirement is : - i need to send the sap data to my externa mail id (Like as XYZ@) with out the any attachment , So i have implemented the code with the function module SO_DOCUMENT_SEND_API1.
The mail has successfully sent the sap inbox (SOST) but the mail are not reached to the external mail ID'S( XYZ@GMAIL)
i Have maintained my code lines same as below.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_doc_data
put_in_outbox = ca_x
commit_work = ca_x
TABLES
packing_list = tb_packing_list
contents_txt = tb_mailbody
receivers = tb_receiver.
Can you please tell me soultion ,
Thanks
charan.Hi charan,
If u r able to see the mail in sost, then i think ur code has worked fine. if the mail is not going to outside domains from sost u need to do some configurations for that, u can find lots of configuration docs regarding mail setup in sap.
once try to pass below parameter also.
t_receivers1-rec_type = 'U'.
For configuring mail setup u need to sit with ur basis guy.
Moderator message: please do not use SMS speak.
Edited by: Thomas Zloch on Nov 23, 2010 5:51 PM -
Attachment using function module SO_DOCUMENT_SEND_API1
I am using the function module "SO_DOCUMENT_SEND_API1" to send a mail with a pdf attachment. My e-mail contains some text also.
The problem is along with the PDF I am also getting a TXT file as an attachment, which contains the same text data as the e-mail content. How can I delete the TXT attachment?
AnjuCALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
sender_address = w_sender
sender_address_type = w_sender_add_type
TABLES
packing_list = it_packing_list_mail
contents_bin = it_attachment
contents_txt = it_mess_body_mail
receivers = it_receivers_mail
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DESCRIBE TABLE it_mess_body_mail LINES w_cnt.
w_doc_data-doc_size = ( w_cnt - 1 ) * 255 +
STRLEN( it_mess_body_mail ).
w_mtitle = text1222.
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = w_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR it_packing_list_mail.
it_packing_list_mail-transf_bin = space.
it_packing_list_mail-head_start = 1.
it_packing_list_mail-head_num = 0.
it_packing_list_mail-body_start = 1.
DESCRIBE TABLE it_mess_body_mail LINES it_packing_list_mail-body_num.
it_packing_list_mail-doc_type = 'RAW'.
APPEND it_packing_list_mail.
DESCRIBE TABLE it_attachment LINES it_packing_list_mail-body_num.
it_packing_list_mail-transf_bin = 'X'.
it_packing_list_mail-head_start = 1.
it_packing_list_mail-head_num = 1.
it_packing_list_mail-body_start = 1.
it_packing_list_mail-doc_type = 'XLS'.
it_packing_list_mail-obj_name = 'ATTACHMENT'.
it_packing_list_mail-obj_descr = 'Attached Document'.
it_packing_list_mail-doc_size = it_packing_list_mail-body_num * 255.
APPEND it_packing_list_mail.
Thanks,
Anju -
Code sample for using change document function modules
Can someone send me some sample code for using function modules CHANGEDOCUMENT_READ_HEADER and CHANGEDOCUMENT_READ_POSITIONS? I'm specifically looking for changes that occured to the standard price field in the material master (MBEW-STPRS) and I need to pull the most recent price change for a given material. I'm not sure how to write the code efficiently since I don't have a date to pass (again, since we're looking for the most recent change.)
Thanks!hi check this..
CHANGEDOCUMENT_READ_HEADERS
Example:
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
objectclass = 'EINKBELEG'
objectid = l_objectid
username = space
TABLES
i_cdhdr = lt_cdhdr.
LOOP AT lt_cdhdr WHERE udate IN s_aedat.
CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
EXPORTING
changenumber = lt_cdhdr-changenr
TABLES
editpos = lt_editpos.
LOOP AT lt_editpos WHERE fname = 'LOEKZ'
AND f_new = 'L'.
p_desc = text-r01. " Cancel Contract
ENDLOOP.
ENDLOOP.
CHANGEDOCUMENT_READ_POSITIONS
Example:
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
objectclass = 'EINKBELEG'
objectid = l_objectid
username = space
TABLES
i_cdhdr = lt_cdhdr.
LOOP AT lt_cdhdr WHERE udate IN s_aedat.
CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
EXPORTING
changenumber = lt_cdhdr-changenr
TABLES
editpos = lt_editpos.
LOOP AT lt_editpos WHERE fname = 'LOEKZ'
AND f_new = 'L'.
p_desc = text-r01. " Cancel Contract
ENDLOOP.
ENDLOOP.
Check this link.
http://www.sap-img.com/mm001.htm
<REMOVED BY MODERATOR>
venkat.
Edited by: Alvaro Tejada Galindo on Mar 18, 2008 4:05 PM -
Function Module SO_DOCUMENT_SEND_API1
Hi,
I used the FM SO_DOCUMENT_SEND_API1 for sending an email. The email is not sent and the value of sy-subrc is 6. It says database inconsistency or internal error. Can you please explain about this error in detail ?
All the fields in the FM is getting populated with correct data.
Before calling the FM value of sy-subrc is 0.
Thanks in advanceHi Ramya,
you have to declare the data like this
DATA: RECIPIENT_INT LIKE SADRUD.
DATA: L_TAB_RECEIVER like SOMLRECI1 occurs 0 with header line,
and populate the receiver like this
l_tab_receiver-receiver = RECIPIENT_INT.
and then append it.
function module: CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = L_DOCUMENT_DATA
DOCUMENT_TYPE = 'RAW'
PUT_IN_OUTBOX = ' '
COMMIT_WORK = ' '
IMPORTING
SENT_TO_ALL = SENT_TO_ALL
NEW_OBJECT_ID =
TABLES
OBJECT_HEADER =
OBJECT_CONTENT = OBJCONT
RECEIVERS = L_TAB_RECEIVER
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8
thanks,
reward if helpful. -
How to change a function module ??
Hi, I am using the FM L_TO_CREATE_DN but i am having a problem. When the batch number doesn't exist the program should keep the text with the error in an internal table and should continue running with other deliveries. The problem is that the error is not in the list of exceptions, the problem occurs inside the function module, so I don't know how control it. I think I should change anything inside the function but I don't know how to do it, or maybe I could control before. Does anybody how to do it??
Hi amcaletrio,
As it is a Standard Function module,it is not possible for us to change. It is better to debug the code, not complete Function module.
In debugging first reach to the desired point by using break points.
1. In debugging mode, in the MENU bar you can see Breakpoints --->
Breakpoint at -
> statement(click here) .
2. Here type " MESSAGE".
3.Press F8
4.Stop here, the that u r looking is found or not
5.If not, again press F8
At one place you can get ur desired message.
Copy that FM only as user copy. Here instead calling the Standard FM call this
copied FM.Here in this Change message type from "E" to "W".
So that, you can get desired functionality.
Hope, the above desc. make you understand crystal clear.
If there is any doubts regarding this, You are welcome.
Reward,if helps.
Regards,
V.Raghavender. -
Changing IDOC function module?
Hello everyone!
I would like to make changes to the function module responsible for creating Sales Order Idocs: IDOC_INPUT_ORDERS. How should I go about this procedure? Do I need to copy the existing function module and create a new one? If so, how do I point the IDOC (ORDERS05) to the new function module (for example, ZIDOC_INPUT_ORDERS).
Thanks in advance!
Warm regards,
Glenn> I would like to make changes to the function module responsible for creating Sales
> Order Idocs: IDOC_INPUT_ORDERS. How should I go about this procedure?
> Do I need to copy the existing function module and create a new one?
(1)This is one possible solution, another one is to use some (2)customer function exits for inbound Idoc these enhancements might be useful: MM06E001, VEDA0001or (depending on platform you are) you might go for e.g. (3)Implicit enhancement. In last two cases you probably dont need to create Z-FM and Z-process code.
> If so, how do I point the IDOC (ORDERS05) to the new function module (for
> example, ZIDOC_INPUT_ORDERS).
1) Copy FM to ZFM
2) Specify characteristic of FM BD51
3) Create Z-inbound process code: WE42 and assign a Z-FM to it.
4) Assign FM to message type WE57
>If you have any other information on how to properly edit the IDOC function
> module (for example, adding ABAP checking codes before populating the IDOC
> fields) it would be great if you could share them!
To add some checks at the beginning you might use all three possible solutions:
(1) in ZFM you might add you code at the very beginning and return some error message
(2) you might use on of the available customer function exits to do some checks
(3) you can do the implicit enhancement and also return some error code at the very beginning of standard FM
In both cases I recommend to go for approach no (2). Useful tcodes: CMOD and SMOD.
Regards,
Jakub -
Change pointer Function Module
Is there any standard function module to create idoc of message type DEBMDM like we have MASTERIDOC_CREATE_SMD_DEBMAS for DEBMAS?
thank youuuudo one thing copy the MASTERIDOC_CREATE_SMD_DEBMAS into ZFM and code for segments which are not in DEBMAS03 ...
Regards..
dear dont forget to give points..miniimum 2 :)..make it good habbit.. -
How to use Change doc Function Module?
Fn mod:ZSUBTESTCHG_WRITE_DOCUMENT
Import parameters Value
OBJECTID ZSUBTESTCHG
TCODE SE37
UTIME 00:00:00
UDATE 09.03.2009
USERNAME 'TESTUSER'
PLANNED_CHANGE_NUMBER
OBJECT_CHANGE_INDICATOR I
PLANNED_OR_REAL_CHANGES R
NO_CHANGE_POINTERS
UPD_ICDTXT_ZSUBTESTCHG I
N_ZSUBTEST 2 TEST
O_ZSUBTEST 2 TEST
UPD_ZSUBTEST I
Tables Value
ICDTXT_ZSUBTESTCHG 0 Entries
I have a ztable 'ZSUBTEST' with 2 fields DEPTID and DEPNAME and ticked "change document" for data element.
I have created the above change doc write fn module. I am trying to insert a new reocrd into table.
How to use ZSUBTESTCHG_WRITE_DOCUMENT so that even if i try to change an existing record in ztable the old and new values for a particulat ztable will be filled in CDPOS Table.
Would appreciate if you can suggest me how to use in1) Update and 2) Insert scenarios.
Thanks,
Subbahi check this,
Types Declaration***
types: BEGIN OF X_audit,
Field of ZAUDIT TABLE OR a custom created table------
END OF X_audit.
Data Declaration***
Data: w_newvalues type X_audit,
w_oldvalues type X_audit.
DATA: BEGIN OF t_cdtxt OCCURS 0.
INCLUDE STRUCTURE cdtxt.
DATA: END OF t_cdtxt.
DATA: l_tcode type cdhdr-tcode ,
l_time type cdhdr-utime,
l_usnam type cdhdr-username,
l_date type cdhdr-udate.
**Constants****
CONSTANTS : l_objectid TYPE cdhdr-objectid VALUE 'ZAUDIT_CD'.
Initialization.
Clear: l_tcode,l_time, l_usnam, l_date.
Clear: w_newvalues, w_oldvalues.
**Start-Of-Selection**
Start-of-selection.
*Populating w_oldvalues workarea with old values from the table
Select single * from zaudit_t
Into w_oldvalues
Where belnr eq belnr_1
And gjahr eq gjahr_1
And bukrs eq bukrs_1. u201C where, belnr_1, gjahr_1, bukrs_1 are the fields on selection screen.
here we are populating w_newvalues workarea with new values
W_newvalues-f1 = w_oldvalues-f1
f2 = u2018XXXXXXXu2019 -
f3 = u2018YYYYYYYu2019
f4 = u2018ZZZZZZZu2019
l_tcode = sy-tcode.
l_time = sy-uzeit.
l_usnam = sy-uname.
l_date = sy-datum.
modify the table with new values***
MODIFY zaudit_t FROM w_submit.
IF sy-subrc EQ 0.
MESSAGE 'Document Updated' TYPE 'S'.
call function 'ZAUDIT_CD1_WRITE_DOCUMENT'
exporting
objectid = l_objectid
tcode = l_tcode
utime = l_time
udate = l_date
username = l_usnam
PLANNED_CHANGE_NUMBER = ' '
object_change_indicator = 'U' u201CU-update, I-insert, D-delete
PLANNED_OR_REAL_CHANGES = ' '
NO_CHANGE_POINTERS = ' '
upd_icdtxt_zaudit_cd = 'U'
n_zaudit_t = w_newvalues u201Cpass the work area containing new values
o_zaudit_t = w_oldvalues u201Cpass the work area containing old values
upd_zaudit_t = 'U' u201C this parameter gives the values in the columns(new value, old value and changed field name) of table CDPOS.
tables
icdtxt_zaudit_cd = t_cdtxt
ELSE.
MESSAGE 'Document Not Updated' TYPE 'S'.
ENDIF. u201CIF sy-subrc EQ 0. -
Table Structure changed in Function Module
Hello All,
How to check the strcuture of the table " yrdb_tp10_map:
got changed in the following FM.
As its not working properly.
function yrdb_tp10_get_mapping.
""Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(VARIANTE) TYPE YDOMAENE
*" REFERENCE(DOMAENE) TYPE YDOMAENE OPTIONAL
*" REFERENCE(OLD_VALUE) TYPE YOVALUE OPTIONAL
*" EXPORTING
*" REFERENCE(NEUER_WERT) TYPE YNVALUE
*" TABLES
*" YRDB_TP10_MAP TYPE YRDB_TP10_MAP_TYPE
*" EXCEPTIONS
*" NOT_FOUND
*" WRONG_IMPORT
tp10_map Feld über Zustand der globalen internen Tabelle
g_yrdbtp10_map
Wert X Tabelle gefüllt
data: import(1) type c,
tab_in type i.
if tp10_map eq space. "interne Tabelle leer.
select * from yrdb_tp10_map into table g_yrdbtp10_map.
sort g_yrdbtp10_map.
tp10_map = 'X'.
endif.
prüfen der importparameter.
wenn import = 'initial' beide Importparameter sind leer
wenn import = 1 domaene gefüllt
wenn import = 2 domaene und old value gefüllt
wenn import = 3 nur old value gefüllt --> raise Exception wrong_import
if domaene(1) ne space.
import = '1'.
endif.
if old_value(1) ne space.
if import = 1.
import = 2.
else.
raise wrong_import.
endif.
endif.
Vorbereitung der Rückgabe
wenn import = 'initial' Rückgabetabelle vorbereiten Ebene VARIANTE
wenn import = 1 Rückgabetabelle vorbereiten Ebene Domaene
wenn import = 2 Einzelwert zurückgeben new_value
case import.
when space.
loop at g_yrdbtp10_map into yrdb_tp10_map
where variante = variante.
append yrdb_tp10_map to yrdb_tp10_map.
endloop.
describe table yrdb_tp10_map lines tab_in.
if tab_in le 0.
raise not_found.
endif.
when '1'.
loop at g_yrdbtp10_map into yrdb_tp10_map
where VARIANTE = VARIANTE
and domaene = domaene.
append yrdb_tp10_map to yrdb_tp10_map.
endloop.
if tab_in le 0.
raise not_found.
endif.
when '2'.
read table g_yrdbtp10_map into yrdb_tp10_map
with key VARIANTE = VARIANTE
domaene = domaene
old_value = old_value.
if sy-subrc eq space.
neuer_wert = yrdb_tp10_map-new_value.
else.
raise not_found.
endif.
endcase.
endfunction.go to tables statements -
> double click on the structure----> it will takes you to that structure -
Sender's email id in function module SO_DOCUMENT_SEND_API1
Hi All,
I am fetching the sender's email id dynamically from HR database and then trying to use it while sending email via FM SO_DOCUMENT_SEND_API1. But the email does not go. The FM is erroring out with return code 6.
If I maintain email id in the user profile (Tcode SU01) and then simply pass sy-uname instead of complete email address in parameter - sender_address then it is working fine.
Is it not possible to explicitly send 'From email id' or 'Sender-address' parameter when sending mails using FM SO_DOCUMENT_SEND_API1 like for example [email protected]
The experts please solve my problem...
Thanks & regards,
RashmiIn this object i was able to send the mail. just check the type of reciever.
DATA: objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objhex like SOLIX occurs 0 with header line,
reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1,
v_tab_lines1 LIKE sy-tabix ,
v_temp type sy-tabix , "
v_doc_hdr type sy-tabix ,
v_tab_lines LIKE sy-tabix .
DATA : v_up TYPE i,
v_nup TYPE i.
IF cb_nonup EQ c_x.
READ TABLE i_get_latest WITH KEY upstream = space.
IF sy-subrc EQ 0.
v_nup = 1.
ENDIF.
ENDIF.
IF cb_upstm EQ c_x.
READ TABLE i_get_latest WITH KEY upstream = c_x.
IF sy-subrc EQ 0.
v_up = 1.
ENDIF.
ENDIF.
Setting up File Name & Mail Subject
doc_chng-obj_name = 'Attachment'(067). " File Name
IF v_up EQ 1 AND
v_nup EQ 1.
Subject
doc_chng-obj_descr = 'The list of Upstream / Non-Upstream'(066).
objtxt = 'Upstream/Non-Upstream files are attached'(065). " Body
ELSEIF v_up EQ 1.
Subject
doc_chng-obj_descr = 'The list of Upstream'(064).
objtxt = 'Upstream file is attached'(063). " Body
ELSEIF v_nup EQ 1.
Subject
doc_chng-obj_descr = 'The list of Non-Upstream'(062).
objtxt = 'Non-Upstream file is attached'(061). " Body
ENDIF.
data : v_del type x value '0A',
v_tab type x value 9 . "
Appending the body of the Mail
concatenate objtxt v_del into objtxt.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES v_doc_hdr.
READ TABLE objtxt INDEX v_doc_hdr.
doc_chng-doc_size = ( v_tab_lines - 1 ) * 480 + STRLEN( objtxt ).
doc_chng-doc_size = ( v_doc_hdr - 1 ) * 255 + STRLEN( objtxt ).
Creation of the entry for the Mail Contents
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = v_doc_hdr.
objpack-doc_type = 'RAW'.
APPEND objpack.
v_temp = 1. "
if cb_nonup eq c_x.
Creation of the Non-Upstream Xcel document as attachment
CLEAR objbin.
LOOP AT i_get_latest WHERE upstream EQ space.
objbin = i_get_latest .
concatenate objbin v_del into objbin.
APPEND objbin.
objtxt = i_get_latest.
concatenate objtxt v_del v_del into objtxt.
concatenate i_get_latest-massn+0(6)
v_tab
i_get_latest-massg+0(30)
v_tab
i_get_latest-aedtm
v_tab
i_get_latest-begda
v_tab
i_get_latest-pernr
v_tab
i_get_latest-nachn+0(12)
v_tab
i_get_latest-vorna+0(12)
v_tab
i_get_latest-midnm
v_tab
i_get_latest-ptext+0(20)
v_tab
i_get_latest-orgeh+0(8)
v_tab
i_get_latest-orgtx+0(25)
v_tab
i_get_latest-name1+0(30)
into objtxt.
append objtxt.
clear objtxt.
concatenate i_get_latest-bukrs+0(4)
v_tab
i_get_latest-kostl+0(10)
v_tab
i_get_latest-ltext+0(25)
v_tab
i_get_latest-ort01+0(15)
v_tab
i_get_latest-state+0(10)
v_tab
i_get_latest-func_org
v_tab
i_get_latest-fun_dept
v_tab
i_get_latest-chief_name
v_tab
i_get_latest-ess_role
v_tab
i_get_latest-email_id
into objtxt.
shift objtxt by 2 places right.
append objtxt.
Appending an empty line to demarcate records in attachment file
clear objtxt.
append objtxt.
ENDLOOP.
Creation of the entry for the Non-Upstream attachment
objhead = 'Non-Upstream.xls'(060). " Attachment Name
APPEND objhead.
clear objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 2.
objpack-body_num = v_tab_lines - v_doc_hdr.
objpack-doc_type = 'XLS'. "
objpack-doc_type = 'TXT'. "
objpack-obj_name = 'Non Upstream'(059).
objpack-obj_descr = 'Non Upstream'(059).
objpack-doc_size = v_tab_lines * 480. "
objpack-doc_size = ( v_tab_lines - v_doc_hdr ) * 255. "
APPEND objpack.
endif.
if cb_upstm eq c_x.
Creation of the Upstream Xcel document as attachment
CLEAR objbin.
LOOP AT i_get_latest WHERE upstream EQ c_x.
objbin = i_get_latest .
concatenate objbin v_del into objbin.
APPEND objbin .
objtxt = i_get_latest.
concatenate objtxt v_del v_del into objtxt.
append objtxt.
concatenate i_get_latest-massn+0(6)
v_tab
i_get_latest-massg+0(30)
v_tab
i_get_latest-aedtm
v_tab
i_get_latest-begda
v_tab
i_get_latest-pernr
v_tab
i_get_latest-nachn+0(12)
v_tab
i_get_latest-vorna+0(12)
v_tab
i_get_latest-midnm
v_tab
i_get_latest-ptext+0(20)
v_tab
i_get_latest-orgeh+0(8)
v_tab
i_get_latest-orgtx+0(25)
v_tab
i_get_latest-name1+0(30)
into objtxt.
append objtxt.
clear objtxt.
concatenate i_get_latest-bukrs+0(4)
v_tab
i_get_latest-kostl+0(10)
v_tab
i_get_latest-ltext+0(25)
v_tab
i_get_latest-ort01+0(15)
v_tab
i_get_latest-state+0(10)
v_tab
i_get_latest-func_org
v_tab
i_get_latest-fun_dept
v_tab
i_get_latest-chief_name
v_tab
i_get_latest-ess_role
v_tab
i_get_latest-email_id
into objtxt.
shift objtxt by 2 places right.
append objtxt.
Appending an empty line to demarcate records in attachment file
clear objtxt.
append objtxt.
ENDLOOP.
DESCRIBE TABLE objbin LINES v_tab_lines1. "
DESCRIBE TABLE objtxt LINES v_tab_lines1. "
objhead = 'Upstream.xls'(070). " Attachment Name
APPEND objhead.
if cb_nonup eq c_x.
v_temp = v_tab_lines. "
v_tab_lines = v_tab_lines1 - v_tab_lines.
else.
v_tab_lines = v_tab_lines1.
endif.
Creation of the entry for the compressed attachment
objpack-transf_bin = 'X'. "
clear objpack-transf_bin. "
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1. "
objpack-body_start = v_temp + 1. "
objpack-body_num = v_tab_lines. "
objpack-body_num = v_tab_lines - 1.
objpack-doc_type = 'XLS'. "
objpack-doc_type = 'TXT'. "
objpack-obj_name = 'Upstream'(058).
objpack-obj_descr = 'Upstream'(058).
objpack-doc_size = v_tab_lines * 480. "
objpack-doc_size = ( v_tab_lines ) * 255. "
APPEND objpack.
endif.
Completing the recipient list
reclist-receiver = p_emlid.
reclist-rec_type = 'U'.
APPEND reclist.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
IF sy-subrc <> 0.
MESSAGE i000 WITH 'Error in sending Email'(052) .
ELSE.
MESSAGE i000 WITH 'Message sent successfully !'(050).
ENDIF.
ENDFORM. " send_email -
Data alignment issue with function module SO_DOCUMENT_SEND_API1
Hi All,
I am using function SO_DOCUMENT_SEND_API1 to send email from SAP. What is happening is the internal table which contains the data of the email(Content of the email) is ok. That is data in internal table is in proper format as required. This table is passed to FM SO_DOCUMENT_SEND_API1. After execution of this FM, mail is sent but the format of the email content is not the same as the format of the data in internal table.
Can anyone guide me regarding this discrepancy in the data alignment or format in the actual email ?
Thanks in advance.
Regards,
ChetanHi,
Pass the values like the following format,
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
object_content = objcont
receivers = intrcvers[].
CASE int_error.
WHEN 0.
MESSAGE s888(sabapdocu) with "Mail Sent Successfully...".
WHEN OTHERS.
MESSAGE s888(sabapdocu) with "Mail Not Sent...".
ENDCASE
I hope this will solve your problem.
Gothrough the following link,
https://forums.sdn.sap.com/click.jspa?searchID=14853082&messageID=5409233
Regards,
Harish -
Doubt in using the function module SO_DOCUMENT_SEND_API1
Hi ,
My requirement is sending an excel sheet to the mail id's given in excel sheet.I am using the FM:SO_DOCUMENT_SEND_API1.I complete the program. It is working good.My problem here is once I received the excel sheet , if the amount value is 123.00. i can see only 123. As if the amount value is 123.78, i can see the value 123.78.I can see the value perfectly in debug mode , but the valus has been truncated in excel sheet .
Can anyone give me the idea how to correct this ?
Thanks,
Suresh.Most likely reason seems to be that Excel is being overly friendly and fixing formats for you - e.g. if you have a column containing a PO reference such as 4500001234 then it will assume this is a number that can be included in calculations for format it as general, and not a text string that just happens to contain only numbers. You can fix this once the data is in Excel by formatting the cells the way you want.
Jonathan
Maybe you are looking for
-
I have a 2008 macbook 10.6.8 software, I recently downloaded icloud but the photo stream isn't showing up although i have all the other elements of Icloud i.e. calender, mail, notes etc....everything except photos strream. What is the problem? I've
-
How to import both CDs of a 2 disc set?
My daughter has been trying to import the CD Hannah Montana 2 into itunes. The first disc, named Hannah Montana 2, imported easily. When we put the second disc, named Meet Miley Cyrus, into the computer and click import in itunes, it automatically li
-
Multi Currency in Sales Opportunities
Hi Experts..... If local currency is INR and system currency in EURO then in sales opportunity I want to create new transaction with USD currency. But the potential amount of sales opportunity displays in either local or system currency only. Then ho
-
Help needed with PK and FK between tables
I need help with setting Primary keys and specially Foreign Keys between tables. This is star schema case, where SalesFact in located in middle. I have specially understanding what should be primary keys in SalesFact and setting FK relations. Also an
-
Log-in pages are being blocked.
<blockquote>Locking duplicate thread.<br> Please continue here: [[/questions/928639]]</blockquote> All the log-in pages to my regularly visited websites are being blocked. Saved sites that have stored log-in info or sites where I have accounts that I