Académique Documents
Professionnel Documents
Culture Documents
TakingSAPGUIscreenshotautomaticallyandsen...|SCN
GettingStarted Newsletters
Hi,Guest
LogOn
JoinUs
Store
SearchtheCommunity
Products
Services&Support
AboutSCN
Downloads
Industries
Training&Education
Partnership
DeveloperCenter
Activity
LinesofBusiness
UniversityAlliances
Events&Webinars
Innovation
Browse
TakingSAPGUIscreenshotautomatically
andsendasattachmentthroughmail
programmatically
Communications
Actions
Version3
createdbyArunaKumaraKonMar4,201412:01PM,lastmodifiedbyArunaKumaraKonMay5,20147:20AM
Tweet
ThisdocumentexplainshowscreenshotofSAPGUIscreencanbetakenandsendsitas
mailattachmentbyABAPprogram.
Requirement:TakingscreenshotofGUIscreenlikeshownbelowandsenditasmail
attachmentsthroughABAP.(NoteIhaveenhancedstddemoprogram
GRAPHICS_GUI_CE_DEMOtodemonstratescreenshotfeature).
Approach
UsefrontendGUIserviceclasstotakescreenshotMethodGET_SCREENSHOT
ofCL_GUI_FRONTEND_SERVICES.
Whenyoucalledthismethod,systemwilltakescreenshotofactivescreenand
returnscreenshotdatainternof
hexadecimalvalues(xstring).
Asshowninabovecode,screenshotdataisimportedbyimageparameter.
ConvertxstringdataintobinarydatatosenditasattachmentUsemethod
http://scn.sap.com/docs/DOC52966
1/5
7/3/2015
TakingSAPGUIscreenshotautomaticallyandsen...|SCN
XSTRING_TO_SOLIXofclassCL_BCS_CONVERT
LT_DOC_CONTENTcontainsbinarydatawhichwillbeusedlatertosendas
attachmentinmail.
SendscreenshotasmailattachmentUseclassCL_BCStosendmailwith
attachment.
a)CreatepersistentobjectoftypeCL_BCSforamailsendrequest
b)CreateMaildocumenttoincludebody,attachmentetc.Maildocumenttype
CL_DOCUMENT_BCS
AbovecodeMailsubjectasProjectStatusInfo.MailbodycanbeinI_TEXT
parameter.ForthisexampleInotused
anymailcontent.
c)Addscreenshotasanattachmenttomaildocument.screenshotcanbePNG,
BMP,GIF,JPGetc.Notewhateverthe
screenshotdatatakeninpreviousstep1and2attachedasdocumenthere
BinarycontentofscreenshotdataLT_DOC_CONTENTwhichpreparedinstep1
andstep2
passedtoI_ATT_CONTENT_HEX.
d)Attachmaildocumentobjecttosendrequest.
http://scn.sap.com/docs/DOC52966
2/5
7/3/2015
TakingSAPGUIscreenshotautomaticallyandsen...|SCN
e)Attachsenderandrecipientaddress.Addsender,TO,CC,BCaddresstosend
request.
f)SendMailCallsendmethodtosendmailwithattachment
Result:
Whenuserclickonscreenshotbuttonthensystemtakesscreenshotandsenditasemail
attachment.
http://scn.sap.com/docs/DOC52966
3/5