Forward excel attachment to the user-defined mail id
Hello Everybody
i hv collect all data into the ITAB and want to transfer that data to excel format and send that excel file as an attachment to the user-defined mail id .
Input on selection-screen
SELECTION-SCREEN : BEGIN OF BLOCK B1 .
PARAMETERS : MAILID(255) TYPE C .
SELECTION-SCREEN : END OF BLOCK B1 .
plz suggest me
ASAP
Hi Sandeep,
EMAIL as EXCEL ATTACJEMENTS
Refer the following codes ..
Hope this will help you..
TYPE-POOLS: truxs.
DATA t5 LIKE t005t OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
SELECT * INTO TABLE t5
FROM t005t
WHERE spras = sy-langu.
DATA wa_data TYPE truxs_t_text_data.
CALL FUNCTION 'SAP_CONVERT_TO_TXT_FORMAT'
EXPORTING
i_line_header = 'X'
TABLES
i_tab_sap_data = t5
CHANGING
i_tab_converted_data = wa_data
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
DATA stmp(4096) TYPE c.
DATA itmp TYPE i.
LOOP AT wa_data INTO stmp.
itmp = STRLEN( stmp ).
stmp+itmp = cl_abap_char_utilities=>cr_lf.
MODIFY wa_data FROM stmp.
ENDLOOP.
PERFORM send_email.
*& Form send_email
FORM send_email .
DATA docs LIKE docs OCCURS 0 WITH HEADER LINE.
DATA excelsize TYPE i.
DATA excel LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA doc LIKE sodocchgi1.
DATA excelln TYPE i.
DATA int_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA int_objhead LIKE solisti1 OCCURS 2 WITH HEADER LINE.
DATA int_objtext LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA int_reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA bodyln LIKE sy-tabix.
DATA output_data TYPE ssfcrescl.
excel[] = wa_data[].
excel table sizes
DESCRIBE TABLE excel LINES excelln.
Body Email
int_objtext-line = 'Test Body'.
APPEND int_objtext.
DESCRIBE TABLE int_objtext LINES bodyln.
READ TABLE int_objtext INDEX bodyln.
CLEAR doc.
doc-doc_size = ( bodyln - 1 ) * 255 + STRLEN( int_objtext ).
doc-obj_name = ' '.
doc-sensitivty = 'P'.
doc-proc_syst = sy-sysid.
doc-proc_clint = sy-mandt.
CLEAR: int_objpack, int_objpack[].
int_objpack-transf_bin = ' '.
int_objpack-head_start = 1.
int_objpack-head_num = 0.
int_objpack-body_start = 1.
int_objpack-body_num = bodyln.
int_objpack-doc_type = 'RAW'.
int_objpack-obj_descr = 'Test'.
APPEND int_objpack.
CLEAR: int_objhead, int_objhead[].
int_objhead = 'Attachment'.
APPEND int_objhead.
int_objpack-transf_bin = 'X'.
int_objpack-head_start = 1.
int_objpack-head_num = 0.
int_objpack-body_start = 1.
int_objpack-body_num = excelln.
int_objpack-doc_size = excelsize.
int_objpack-doc_type = 'XLS'.
int_objpack-obj_name = 'excel'.
int_objpack-obj_descr = 'test.xls'. "File name
APPEND int_objpack.
Set Receiver
int_reclist-receiver = 'SAPUSER'.
int_reclist-rec_type = 'B'.
int_reclist-notif_del = 'X'.
int_reclist-notif_read = 'X'.
int_reclist-notif_ndel = 'X'.
int_reclist-express = 'X'.
APPEND int_reclist.
doc-obj_descr = 'Report in Excel'.
Sending Email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = int_objpack
object_header = int_objhead
contents_bin = excel
contents_txt = int_objtext "Body
receivers = int_reclist
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.
ENDFORM. " send_email
Note:
- If you are using FM SAP_CONVERT_TO_TXT_FORMAT you will not be able to execute this program in the background.
- dont forget to change 'SAPUSER' to your SAP user ID
- you can check the email by using tcode 'SBWP'.
Reward points if this Helps.
Manish
Similar Messages
-
Convert the spool to xls format and email through attachment to the user
Hi all,
When I execute a report in background, I get spool. I need to convert the spool to xls format and email through attachment to the user.The xls file should not be saved on local system.
If I use the Spool Recepient tab in SM37 it mails the spool list as .txt file to the mail receipient. But I need to send it as an .xls file.
Can any one help me on thisDid you get the solution? i have the same problem.
-
Get Error while update the User defined row table through DSK Code
Hi experts,
I have got an error while updating the user row defined table.
Error is - "Invalid row"
I have created one master table "@CBF_FARM " and Child table "@CBF_FAR1"
First i inserted 5 record in the child table so in my my child table there are 5 Line id (1,2,3,4,5 one for each row).
after that i delete 2 rows (3rd & 4th row) from child table now in my child table there are 3 rows( Line id 1, 2, 5). Please See attachment.
Now i am updating the last record of child table through Code (Line id is 5) from other form, then i got error invalid row.
Following Code used for updating the user defined child table.
SAPbobsCOM.GeneralService oGeneralService1 = null;
SAPbobsCOM.GeneralData oGeneralData1 = null;
SAPbobsCOM.GeneralDataParams oGeneralParams1 = null;
SAPbobsCOM.CompanyService sCmp1 = null;
SAPbobsCOM.GeneralData oChild1 = null;
SAPbobsCOM.GeneralDataCollection oChildren1 = null;
sCmp1 = clsAddOn.LDNA_Company.GetCompanyService();
oGeneralService1 = sCmp1.GetGeneralService("CBF_FARM");
// Get UDO record
oGeneralParams1 = ((SAPbobsCOM.GeneralDataParams)(oGeneralService1.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)));
oGeneralParams1.SetProperty("Code", oForm.Items.Item("edtFarmCd").Specific.Value);
oGeneralData1 = oGeneralService1.GetByParams(oGeneralParams1);
// Add lines on UDO Child Table
oChildren1 = oGeneralData1.Child("CBF_FAR1");
// Create data for rows in the child table
SAPbouiCOM.Item oItem = oForm.Items.Item("cmbShed");
oCombo = oItem.Specific;
string ShedCode = oCombo.Selected.Value;
ldna_Rec = clsAddOn.LDNA_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
string strQuery1 = "select LineId from [@CBF_FAR1] where U_ShedCd = " + ShedCode;
ldna_Rec.DoQuery(strQuery1);
oChild1 = oChildren1.Item(ldna_Rec.Fields.Item("LineId").Value - 1);
oChild1.SetProperty("U_Status", "Ready For Schedule");
//Update the UDO Record
oGeneralService1.Update(oGeneralData1);
Please Help me it is an urgent requirement,
-Regards
Vikashi.
Error is - "Invalid row"
Now i am updating the last record of child table through Code (Line id is 5) from other form, then i got error invalid row.
As per my knowledge
What i understood is you have 5 lines and you are going to be update 5th line
am i correct..
while u are updating the line in child table
you have to consider like this..
line number u have to update like
1 0
2 1
3 2
4 3
5 4
which means in child table treat
line 1 as 0
line 2 as 1
line 5 as 4
If you want to update the line 5 u have to mention 4 th line -
Formatted search in the User defined table
Hi All..
I created two user defined table one is for document row and other is for document master.So in the master table created one column named as Sales order no and through formatted search call the sales order no in that column.Now i want that in my child table i want to show the those items which belongs to the selected sales order no in the master table.So how can i do that through Formatted search.Is there any query of it then please forward it..
ThanksYa Sure..
I need some quality check on the items after delivery so i am trying to manage it through the user defined tables.I created two tables first is document type ,Second is Document type rows.Now i created 5 user defined field in both the table.Now i want to call my sales order and its items in the UDT.so i created one fms and call the sales order in the Document table now when i double click on the first row after that i am able to see the new table which is the document row table .Now i need the item code and description of the selected sales order in the document rows table.So how the items and description can come in the row type table through FMS..
I hope now u r able to get my scenario.. -
How to let the user define the colors for each plots in the graph (I use LabVIEW 7)?
How to let the user define the colors for each plots in the graph (I
use LabVIEW 7)?Hi,
Take a look at this example, it uses property nodes to select tha
active plot and then changes the color of that plot.
If you want to make the number of plots dynamic you could use a for
loop and an array of color boxes.
I hope this helps.
Regards,
Juan Carlos
N.I.
Attachments:
Changing_plot_color.vi 38 KB -
Hi,
I create a user defined watch for BI4.1 ExplorerExplorationServer server in CMC -> Monitoring.
Caution:
node.ExplorerExplorationServer$'Server Running State'==1 ||
node.ExplorerExplorationServer$'Server Running State'==2 ||
node.ExplorerExplorationServer$'Server Running State'==4 ||
node.ExplorerExplorationServer$'Server Running State'==6 ||
node.ExplorerExplorationServer$'Server Running State'==7 ||
node.ExplorerExplorationServer$'Health State'==1
Danger:
node.ExplorerExplorationServer$'Server Running State'==0 ||
node.ExplorerExplorationServer$'Server Running State'==5 ||
node.ExplorerExplorationServer$'Health State'==0
However, in CMC -> Servers -> Explorer Services, the ExplorerExplorationServer shows "Information is not available" blue ball in Health.
How do I bind the user-defined watch to a specific server so that server's Health would show green ball and is linked to Monitoring watch?
Regards,
Jin-ChongHello JinChong,
We had created User-defined Explorer watches on our environments and have run into issues.
Have received many false alerts even though Explorer servers are running fine.
After creating an AGS case it was informed to us that Explorer does not have monitoring capabilities.
AGS is checking with solution architect of Explorer application about when the monitoring watches for explorer would be included.
Regards,
Rohit -
Accessing container element in the User Defined Function
Hi All,
I am accessing a container element in the user defined function.
But it is not working. Actually i want to split a message(1800 records) into a batch of 200.
But it goes in a infinite loop.
Please can you tell me where i am wrong.
Smita
The code is :
public void SplitMsg(String[] a,ResultList result,Container container){
Object container1;
String counter;
int i,j=0;
container1 = container.getParameter("value");
if( container1 == null){
counter = "0";
else {
counter = container.toString();
j = Integer.valueOf(counter).intValue();
for ( i = j ; i <= j + 199 ; i++){
if ( i >= a.length){
container.setParameter("value","9999999");
break;
result.addValue(a<i>);
j += 200;
counter = Integer.toString(j);
container.setParameter("value", counter);Here is another way to accomplish what you wanted.
For the target mapping, use this sequence for mapping
Source element -> removeContext -> Your User-defined Function -> Target Element
When defining User-Defined Function, select "Cache Queue" option.
Since you are using removeContext before calling the UserDefined function, your input to the user defined function will be a String array without ResultList.CC.
Now manipulate the array the way you want it, and build the ResultList result.
After every 200 records, use method
void addContextChange().
This will insert the ResultList.CC at the appropriate places.
Use Display Queue in the Mapping Editor to see the debug values. -
Reg: Configuring the User-Defined Message Search
Hi Experts !
I am getting an error while configuring the user defined message search.
Followed all the step mentioned in the sap help documentation.
http://help.sap.com/saphelp_nwpi711/helpdata/en/48/c85598f63335bfe10000000a42189d/frameset.htm
The last step, where we need to enter URL for WSDL Access i am getting the following error:
Error in WSDL access: Exception occurred in communication framework:
Error in HTTP Framework:404Not Found
http://<Host>/<Port>/MessageSearch/MessageSearchImplBean
You should enter the host name and the HTTP port for the Advanced Adapter Engine
i didnt get the meaning of above sentence : Is it different from what we use in the URL to access ESR and ID.
Is there any other steps to make MessageSearch/MessageSearchImplBean available
Regards,
Srinivas
Edited by: Srinivas on Oct 1, 2010 7:48 PMHi José Omar,
thanks for the reply...
I tried manual configuration but with no luck..opened a similar forum thread
I have applied the sap note suggested ,thinking that the error is due
to any source code.
The data synchronization is happening properly , but when i use test extractor button it throws the above mentioned error.
In the system details in have given the port number as 50700(which is visible in the link when we open integration builder page) and ESR client as 001.
could you please let me know if the exact values to be filled in transport setting.i just entered the port and client , other things
as default.
Regards,
Srinivas -
When I forward or reply to the email from Mail, the receiver gets it as multiple attachments with no content in the mail., When I forward or reply to the email from Mail, the receiver gets it as multiple attachments with no content in the mail.
That's probably because the message is in HTML format. Send the reply as plain text.
-
Dose oracle.sql.ArrayDescriptor support the user defined type in package?
Hi folks:
I get a obstacle in calling stored procedure by using JDBC driver (ojdbc14.jar).
I have the following code:
create or replace package xxx AS
type var_table is table of varchar2(50);
procedure(parameter in var_table);
end xxx;
When I use the jdbc driver try to create a type for
oracle.sql.ArrayDescriptor arrayDes = oracle.sql.ArrayDescriptor.createDescriptor( "var_table ",connection);
The SQLException is thrown out like those:
Invalid name pattern:user_schema. var_table
So, my question is : Dose oracle.sql.ArrayDescriptor not support the user defined type in package? And I also tried to define such type by using sql "create xxxx" outside of package, then there is no SQLException.
Hopefully for your response and suggestion.Thanks...To my knowledge, the Oracle JDBC driver does not support using the ArrayDescriptor for array data types (varray or nested table) that are defined inside of a package. The same is true for StructDescriptor as well. If you want to use array and object data types, you must define them outside of a package. Then you'll be able to use the descriptors in your JDBC programs.
-
How to raise the user defined Exceptions in XI ?
Hi All
I am learning XI ...i want know how to set up the user defined Exceptions
in XI?
Where and What are the settings need to be done ?
Same time where can check the LOG file ? to see all the server information ?
Welcome to your answers
Regards
RakeshRakesh,
Check this weblogs which will guide you:
/people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function
/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
/people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio
Also check this thread:
Mapping test throughs exception for UDF that does'nt exist anymore
---Satish -
How to catch the user defined exception in application service
Hi All,
How to catch the user defined exception in application service when it is throwed by the external service..
Regards,
Thirumurugan.Hi,
Thanks for your reply,
Actually I am calling validate Login method of External service from the application service. When the login fails, my external service will throw user defined Exception.I want to catch the user defined Exception.
But in the application service , validate Login method can catch only Invocation Exception and Engine Exception.
These two exception are present in the Application service remote interface.
public com.sap.comptest.extsrv.accrjavawsvi__document.output.
Ns1_validateLoginResponse validateLogin(com.sap.comptest.extsrv.accrjavawsvi__document.input.Ns1_validateLogin input) throws com.sap.caf.mp.base.exception.InvocationException, com.sap.caf.mp.base.exception.EngineException;
User defined exception is not present there. When i include the webservice as external service in CAF, it suppossed to generate the java file for the custom exception of validate Login method and this generated file should be included in the application service remote interface..
public com.sap.comptest.extsrv.accrjavawsvi__document.output.
Ns1_validateLoginResponse validateLogin(com.sap.comptest.extsrv.accrjavawsvi__document.input.Ns1_validateLogin input) throws com.sap.caf.mp.base.exception.InvocationException, com.sap.caf.mp.base.exception.EngineException,
(generated file name of user defined Excpetion.
Then only validate login method of application service can catch the user defined Exception which is thrown by the external service.
regards,
Thirumurugan.p -
Where to maintain the user defined variables in Variant maintenace?
In the variant maintenace screen, ther is provision for
Type T - Table TVARVC entries
Type D - Dynamic for date and time fields
Type B - user defined
My question :
Where do you maintain the user defined variables?
Pl advise.
Thanks,
VenYou may need to look into this link ( Its sap doc link)
http://help.sap.com/saphelp_nw70/helpdata/en/c0/98039ee58611d194cc00a0c94260a5/content.htm
a® -
System ID in the user defined function
Folks,
I am trying to get the system id of the XI system with in the user defined function. How can I get it? I have looked into the technical context objects/contants and could not find any which gives you the XI system ID (3 character system ID).
Any input is greatly appreciated.
- ShanthHi,
Adding to the link whihc Michael has given...
There is another system property which gives sap system name...rather than taking 'user.name' and parsing....
Please the code below.....
System.getProperty("SAPSYSTEMNAME");
this returns the 3 letter system id.....i got XID !!!!
Thanks,
Renjith -
Use current user in the user Defined alerts
Hi
i created a UDQ with a filter on the Current user (where ???=$[USER]
and it's working fine.
but when i use it in the User Defined Alert, nothing happen. the UD Alert doesn't fire.
is there any solution?
10xH Gordan
for example:
select t0.docentry,t0.docnum,t0.cardcode,t0.cardname from ordr t0 where t0.docstatus='O' and t0.usersign=$[[USER]]
if you save it as UDQ and run it, it will return all open sales orders for current user.
try to link it to an alert, it won't show you any thing
regards;
Edited by: Dany Bittar on May 12, 2011 1:08 PM
Maybe you are looking for
-
Geotagging with Aperture and a 5D mark 2
Hey, So here's my question, currently aperture doesn't support real geotagging like iPhoto does, at least not with a mappable interface, however the metadata does support it currently. What would you guys say is the best way to record GPS points and
-
Safari 6 in Mountain Lion lost window drop shadow
After I upgraded to Mountain Lion, I have a weird problem with Safari 6: the window does not have the drop shadow, and when the window is activated only the title of the Web page gets darker color in the top bar of the frame. It's a very annoying pro
-
With 12.0.1.71 how do i play a cd i just burnt
In Itunes, since my latest upgrade I cannot find the icon to play a cd that I insert in my computer. Where the heck is it ? I feel stupid looking around and I cannot find it... please help !
-
How to get name of PL/SQL stored procedure being executed?
When executing a PL/SQL stored procedure, is there a way to extract the name of the procedure programatically? (Similar to the way an Oracle Form can retrieve it's own name via GET_APPLICATION_PROPERTY(CURRENT_FORM_NAME). ) Thanks
-
Tips / Lesson Learn: Upgrading from ECC 5.0 to ECC 6.0 w/ Unicode
Hi We are looking into moving from ECC 5.0 to ECC 6.0 w/ EP7 and doing the unicode path on as well. What are some lesson learn you guys could share in potential issue may occur in the HCM realm? We don't currently have inhouse payroll, using PU12 to