You are on page 1of 4

12/1/2014

SendingemailwithmultipletabsofexcelasasingleattachmentinABAP

Home Trai ni ngs Qui z Ti ps Tutori al s Functi onal Cert Q's I ntervi ew Q's Jobs Testi moni al s Adverti se Contact Us

SAP Virtual/Onsite
Trainings
Document Categories:

Sending email with multiple tabs of excel as a single attachment in


ABAP
ByKIRUTHIKAP,L&TInfotech

Introduction
ABAPTM
AdobeForms
ABAPHR
ALE&IDocs
ALV
BAPI
BASIS
BSP
BusinessObjects
BusinessWorkflow
CRMNEW
LSMW
SAPScript/SmartForms
BI/BW
eXchangeInfrastructure(XI)
EnterprisePortals(EP)
eCATT
ObjectOrientedProgramming
SAPQuery
Userexits/BADIs
WebDynproforJava/ABAPTM
Others

What's New?

Thisarticleistosendemailwithcellformatted
excel attachment having multiple worksheets.
ThisobjectivecanbeachievedbyOLElogic
with creation of multiple sheets. This cannot
be done by existing standard function
modules. This can be created as Function
module and we can use this function module
wherever this requirement is needed by
changingtheimportparameters.Inthisway,it
is possible to improve the performance of the
application by providing clarity of data in
multipletabsofexcelsheet.
Objective
Tosendmultipletabsofexcelsheetasasingle
attachmentbyemail.

Steps
Inthisapplication,FirstcreateaFunctionModulewithReceivermailidasImportparameter.
Part1

ABAPTestCockpitHOT
SAPABAPPragmas
UnderstandingSE32(ABAPText
ElementMaintenance)
CreatinganIDocFileonSAP
ApplicationServer
UnderstandingAdvancewith
dialogoptionofSAPWorkflow
SAPWorkflowScenario:
MaintenanceNotificationApproval
Enhancementstoastandardclass
WorkingwithFloatingFieldin
AdobeForms
InsertingdatafromInternalTable
intothestepSendMail
DisplayGLAccountlongtext
usingenhancementframework
Differencesbetween
polymorphisminJAVAandABAP
Passingmultilineparametersfrom
anABAPClasseventtoa
Workflowcontainer
ConceptofReevaluateagentsfor
activeworkitemsinSAPWorkflow
Dynamiccreationofcomponent
usageinABAPWebDynpro
AdobeForms:Displaysymbols
likecopyrightandothers
DeactivateHoldfunctionalityin
Purchaseorder(ME21N)
QuizonOOABAP
AddfieldsinFBL5NusingBADIs
TutorialonWidecasting
DefiningaRangeinModulePool
Program
Copyfieldsfromone
structure/tableintoanother
structure/table
SidePanelUsageinNWBC

1.CreateoneFunctionModule
GotoSE37>GivenameoftheFunctionModule>Create

GiveFunctiongroupname>Description>Save

2.ThencreateI_MAIL_IDoftypeADR6SMTP_ADDRasImportparameter,E_RETURNoftypeBAPIRET2
asExportparameterandT_TAB1andT_TAB2astablesparameter
3.SaveobjecteitherinPackageorinlocalobject
4.Writelogicinsourcecode,

Contribute?

a)UseXMLcodeandOLElogic

Sample Specs

b)CreateFirstWorkbook
c)ThenCreateStylesforheader,cell,Data

What's Hot?

d)ThenCreate1stworksheetandPassdatato1stworksheetwithstylesasperrequirements.

WebDynproforABAPTutorials

e)ThenCreate2ndworksheetandpassanothersetofdatato2dworksheetasperspecifications.

JointheMailingList
Enternameandemailaddressbelow:
Name:

f)AttachmentDatawillbeinI_XML_DATA,loopthisI_XML_DATAandappendthistoOBJBIN.
g) Then Call Mail sending Function Module 'SO_NEW_DOCUMENT_ATT_SEND_API1' and pass
thisattachmentdataOBJBINtoCONTENTS_HEX.
h)PassImportingParametertoReceiverMailidofFunctionModule

Email:

http://www.saptechnical.com/Tutorials/ABAP/OLE/MultipleTabs.htm

1/4

12/1/2014

SendingemailwithmultipletabsofexcelasasingleattachmentinABAP
i)ThusFMwillsendmailwithmultipletabsofexcelsheetasanattachmentthroughemail.
Subscribe

Unsubscribe

GO

SampleCode
Clickheretodownloadthecode

Output
ExecuteFMbyprovidingvaluesforsenderidandtablesandseetheattachmentwithmultipletabsofexcelsheet
as Output. Here we are creating two worksheets in OLE logic, thus two tabs will be in output attachment excel
sheetwithcellformatting(Color,font,borders,etc).

http://www.saptechnical.com/Tutorials/ABAP/OLE/MultipleTabs.htm

2/4

12/1/2014

SendingemailwithmultipletabsofexcelasasingleattachmentinABAP

Summary

Thisarticle is to send email with cell formatted excel attachment having multiple worksheets. This objective
can be achieved by OLE logic with creation of multiple sheets. This cannot be done by existing standard
functionmodules.ThiscanbecreatedasFunctionmoduleandwecanusethisfunctionmodulewhereverthis
requirement is needed by changing the import parameters. In this way, it is possible to improve the
performanceoftheapplicationbyprovidingclarityofdatainmultipletabsofexcelsheet.

Mobile Apps
Development
More Speed-More Devices-Less
Time. Sign Up for a Free Telerik
Webinar.

http://www.saptechnical.com/Tutorials/ABAP/OLE/MultipleTabs.htm

3/4

12/1/2014

SendingemailwithmultipletabsofexcelasasingleattachmentinABAP

Pleasesendusyourfeedback/suggestionsatwebmaster@SAPTechnical.COM
HomeContributeAboutUsPrivacyTermsOfUseDisclaimerSafeCompanies:AdvertiseonSAPTechnical.COM|PostJobContactUs
SAPTechnical.COM.Allrightsreserved.
Allproductnamesaretrademarksoftheirrespectivecompanies.SAPTechnical.COMisinnowayaffiliatedwithSAPAG.
SAP,SAPR/3,R/3software,mySAP,ABAP,BAPI,xApps,SAPNetWeaver,andandanyotherSAPtrademarksareregisteredtrademarksofSAPAGinGermanyandinseveralothercountries.
Everyeffortismadetoensurecontentintegrity.Useinformationonthissiteatyourownrisk.

GraphicDesignbyRoundtheBendWizards

http://www.saptechnical.com/Tutorials/ABAP/OLE/MultipleTabs.htm

4/4

You might also like