Send a mail to manager in execute method of my eventhandler class.
Hi everyone,
I want send an email in execute method of my eventhandler class.
How can I do this?
Thanks
Regards.
You can use JavaMail, or tcEmailOperations and the NotificationResolver to send email notification. Not sure what help you are looking on this.
-Bikash
Similar Messages
-
How to send a Mail from a Query executed in a BatchJob ?
Hi All,
at Valorec we use SAP ECC 6.0 (EHP 4) and have created some Query's. When executing a Query via the GUI you have the possibility to send the result to a Mail account. (List -> Send to -> E-Mail).
I would like to start a query in a Batch-Job but sending the generated list to one or more Mail accounts. I hope (and believe) this function is possible but I do not know how.
Thank you for your support.
JohnYou need to write some ABAP in your Infoset.
Check the SCN/SDN for "spool email" and you find a lot of thread about this. -
How to send E-Mail Notification executing through workflow?
hi All
I want to send E-Mail Notification executing through workflow in MDM Data Manager?
I have tried it, But still i am unable to send E-Mail Notification?
i will explain, how i have tried?
1) I have created the simple workflow with the following components
they are in sequence
start--> process-> notify--->stop
2) owner of the workflow is Admin and launcher of the workflow is Admin and i have given email id to the Default Admin user in the console.
3) i have created another user (i.e. User2) with default roles as like as Admin and i have assigned User2 to the process component in workflow and I have created e-mail address for the User2 in the console.
4) i have created another user(i.e.User1) with default roles as like as Admin. and give e-mail address,under the notify component User1 is selected in To Field.
5) stop component as usual
coming to configuration part about the SMPT server in MDS.ini file
1) in mds.ini file for the MailServer=, I have given SMTP Server name once and restarted the server and executed the workflow, but not worked
2)in mds.ini file for the MailServer=, i have given SMTP Server IP Address and checked the port,and we have configured the host file also and restarted the server and executed the worflow , but not worked
In all the ways i have executed and tried to send E-Mail Notifications through workflow, But I didn't
can any one help where i have went wrong, so i can rectify it
what actually we have to give in mds.ini file? is any other cofiguration required for it?
if any one have any solution for it , can you please explain me in step by step
Thanks in Advance
bharat.chinthapatlaHi Bharat,
your steps seems to be correct. Just try to ping your mail server, to verify if your mail server is running up, besides note that mdm go throw port 25 for sending emails, so please check if you are able to send emails using port 25 in your network.
Regards,
Vito -
Is there anyway to send a mail from Microsoft Outlook to solution manager?
Is there anyway to send a mail from Microsoft Outlook to solution manager.
If anybody having notes or documents that will be very much helpful for me.
Awaiting for your reply,
With best Regards,
AlexeyHi,
It is just the inbound mail configuration as like the out bound config.
Below are the required demo, blogs,helps
[Demo on Mail from outlook|https://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/5087262b-59ef-2910-abb1-957000b7c3d4&overridelayout=true]
[blog 1 for mail to SAP|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417800)ID1382272150DB00641126052855673650End?blog=/pub/wlg/795 ]
[Artical inbound mail config|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10dfad5a-5398-2b10-568b-d3d999d49b5c]
Hope this helps
Jansi -
Exchange 2010 - Method to send e-mail when the WAN IP is dynamic
Hello,
I am writing due to the fact that I cannot send e-mail from my Exchange 2010 Server to my Yahoo! address for testing. When trying to do so, I get the following error message:
mta1106.mail.gq1.yahoo.com gave this error:
Mail from xxx.xxx.xxx.xxx not allowed - 5.7.1 [BL21] Connections not accepted from IP addresses on Spamhaus PBL; see
http://postmaster.yahoo.com/errors/550-bl21.html [550]
As one can see, because my IP address is residential, I cannot send e-mail to all addresses on the web. I really would like to use this as my primary contact, and thought of using a proxy. Can someone recommend a good proxy, or workaround for this? I am
sorry for posting in Exchange 2013, but I couldn't find the 2010 forum. Thank you to all who reply.
MikeThank you for your reply,
I have set up DynDNS, and I am currently using my own domain name. The problem was I needed to configure a smart SMTP host, or relay server on my send connector. I decided to go with SMTP2GO, as they are cheap, and allow you to send 20 e-mails a day for
free. When the money is right, I plan to upgrade.
Thank you for your help.
Mike -
Hi,
please bear with me, and any mistakes i make, as i'm not that much of an expert in the whole area of mail sending and servers. At the minute our software is using javamail to send mails through a SMTP host. fairly simple, nothing too complicated about it.
the problem is that the company that uses out software is changing all their mail servers to Microsoft Exchange servers. At the minute it seems like they will not be opening the ports for SMTP (or IMAP, LDAP, POP3 etc.), so that we can continue to use the mail function in our software.
So is there any other way that we can send e-mails using our software. We were told we could use an interface called MAPI, but having done a little search i haven't been able to find too much info (apart from what it means ;-) about how i can use it with java. Can anyone possibly point me in the right direction.
Thanks for your time
SokHey,
With MIDP it's little bit hard to make application which connects to POP3 or IMAP server because there is no support for socket connections. But if your phone support sockets, it's not hard to
make a simple e-mail client for j2me.
But i've heard that it's possible to make somekind hacked socket connection for MIDP but i'm not sure will that work on actually phones.
- fuse -
Sending remote mail in solution manager 3.2
Hi all,
I have a problem with sending remote mails with the client 002 (copy from 001 for support desk). If I want send a remote mail in the work place to another satellite system i get the error message "Address does not exist". I think SCOT is correctly configured, because the remote mail in Client 000 works. But the Message does not appear in the Queue from SCOT...
I hope you understand my english :).
Can please someone help me?
Lionel
Message was edited by: Lionel MischlerI found it...
SAP NOTE 327202
run report RSSODIAD -
ChaRM sending e-mail at user status confirmed
Desired task:
Sending e-mails in change management process with condition configuration using user status
Partially solution:
Define actions and conditions in ppf with "processing time" = "processing using selection report" and execute these action by report rsppfprocess, BUT
Problem:
If you would like to send an e-mail after action "confirm change", the described solution doesn't work, because in Solution Manager status will be change within method call HF_SET_STATUS and not directly like in Service Desk or other CRM Transactions.
Question:
Is there any other solution to send emails in Change Szenario? Probably in Alert Management or 'Actions in Change Request Management / BAdI-Extension Implementation?
Thanks for any hints.
Best regards,
StephanHi,
I am glad to hear it is possible.
Yes I created the action under SDCR
The Partner-Dependent is checked and Partner Function is given as SDCR0002(Change Manager) under Partner Determination for this action.
What action merging did you use? I have tried u201CSet Highest Number of Processed Actionsu201D and u201CMax. 1 Unprocessed Action for Each Action Definitionu201D
But it is still not working.
In the message I select the Transaction Data tab, then the Actions tab, and check if the action is triggered. I do not see my action appearing here. -
How to send a mail as .txt attachment ,As data is seperated by pipeline
Hi ,
I got a requirement to send a mail in .txt format (Using OOPS) and the data inside the mail is seperated by '|' Pls help me in this regard.
i have written a mail to send the mail in .xls it is working fine for me in .xls but i dont know how to write the same for txt where data should be seperated by '|'.
Regards
sas
Ps: i am attaching my code. and please specify where i need to modify to achieve the same. and any perfromance enhacements are also welcome.
*& Report ZGBTEST02
REPORT YSAS_MAIL2.
*Changes done by sas
*PARAMETERS: P_MAIL TYPE AD_SMTPADR OBLIGATORY, " G C by sas
*P_MAIL1 TYPE AD_SMTPADR OBLIGATORY." G by sas
tables: adr6.
SELECT-OPTIONS:p_eaddr FOR adr6-SMTP_ADDR NO INTERVALS .
*end of changes by sas
DATA: I_GLT0 TYPE STANDARD TABLE OF GLT0.
DATA: I_MARA TYPE STANDARD TABLE OF MARA. " MARA Entries
* I_MARC TYPE STANDARD TABLE OF MARC. " MARC Entries
DATA: L_TEXT TYPE CHAR255. " Text
DATA: L_LINES TYPE I,
L_SIZE TYPE SOOD-OBJLEN.
" Size of Attachment
* Mail related
DATA: I_CONTENT TYPE SOLI_TAB, " Mail content
I_ATTACH TYPE SOLI_TAB, " Attachment
I_ATTACH1 TYPE SOLIX_TAB. " Attachment
DATA: L_SEND_REQUEST TYPE REF TO CL_BCS,
" E-Mail Send Request
L_DOCUMENT TYPE REF TO CL_DOCUMENT_BCS,
" E-Mail Attachment
L_RECIPIENT TYPE REF TO IF_RECIPIENT_BCS,
" Distribution List
L_SENDER TYPE REF TO IF_SENDER_BCS,
" Address of Sender
L_UNAME TYPE SALRTDRCPT,
" Sender Name(SY-UNAME)
L_BCS_EXCEPTION TYPE REF TO CX_DOCUMENT_BCS,
" BCS Exception
L_ADDR_EXCEPTION TYPE REF TO CX_ADDRESS_BCS,
" Address Exception
L_SEND_EXCEPTION TYPE REF TO CX_SEND_REQ_BCS.
" E-Mail sending Exception
*Constants------------------------------------------------------------*
CONSTANTS: C_TAB(1) TYPE C VALUE
CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
" Tab Character
C_CR(1) TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF,
" Line Feed for End-Of_line
C_EXT TYPE SOODK-OBJTP VALUE 'XLS'. " XLS Extension
START-OF-SELECTION.
SELECT * FROM MARA INTO TABLE I_MARA UP TO 20 ROWS.
IF SYST-SUBRC EQ 0.
* SELECT * FROM MARC INTO TABLE I_MARC FOR ALL ENTRIES IN I_MARA WHERE MATNR = I_MARA-MATNR.
ENDIF.
*select * from glt0 into table i_glt0.
* Preparing body of the Mail
MOVE 'SAP Material Master Records' TO L_TEXT.
APPEND L_TEXT TO I_CONTENT.
CLEAR L_TEXT.
APPEND L_TEXT TO I_CONTENT.
MOVE 'Thanks,' TO L_TEXT.
APPEND L_TEXT TO I_CONTENT.
MOVE 'SAP MM' TO L_TEXT.
APPEND L_TEXT TO I_CONTENT.
* Creates persistent send request
TRY.
L_SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
* Creating Document
L_DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
I_TYPE = 'RAW'
I_TEXT = I_CONTENT[]
I_SUBJECT = 'SAS MASTER Records' ).
* Preparing contents of attachment with Change Log
PERFORM PREPARE_ATTACHMENT.
DESCRIBE TABLE I_MARA LINES L_LINES.
* Size to multiplied by 2 for UNICODE enabled systems
L_SIZE = L_LINES * 2 * 255.
* Adding Attachment
CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
EXPORTING
I_ATTACHMENT_TYPE = C_EXT
I_ATTACHMENT_SIZE = L_SIZE
I_ATTACHMENT_SUBJECT = 'MARA Details'
* i_att_content_hex = i_attach[].
I_ATT_CONTENT_TEXT = I_ATTACH[].
* DESCRIBE TABLE I_MARC LINES L_LINES.
* Size to multiplied by 2 for UNICODE enabled systems
* L_SIZE = L_LINES * 2 * 255.
** Adding Attachment
* CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
* EXPORTING
* I_ATTACHMENT_TYPE = C_EXT
* I_ATTACHMENT_SIZE = L_SIZE
* I_ATTACHMENT_SUBJECT = 'MARC Details'
* I_ATT_CONTENT_HEX = I_ATTACH1[].
** i_att_content_text = i_attach1[].
* Add document to send request
CALL METHOD L_SEND_REQUEST->SET_DOCUMENT( L_DOCUMENT ).
DATA:LR_SENDER TYPE REF TO IF_SENDER_BCS,
LR_SEND TYPE REF TO CL_BCS.
* Preparing the sender object
* LR_SENDER = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( sy-uname ).
DATA: L1_UNAME TYPE SY-UNAME.
L1_UNAME = SY-UNAME.
LR_SENDER = CL_SAPUSER_BCS=>CREATE( L1_UNAME ).
* Setting the sender
CALL METHOD L_SEND_REQUEST->SET_SENDER
EXPORTING
I_SENDER = LR_SENDER.
* E-Mail
LOOP AT P_EADDR.
TRANSLATE P_EADDR-LOW TO LOWER CASE.
L_RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( P_EADDR-LOW ).
CALL METHOD L_SEND_REQUEST->ADD_RECIPIENT
EXPORTING
I_RECIPIENT = L_RECIPIENT
I_EXPRESS = 'U'
I_COPY = ' '
I_BLIND_COPY = ' '
I_NO_FORWARD = ' '.
IF SY-subrc EQ 0.
WRITE:/'** SUCCESS: Email Sent to', p_eaddr-LOW COLOR COL_NORMAL.
ELSE.
WRITE:/'** ERROR: Failed to send Email to',p_eaddr-LOW COLOR COL_NEGATIVE .
ENDIF.
ENDLOOP.
*Trigger E-Mail immediately
L_SEND_REQUEST->SET_SEND_IMMEDIATELY( ' ' ).
CALL METHOD L_SEND_REQUEST->SEND( ).
COMMIT WORK.
CATCH CX_DOCUMENT_BCS INTO L_BCS_EXCEPTION.
CATCH CX_SEND_REQ_BCS INTO L_SEND_EXCEPTION.
CATCH CX_ADDRESS_BCS INTO L_ADDR_EXCEPTION.
ENDTRY.
*& Form PREPARE_ATTACHMENT
FORM PREPARE_ATTACHMENT .
FIELD-SYMBOLS: <LFS_TABLE>, " Internal table structure
<LFS_CON>. " Field Content
DATA: L_TEXT TYPE CHAR1024. " Text content for mail attachment
DATA: L_CON TYPE STRING. "(50) TYPE c. " Field Content in character format
DATA: L_STR TYPE STRING,
L_STR1 TYPE STRING.
DATA: LS_SOLIX TYPE SOLIX.
* Columns to be tab delimeted
LOOP AT I_MARA ASSIGNING <LFS_TABLE>.
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE <LFS_TABLE>
TO <LFS_CON>.
IF SY-SUBRC NE 0.
CONCATENATE C_CR L_TEXT INTO L_TEXT.
* CONCATENATE l_str c_cr l_text INTO l_str.
* ls_solix-line = l_text.
* APPEND ls_solix TO i_attach.
APPEND L_TEXT TO I_ATTACH.
EXIT.
ELSE.
CLEAR: L_CON.
MOVE <LFS_CON> TO L_CON.
CONDENSE L_CON.
IF SY-INDEX = 1.
CLEAR: L_TEXT.
MOVE L_CON TO L_TEXT.
ELSE.
CONCATENATE L_TEXT L_CON INTO L_TEXT
SEPARATED BY C_TAB.
ENDIF.
ENDIF.
ENDDO.
ENDLOOP.
** Columns to be tab delimeted
* LOOP AT I_MARC ASSIGNING <LFS_TABLE>.
* DO.
* ASSIGN COMPONENT SY-INDEX OF STRUCTURE <LFS_TABLE>
* TO <LFS_CON>.
* IF SY-SUBRC NE 0.
* CONCATENATE C_CR L_TEXT INTO L_TEXT.
** CONCATENATE l_str c_cr l_text INTO l_str1.
* LS_SOLIX-LINE = L_TEXT.
* APPEND LS_SOLIX TO I_ATTACH1.
* EXIT.
* ELSE.
* CLEAR: L_CON.
* MOVE <LFS_CON> TO L_CON.
* CONDENSE L_CON.
* IF SY-INDEX = 1.
* CLEAR: L_TEXT.
* MOVE L_CON TO L_TEXT.
* ELSE.
* CONCATENATE L_TEXT L_CON INTO L_TEXT
* SEPARATED BY C_TAB.
* ENDIF.
* ENDIF.
* ENDDO.
* ENDLOOP.
* i_attach1[] = i_attach[].
ENDFORM. " PREPARE_ATTACHMENTHi Sas,
I have copied the code and executed and it is working fine. I'm getting the text attachement in the email.
* Adding Attachment
CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
EXPORTING
I_ATTACHMENT_TYPE = 'TXT' " C_EXT My change
I_ATTACHMENT_SIZE = L_SIZE
I_ATTACHMENT_SUBJECT = 'MARA Details'
* i_att_content_hex = i_attach[].
I_ATT_CONTENT_TEXT = I_ATTACH[].
CONCATENATE i_mara-MATNR
i_mara-ERSDA
i_mara-ERNAM
i_mara-LAEDA
INTO L_TEXT
SEPARATED BY '|'. -
How to send a mail as .txt attachment ?
Hi all,
I got a requirement to write code for sending mail in oops.
i have written code for .xls which is working fine. But requirement is to send the mail in the format of txt.
i just only chnge the .xls to .txt where i can see the output properly in sap but problem is that i am unable to get the proper alignment. when i execute the report and see the output in sost i can see the attachment.i am downloading the attachment there only(Our server is not configured to get the mails directly) .So when i open the saved text file on my pc the output is appearing as follows...
pernr nachn vorna
0001 L0001 F0001
0002 L0002 F0002
0003 L0003 F0003
0004 L0004 F0004...
Where it should come in straight line as follows in my o/p code..
pernr nachn vorna
0001 L0001 F0001
0002 L0002 F0002
0003 L0003 F0003
0004 L0004 F0004...
i am puttin g my code ..please correct me where i am wrong .....waiting for your valuabel inputs..
*& Report ZGBTEST02
REPORT YSAS_MAIL2.
*Changes done by sas
*PARAMETERS: P_MAIL TYPE AD_SMTPADR OBLIGATORY, " G C by sas
*P_MAIL1 TYPE AD_SMTPADR OBLIGATORY." G by sas
TABLES: ADR6.
SELECT-OPTIONS:P_EADDR FOR ADR6-SMTP_ADDR NO INTERVALS .
*end of changes by sas
DATA: I_GLT0 TYPE STANDARD TABLE OF GLT0.
*DATA: I_pernr TYPE STANDARD TABLE OF pa0002. " MARA Entries
DATA: BEGIN OF I_PERNR OCCURS 1 ,
PERNR TYPE PA0002-PERNR,
NACHN TYPE PA0002-NACHN,
VORNA TYPE PA0002-VORNA,
END OF I_PERNR..
* I_MARC TYPE STANDARD TABLE OF MARC. " MARC Entries
DATA: L_TEXT TYPE CHAR255. " Text
DATA: L_LINES TYPE I,
L_SIZE TYPE SOOD-OBJLEN.
" Size of Attachment
* Mail related
DATA: I_CONTENT TYPE SOLI_TAB, " Mail content
I_ATTACH TYPE SOLI_TAB, " Attachment
I_ATTACH1 TYPE SOLIX_TAB. " Attachment
DATA: L_SEND_REQUEST TYPE REF TO CL_BCS,
" E-Mail Send Request
L_DOCUMENT TYPE REF TO CL_DOCUMENT_BCS,
" E-Mail Attachment
L_RECIPIENT TYPE REF TO IF_RECIPIENT_BCS,
" Distribution List
L_SENDER TYPE REF TO IF_SENDER_BCS,
" Address of Sender
L_UNAME TYPE SALRTDRCPT,
" Sender Name(SY-UNAME)
L_BCS_EXCEPTION TYPE REF TO CX_DOCUMENT_BCS,
" BCS Exception
L_ADDR_EXCEPTION TYPE REF TO CX_ADDRESS_BCS,
" Address Exception
L_SEND_EXCEPTION TYPE REF TO CX_SEND_REQ_BCS.
" E-Mail sending Exception
*Constants------------------------------------------------------------*
CONSTANTS: C_TAB(1) TYPE C VALUE
CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
" Tab Character
C_CR(1) TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF,
" Line Feed for End-Of_line
C_EXT TYPE SOODK-OBJTP VALUE 'TXT'. " XLS Extension
START-OF-SELECTION.
SELECT PERNR NACHN VORNA FROM PA0002 INTO CORRESPONDING FIELDS OF TABLE I_PERNR UP TO 20 ROWS.
*select * from glt0 into table i_glt0.
* Preparing body of the Mail
* MOVE 'SAP Material Master Records' TO L_TEXT.
* APPEND L_TEXT TO I_CONTENT.
* CLEAR L_TEXT.
* APPEND L_TEXT TO I_CONTENT.
* MOVE 'Thanks,' TO L_TEXT.
* APPEND L_TEXT TO I_CONTENT.
* MOVE 'SAP MM' TO L_TEXT.
* APPEND L_TEXT TO I_CONTENT.
MOVE '<BR>Attached is your HRIS report(s) generated from the Firm''s' TO L_TEXT.
APPEND L_TEXT TO I_CONTENT.
MOVE ' Human Resources Information System (SAP).' TO L_TEXT.
APPEND L_TEXT TO I_CONTENT.
MOVE '<BR> ' TO L_TEXT.
APPEND L_TEXT TO I_CONTENT.
MOVE '<BR>This is an automated report.' TO L_TEXT.
APPEND L_TEXT TO I_CONTENT.
* MOVE '<BR> ' TO l_text.
* APPEND l_text TO i_content.
MOVE '<BR> ' TO L_TEXT.
APPEND L_TEXT TO I_CONTENT.
* MOVE '<BR>Please do not reply to this email' TO l_text.
* APPEND l_text TO i_content.
* MOVE '<BR> ' TO l_text.
* APPEND l_text TO i_content.
MOVE '<BR>Thank you.' TO L_TEXT.
APPEND L_TEXT TO I_CONTENT.
* Creates persistent send request
TRY.
L_SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
* Creating Document
L_DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
I_TYPE = 'RAW'
I_TEXT = I_CONTENT[]
I_SUBJECT = 'Automated HRIS (SAP) Report' ).
DATA: W_PERNR LIKE I_PERNR.
* Preparing contents of attachment with Change Log
PERFORM PREPARE_ATTACHMENT.
DATA: compressed like solisti1 occurs 10 with header line.
DATA: decompressed like solisti1 occurs 10 with header line.
CALL FUNCTION 'TABLE_COMPRESS'
* IMPORTING
* COMPRESSED_SIZE =
TABLES
* in = eerec
in = i_attach
out = compressed.
CALL FUNCTION 'TABLE_DECOMPRESS'
TABLES
in = compressed
out = decompressed.
DESCRIBE TABLE decompressed LINES L_LINES.
* Size to multiplied by 2 for UNICODE enabled systems
L_SIZE = L_LINES * 2 * 255.
* Adding Attachment
CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
EXPORTING
I_ATTACHMENT_TYPE = C_EXT
I_ATTACHMENT_SIZE = L_SIZE
I_ATTACHMENT_SUBJECT = 'Hr Details'
* i_att_content_hex = i_attach[].
I_ATT_CONTENT_TEXT = decompressed[].
* DESCRIBE TABLE I_MARC LINES L_LINES.
* Size to multiplied by 2 for UNICODE enabled systems
* L_SIZE = L_LINES * 2 * 255.
** Adding Attachment
* CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
* EXPORTING
* I_ATTACHMENT_TYPE = C_EXT
* I_ATTACHMENT_SIZE = L_SIZE
* I_ATTACHMENT_SUBJECT = 'MARC Details'
* I_ATT_CONTENT_HEX = I_ATTACH1[].
** i_att_content_text = i_attach1[].
* Add document to send request
CALL METHOD L_SEND_REQUEST->SET_DOCUMENT( L_DOCUMENT ).
DATA:LR_SENDER TYPE REF TO IF_SENDER_BCS,
LR_SEND TYPE REF TO CL_BCS.
* Preparing the sender object
* LR_SENDER = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( sy-uname ).
DATA: L1_UNAME TYPE SY-UNAME.
L1_UNAME = SY-UNAME.
LR_SENDER = CL_SAPUSER_BCS=>CREATE( L1_UNAME ).
* Setting the sender
CALL METHOD L_SEND_REQUEST->SET_SENDER
EXPORTING
I_SENDER = LR_SENDER.
* E-Mail
LOOP AT P_EADDR.
TRANSLATE P_EADDR-LOW TO LOWER CASE.
L_RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( P_EADDR-LOW ).
CALL METHOD L_SEND_REQUEST->ADD_RECIPIENT
EXPORTING
I_RECIPIENT = L_RECIPIENT
I_EXPRESS = 'U'
I_COPY = ' '
I_BLIND_COPY = ' '
I_NO_FORWARD = ' '.
IF SY-SUBRC EQ 0.
WRITE:/'** SUCCESS: Email Sent to', P_EADDR-LOW COLOR COL_NORMAL.
ELSE.
WRITE:/'** ERROR: Failed to send Email to',P_EADDR-LOW COLOR COL_NEGATIVE .
ENDIF.
ENDLOOP.
*Trigger E-Mail immediately
L_SEND_REQUEST->SET_SEND_IMMEDIATELY( ' ' ).
CALL METHOD L_SEND_REQUEST->SEND( ).
COMMIT WORK.
CATCH CX_DOCUMENT_BCS INTO L_BCS_EXCEPTION.
CATCH CX_SEND_REQ_BCS INTO L_SEND_EXCEPTION.
CATCH CX_ADDRESS_BCS INTO L_ADDR_EXCEPTION.
ENDTRY.
*& Form PREPARE_ATTACHMENT
FORM PREPARE_ATTACHMENT .
FIELD-SYMBOLS: <LFS_TABLE>, " Internal table structure
<LFS_CON>. " Field Content
DATA: L_TEXT TYPE CHAR1024. " Text content for mail attachment
DATA: L_CON TYPE STRING. "(50) TYPE c. " Field Content in character format
DATA: L_STR TYPE STRING,
L_STR1 TYPE STRING.
*data: w_pernr type TABLE OF I_PERNR.
DATA: LS_SOLIX TYPE SOLIX.
* CONCATENATE 'PERNR' 'FIRST NAME' 'Last Name' C_CR INTO L_TEXT SEPARATED BY '|'.
* append l_text to i_attach.
* clear l_text.
* Columns to be tab delimeted
LOOP AT I_PERNR ASSIGNING <LFS_TABLE>.
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE <LFS_TABLE>
TO <LFS_CON>.
IF SY-SUBRC NE 0.
CONCATENATE C_CR L_TEXT INTO L_TEXT.
* CONCATENATE l_str c_cr l_text INTO l_str.
* ls_solix-line = l_text.
* APPEND ls_solix TO i_attach.
APPEND L_TEXT TO I_ATTACH.
EXIT.
ELSE.
CLEAR: L_CON.
MOVE <LFS_CON> TO L_CON.
CONDENSE L_CON.
IF SY-INDEX = 1.
CLEAR: L_TEXT.
MOVE L_CON TO L_TEXT.
ELSE.
CONCATENATE L_TEXT L_CON INTO L_TEXT
SEPARATED BY C_TAB.
ENDIF.
ENDIF.
ENDDO.
ENDLOOP.
* i_attach1[] = i_attach[].
ENDFORM. " PREPARE_ATTACHMENT
Please if any one having 6.0 version please upload it and see..
Regards
SasHi ,
Did you downloaded from SOST using the display icon and inside that 4th tab for attachment ....
and see?
Regards
sas
pS: THE FIRST page is not allowing the spaces in sdn...
i am getting o/p as
pernr vochn norna
.........0001 f0001 l0001
.................0002 F0002 L0002
.......................0003 F0003 L0003.....
Please remove dots and understand that is the o/p i am getting in my presenation file
i just expecting the o/p as told earlier..
Regards
sas -
How to send a mail in workflow keeping 1 receiver in CC and the other in TO
Hi,
Can anybody tell me how to send a mail in workflow keeping 1 receiver in CC and the other in TO.
I need to send a mail to an employee keeping his/her manager in CC through workflow.
Regards,
LavanyaHi Lavanya,
I dont think its possible using Send mail step type.
But it can be done by using the FM SO_NEW_DOCUMENT_SEND_API1. Just create a method and Call this FM accordingly.
Thanks,
Viji. -
How to send a Mail using JSP using browser.
Dear friends
I could write a code to send a mail and execute it from a command prompt using a class file, but the same code, I converted into a JSP tags to run from a browser. I am getting compilation error. Can you please help me in solving this problem.
I am using javamail API 1.3,JAF1.0.2
Win2000,Websphere 3.5,HostPublisher server 3.5,IE6.0
I shall be thankful if someone shows me the solution.Hello
I hope that this is useful
I'm using Tomacat 4.0.4 and J2SDK1.4.0_01
Setting on conf\Server.xml
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"/>
<ResourceParams name="mail/Session">
<parameter>
<name>mail.smtp.host</name>
<value>your hostmail server</value>
</parameter>
</ResourceParams>Setting on web.inf/web.xml
<servlet>
<servlet-name>SendMailServlet</servlet-name>
<servlet-class>SendMailServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SendMailServlet</servlet-name>
<url-pattern>/SendMailServlet</url-pattern>
</servlet-mapping>
<resource-ref>
<res-ref-name>mail/Session</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>jsp page example:
<html>
<head>
<title>Example Mail Sending Form</title>
</head>
<form method="POST" action="../../SendMailServlet">
<table>
<tr>
<th align="center" colspan="2">
Enter The Email Message To Be Sent
</th>
</tr>
<tr>
<th align="right">From:</th>
<td align="left">
<input type="text" name="mailfrom" size="60">
</td>
</tr>
<tr>
<th align="right">To:</th>
<td align="left">
<input type="text" name="mailto" size="60">
</td>
</tr>
<tr>
<th align="right">Subject:</th>
<td align="left">
<input type="text" name="mailsubject" size="60">
</td>
</tr>
<tr>
<td colspan="2">
<textarea name="mailcontent" rows="10" cols="80">
</textarea>
</td>
</tr>
<tr>
<td align="right">
<input type="submit" value="Send">
</td>
<td align="left">
<input type="reset" value="Reset">
</td>
</tr>
</table>
</form>
</body>
</html>SendMailServelet.java:
import java.io.IOException;
import java.io.PrintWriter;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class SendMailServlet extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
// Acquire request parameters we need
String from = request.getParameter("mailfrom");
String to = request.getParameter("mailto");
String subject = request.getParameter("mailsubject");
String content = request.getParameter("mailcontent");
if ((from == null) || (to == null) ||
(subject == null) || (content == null)) {
RequestDispatcher rd =
getServletContext().getRequestDispatcher("/jsp/mail/sendmail.jsp");
rd.forward(request, response);
return;
// Prepare the beginning of our response
PrintWriter writer = response.getWriter();
response.setContentType("text/html");
writer.println("<html>");
writer.println("<head>");
writer.println("<title>Example Mail Sending Results</title>");
writer.println("</head>");
writer.println("<body bgcolor=\"white\">");
try {
// Acquire our JavaMail session object
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Session session = (Session) envCtx.lookup("mail/Session");
// Prepare our mail message
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
InternetAddress dests[] = new InternetAddress[]
{ new InternetAddress(to) };
message.setRecipients(Message.RecipientType.TO, dests);
message.setSubject(subject);
message.setContent(content, "text/plain");
// Send our mail message
Transport.send(message);
// Report success
writer.println("<strong>Message successfully sent!</strong>");
} catch (Throwable t) {
writer.println("<font color=\"red\">");
writer.println("ENCOUNTERED EXCEPTION: " + t);
writer.println("<pre>");
t.printStackTrace(writer);
writer.println("</pre>");
writer.println("</font>");
// Prepare the ending of our response
writer.println("<br><br>");
writer.println("<a href=\"jsp/mail/sendmail.jsp\">Create a new message</a><br>");
writer.println("</body>");
writer.println("</html>");
}Ciao
Riccardo -
Sending E-mail Through Oracle Forms
Hi all
what i want is as the following:
1- i would like to convert the report to the PDF file internally using code.
2- open the outlook.
3- attcah the PDF automatically to the e-mail.
4- finally sending the e-mail though outlook
could i do that in Oracle forms 6i if i could do that can anyone instruct me to do it step by stepOh...it's now called ["My Oracle Support"|https://metalink.oracle.com/] .
There's a note on "My Oracle Support" on this item.
This is the note:
Subject: OLE AUTOMATION: Example Sending a Mail From Forms to Outlook
Doc ID: 119828.1 Type: BULLETIN
Modified Date : 02-SEP-2008 Status: PUBLISHED
PURPOSE
This document contains a sample code how to send an e-mail from Forms to Outlook
(97-2000).
SCOPE & APPLICATION
It can be used in addition of the whitepaper "Cracking Outlook!", which explains
the object model of Outlook in detail.
(Have a look in the Technical Libaries Folder Forms Whitepaper, their you can
find it)
OLE: Forms to Outlook
Object Model
"Cracking outlook!" explains the Object Model, you can find additional
information in the Visual Basic Help of Outlook, which must be installed from
your Office CD-Rom. Once installed, you can access the help
by choosing Tools->Macro->Visual Basic Editor and then go to the Help or
Object Browser (view -> Object Browser)
Now you can retrieve the Objects, their Methods and Properties.
Eg: the 'Application' Object has the Method 'CreateItem'.
Note this information is also available in MSDN library or if you require more
information on this Microsoft has to be contacted.
OLE2, CLIENT_OLE2 Package
Once you know the Objects, Methods and Properties you can access them with the
OLE2 package. This package provides a PL/SQL API for creating, manipulating,
and accessing attributes of OLE2 automation objects. When using OLE2 with
WebForms every call will be executed on the midtier and not on the client.
So alternatively, the CLIENT_OLE2 package can be used, that is delivered by
Webutil, to execute the OLE code on the client.
Examples
Once you know the Outlook Object model and you know the functions of the OLE2
or CLIENT_OLE2 package you can write your own OLE2/CLIENT_OLE2 code to send a
mail via Outlook.
Here below are 2 different ways of sending an email using Outlook.
Sample 1:
OLE2 sample: Here a MailItem is created, then the Recepient is explicitely
added and resolved. The mailItem is saved before being sent.
Declare
/*declaration of the Outlook Object Variables*/
application ole2.OBJ_TYPE;
hMailItem ole2.OBJ_TYPE;
hRecipients ole2.OBJ_TYPE;
recipient ole2.OBJ_TYPE;
nameSpace OLE2.OBJ_TYPE;
/*declaration of the argument list*/
args OLE2.LIST_TYPE;
begin
/*create the Application Instance*/
application:=ole2.create_obj('Outlook.Application');
/* create namespace and login */
args:=ole2.create_arglist;
ole2.add_arg(args,'MAPI');
nameSpace:=ole2.invoke_obj(application,'getNameSpace',args);
ole2.destroy_arglist(args);
ole2.invoke(nameSpace,'Logon');
/*create a Mail Instance by calling CreateItem Method and giving argument 0 with
it,
you can find the item types in the explanation of the CreateItem Method
(0=olMailItem,1=olAppointmentItem, ?)*/
args:=ole2.create_arglist;
ole2.add_arg(args,0);
hMailItem:=ole2.invoke_obj(application,'CreateItem',args);
ole2.destroy_arglist(args);
/*Get the Recipients property of the MailItem object:
Returns a Recipients collection that represents all the Recipients for the
Outlook item*/
args:=ole2.create_arglist;
hRecipients:=ole2.get_obj_property(hMailItem,'Recipients',args);
ole2.destroy_arglist(args);
/*Use the Add method to create a recipients Instance and add it to the
Recipients collection*/
args:=ole2.create_arglist;
ole2.add_arg(args,'[email protected]');
recipient:=ole2.invoke_obj(hRecipients,'Add',args);
/* put the property Type of the recipient Instance to value needed
(0=Originator,1=To,2=CC,3=BCC)*/
ole2.set_property(recipient,'Type',1);
ole2.destroy_arglist(args);
/*Resolve the Recipients collection*/
args:=ole2.create_arglist;
ole2.invoke(hRecipients,'ResolveAll',args);
/*set the Subject and Body properties*/
ole2.set_property(hMailItem,'Subject','Test OLE2 to Outlook');
ole2.set_property(hMailItem,'Body','this is body text');
/*Save the mail*/
ole2.invoke(hMailItem,'Save',args);
ole2.destroy_arglist(args);
/*Send the mail*/
args:=ole2.create_arglist;
ole2.invoke(hMailItem,'Send',args);
ole2.destroy_arglist(args);
/*Release all your Instances*/
release_obj(hMailItem);
release_obj(recipient);
release_obj(hRecipients);
release_obj(nameSpace);
release_obj(application);
end;
Sample 2
CLIENT_OLE2 sample. Here a MailItem is created with an attachment and directly
sent.
Declare
objOutlook CLIENT_OLE2.OBJ_TYPE;
objMail CLIENT_OLE2.OBJ_TYPE;
objArg CLIENT_OLE2.LIST_TYPE;
objAttach CLIENT_OLE2.OBJ_TYPE;
nameSpace CLIENT_OLE2.OBJ_TYPE;
BEGIN
objOutlook := CLIENT_OLE2.CREATE_OBJ('Outlook.Application');
/* create namespace and login */
args:=client_ole2.create_arglist;
client_ole2.add_arg(args,'MAPI');
nameSpace:=ole2.invoke_obj(objOutlook,'getNameSpace',args);
client_ole2.destroy_arglist(args);
client_ole2.invoke(nameSpace,'Logon');
-- Previous example usually used 'mapi.session' but this doesn't work correctly
--anymore.
objarg := CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_OLE2.ADD_ARG(objarg,0);
objMail := CLIENT_OLE2.INVOKE_OBJ(objOutlook,'CreateItem', objarg);
CLIENT_OLE2.DESTROY_ARGLIST(objarg);
objAttach := CLIENT_OLE2.GET_OBJ_PROPERTY(objmail, 'Attachments');
objarg := CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_OLE2.ADD_ARG(objarg,'c:\temp\test.txt'); -- filename
CLIENT_OLE2.SET_PROPERTY(objmail,'To','[email protected]');
CLIENT_OLE2.SET_PROPERTY(objmail,'Subject','Email sent from Oracle Forms 9i');
CLIENT_OLE2.SET_PROPERTY(objmail,'Body','This is an email that was sent using
CLIENT_OLE2 from Oracle forms 9i');
CLIENT_OLE2.INVOKE(objattach, 'Add', objarg);
CLIENT_OLE2.INVOKE(objmail,'Send');
CLIENT_OLE2.RELEASE_OBJ(objmail);
CLIENT_OLE2.RELEASE_OBJ(nameSpace);
CLIENT_OLE2.RELEASE_OBJ(objOutlook);
CLIENT_OLE2.DESTROY_ARGLIST(objarg);
END;
Notes:
These are just 2 different ways of sending a mail by Outlook and using the
Outlook Object Model.
The first example can also be used with CLIENT_OLE2, and the second example can
also be used with OLE2.
(just replace every OLE2 to CLIENT_OLE2 or every CLIENT_OLE2 call to OLE2). -
I'm trying to query a document folder for all of its containing documents. Its a basic query like this:
IPortletContext PortletContext = PortletContextFactory.CreatePortletContext(Request,Response);IRemoteSession PTSession;PTSession = PortletContext.GetRemotePortalSession();IDocumentManager documentManager = PTSession.GetDocumentManager();
IDocumentQuery documentQuery = documentManager.CreateQuery(FolderID); documentQuery.SetSortProperty(ObjectProperty.Name);IObjectQuery queryResults = documentQuery.Execute();
When I'm logged into the portal as an administrator, everything works fine. However if I'm logged in as a "regular" user, I get this exception when calling the Execute() method:
Plumtree.Remote.PRC.PortalException: Exception of type Plumtree.Remote.PRC.PortalException was thrown. ---> System.Web.Services.Protocols.SoapException: Server was unable to process request. --> Access denied: Current user does not have edit permission
I'm sending the Login Token to the portlet. Now I've tried giving the user Edit rights on the document folder as well as Edit the Knowledge Directory rights in the Activity Manager, but neither gets rid of the exception. I'm not sure what other "Edit" permissions to check. I don't even see why the user would need "Edit" permission to anything in the first place since the Execute() method simply returns an IObjectQuery that doesn't have any ability to make changes to any objects. I know that I could use the SearchFactory interface, but I wanted the results to be real time. Any help would be much appreciated. Thanks!
JimmyThe problem here is that the query is created with default settings to show unapproved documents -- only users with edit access can see unapproved documents. Add the bold line to your code and it will work.
IDocumentManager docManager = prcSession.GetDocumentManager();IDocumentQuery docQuery = docManager.CreateQuery(iFolderID);docQuery.SetShowUnapproved(false);IObjectQuery queryResults = docQuery.Execute() -
Problem with the ALV after sending the mail
Good Morning Experts
I have a small issue with the ALV. I have a program, which has to sent email. In My program initially I am displaying basic list in the alv and user can navigate to secondary list also, by clicking on a contract number in the basic list.
I gave a tool button in the tool bar to the user in the basic list, to send the mail. When the user clicks on the I have to send the mail both the lists, basic list and seconday list in the mail as separate attachments.
Mail is going fine and later if the user chooses to see any contract in detail(Secondary List), that time ALV giving dump with message type X. And it is stopping some where in the ALV code
call method cl_gui_cfw=>get_subscriber_by_id
exporting shellid = p_handle-shellid
exceptions others = 1.
if sy-subrc = 0.
</B>message X007 with p_handle-clsid.<B>
endif.
If anybody having an Idea, how to resolve it, please tell me.
Thanks in Advance
PraveenPlease find the code for user_command form and sending the mail. Please look into this advice me if anything wrongly I coded.
*& Form user_command
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
IF r_ucomm EQ '&IC1' OR r_ucomm EQ 'SHOW'.
REFRESH: it_all[],
it_fcat1[],
it_sort[].
LOOP AT it_final INTO wa_final WHERE select EQ 'X' OR xblnr EQ rs_selfield-value.
LOOP AT it_bsid INTO wa_bsid WHERE xblnr EQ wa_final-xblnr AND zuonr IS INITIAL.
wa_all = wa_bsid.
wa_all = wa_bsid.
wa_all-booked = wa_bsid-dmbtr.
IF wa_bsid-augdt IS NOT INITIAL AND wa_bsid-augbl IS NOT INITIAL.
wa_all-paid = wa_bsid-dmbtr.
ENDIF.
wa_all-amtr = wa_all-booked - wa_all-paid.
APPEND wa_all TO it_all.
CLEAR: wa_all,
wa_bsid.
ENDLOOP.
LOOP AT it_bsad INTO wa_bsad WHERE xblnr EQ wa_final-xblnr AND zuonr IS INITIAL.
wa_all = wa_bsad.
wa_all-booked = wa_bsad-dmbtr.
IF wa_bsad-augdt IS NOT INITIAL AND wa_bsad-augbl IS NOT INITIAL.
wa_all-paid = wa_bsad-dmbtr.
ENDIF.
wa_all-amtr = wa_all-booked - wa_all-paid.
APPEND wa_all TO it_all.
CLEAR: wa_all,
wa_bsad.
ENDLOOP.
ENDLOOP.
SORT it_all BY xblnr.
PERFORM fill_fcat2.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = 'Report to display selected contracts'
is_layout = wa_layout1
it_fieldcat = it_fcat1[]
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_SORT = it_sort[]
i_default = 'X'
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_all[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CASE r_ucomm.
WHEN 'BACK1' OR 'EXT1'.
PERFORM exit IN PROGRAM saplslvc_fullscreen.
WHEN '&F12' or 'CANCEL'.
PERFORM exit IN PROGRAM saplslvc_fullscreen.
WHEN 'MAIL'.
PERFORM prepare_mail.
ENDCASE.
ENDFORM. "user_command
*& Form prepare_mail
text
--> p1 text
<-- p2 text
FORM prepare_mail .
DATA:
l_lay TYPE pri_params-paart,
l_line TYPE pri_params-linct,
l_cols TYPE pri_params-linsz,
l_val TYPE c,
i_spno TYPE tsp01-rqident,
i_lines TYPE i,
i_bin TYPE i,
i_pack_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_recivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
i_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_docdata LIKE sodocchgi1,
i_excel LIKE solisti1 OCCURS 0 WITH HEADER LINE.
i_pos type i.
TYPES:
t_pripar TYPE pri_params,
t_arcpar TYPE arc_params.
"Work areas
DATA:
lw_pripar TYPE t_pripar,
lw_arcpar TYPE t_arcpar,
w_no_of_bytes TYPE i.
l_lay = 'X_65_255'.
l_line = 65.
l_cols = 255.
"Read, determine, change spool print parameters and archive parameters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
in_archive_parameters = lw_arcpar
in_parameters = lw_pripar
layout = l_lay
line_count = l_line
line_size = l_cols
no_dialog = 'X'
IMPORTING
out_archive_parameters = lw_arcpar
out_parameters = lw_pripar
valid = l_val
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
*l_val eq space
IF sy-subrc = 0.
lw_pripar-prrel = space.
lw_pripar-primm = space.
NEW-PAGE PRINT ON
NEW-SECTION
PARAMETERS lw_pripar
ARCHIVE PARAMETERS lw_arcpar
NO DIALOG.
ENDIF.
DATA: ls_prnt TYPE slis_print_alv.
ls_prnt-print = ''.
ls_prnt-prnt_title = 'X'.
ls_prnt-no_coverpage = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = 'Report to display collection pattern on Clearing Date'
is_layout = wa_layout
it_fieldcat = it_fcat[]
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'PF_STATUS_SET'
IT_SORT = it_sort[]
i_default = 'X'
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_final[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE 'Test program to generate and download as PDF'.
NEW-PAGE PRINT OFF.
CALL FUNCTION 'ABAP4_COMMIT_WORK'.
i_spno = sy-spono.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = i_spno
no_dialog = 'X'
IMPORTING
pdf_bytecount = w_no_of_bytes
pdf_spoolid = w_pdf_spoolid
btc_jobname = w_jobname
btc_jobcount = w_jobcount
TABLES
pdf = it_pdf.
LOOP AT it_pdf INTO wa_pdf.
IF w_pos = 34170.
PERFORM attach.
ENDIF.
w_stuff+w_pos(134) = wa_pdf.
ADD 134 TO w_pos.
ENDLOOP.
IF NOT ( w_stuff IS INITIAL ).
PERFORM attach.
ENDIF.
CLEAR wa_pdf.
PERFORM fill_receivers TABLES i_recivers.
PERFORM fill_contents TABLES i_contents.
DESCRIBE TABLE i_contents LINES i_lines.
READ TABLE i_contents INDEX i_lines.
CLEAR i_pack_list-transf_bin.
i_pack_list-head_start = 1.
i_pack_list-head_num = 1.
i_pack_list-body_start = 2.
i_pack_list-body_num = i_lines.
i_pack_list-doc_type = 'RAW'.
APPEND i_pack_list.
CLEAR i_pack_list.
*u2022 Attachment (pdf-Attachment)
CONCATENATE p_date6(2) p_date4(2) p_date+0(4) INTO w_date1 SEPARATED BY '.'.
DESCRIBE TABLE it_att LINES i_lines.
READ TABLE it_att INTO wa_att INDEX i_lines.
i_pack_list-transf_bin = 'X'.
i_pack_list-head_start = '1'.
i_pack_list-head_num = '0'.
i_pack_list-body_start = '1'.
i_pack_list-body_num = i_lines.
i_pack_list-doc_type = 'PDF'.
i_pack_list-obj_name = 'Renewal List'.
CONCATENATE 'Report to display outstanding premium' 'Executed on' w_date1 INTO i_pack_list-obj_descr SEPARATED BY space.
i_pack_list-obj_descr = 'Exchange Rates uploaded to the database'.
i_pack_list-obj_langu = 'E'.
i_pack_list-doc_size = i_lines * 255.
APPEND i_pack_list.
CLEAR i_pack_list.
REFRESH: it_pdf[].
CLEAR wa_pdf.
REFRESH: it_all[],
it_fcat1[],
it_sort[].
LOOP AT it_final INTO wa_final.
LOOP AT it_bsid INTO wa_bsid WHERE xblnr EQ wa_final-xblnr AND zuonr IS INITIAL.
wa_all = wa_bsid.
wa_all-booked = wa_bsid-dmbtr.
IF wa_bsid-augdt IS NOT INITIAL AND wa_bsid-augbl IS NOT INITIAL.
wa_all-paid = wa_bsid-dmbtr.
ENDIF.
wa_all-amtr = wa_all-booked - wa_all-paid.
APPEND wa_all TO it_all.
CLEAR: wa_all,
wa_bsid.
ENDLOOP.
LOOP AT it_bsad INTO wa_bsad WHERE xblnr EQ wa_final-xblnr AND zuonr IS INITIAL.
wa_all = wa_bsad.
wa_all-booked = wa_bsad-dmbtr.
IF wa_bsad-augdt IS NOT INITIAL AND wa_bsad-augbl IS NOT INITIAL.
wa_all-paid = wa_bsad-dmbtr.
ENDIF.
wa_all-amtr = wa_all-booked - wa_all-paid.
APPEND wa_all TO it_all.
CLEAR: wa_all,
wa_bsad.
ENDLOOP.
ENDLOOP.
NEW-PAGE PRINT ON
NEW-SECTION
PARAMETERS lw_pripar
ARCHIVE PARAMETERS lw_arcpar
NO DIALOG.
ENDIF.
SORT it_all BY xblnr.
PERFORM fill_fcat2.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = 'Report to display selected contracts'
is_layout = wa_layout1
it_fieldcat = it_fcat1[]
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
it_sort = it_sort[]
i_default = 'X'
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_all[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
NEW-PAGE PRINT OFF.
CALL FUNCTION 'ABAP4_COMMIT_WORK'.
i_spno = sy-spono.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = i_spno
no_dialog = 'X'
IMPORTING
pdf_bytecount = w_no_of_bytes
pdf_spoolid = w_pdf_spoolid
btc_jobname = w_jobname
btc_jobcount = w_jobcount
TABLES
pdf = it_pdf.
LOOP AT it_pdf INTO wa_pdf.
IF w_pos = 34170.
PERFORM attach1.
ENDIF.
w_stuff+w_pos(134) = wa_pdf.
ADD 134 TO w_pos.
ENDLOOP.
IF NOT ( w_stuff IS INITIAL ).
PERFORM attach1.
ENDIF.
CLEAR wa_pdf.
DESCRIBE TABLE it_att LINES i_lines.
ADD 1 TO i_lines.
DESCRIBE TABLE it_att1 LINES i_bin.
READ TABLE it_att1 INTO wa_att INDEX i_bin.
DESCRIBE TABLE it_att LINES i_lines.
READ TABLE it_att INTO wa_att INDEX i_lines.
i_pack_list-transf_bin = 'X'.
i_pack_list-head_start = '1'.
i_pack_list-head_num = '0'.
i_pack_list-body_start = i_lines.
i_pack_list-body_num = i_bin.
i_pack_list-doc_type = 'PDF'.
i_pack_list-obj_name = 'Renewal List-Details'.
CONCATENATE 'Outstanding Premium-Details' w_date1 INTO i_pack_list-obj_descr SEPARATED BY space.
i_pack_list-obj_descr = 'Exchange Rates uploaded to the database'.
i_pack_list-obj_langu = 'E'.
i_pack_list-doc_size = i_bin * 255.
APPEND i_pack_list.
CLEAR i_pack_list.
APPEND LINES OF it_att1 to it_att.
i_docdata-obj_name = 'Renewal List'.
CONCATENATE 'Oustanding Premium' 'as on' w_date1 INTO i_docdata-obj_descr SEPARATED BY space.
CONDENSE i_docdata-obj_descr.
i_docdata-obj_langu = 'E'.
i_docdata-obj_prio = '1'.
i_docdata-no_change = 'X'.
i_docdata-sensitivty = 'F'.
i_docdata-doc_size = ( i_lines - 1 ) * 255 + STRLEN( wa_att ).
***Data for Header
i_header-line = 'Header'. APPEND i_header.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = i_docdata
commit_work = 'X'
TABLES
packing_list = i_pack_list[]
object_header = i_header
contents_bin = it_att[]
contents_txt = i_contents[]
receivers = i_recivers[]
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.
ELSE.
MESSAGE 'Document Sent' TYPE 'S'.
ENDIF.
ENDFORM. " prepare_mail
Thanks
Praveen
Maybe you are looking for
-
ICloud restore limit reached but I have never restored my device
My phone has been acting very strange the past week, so I did a complete wipe and refresh of the device. After restoring from iCloud, it started to download the apps and gave me this error: "this apple id has restored to too many devices in the last
-
How do I authorize music purchased on a different appleID account other than mine?
Long story. Here goes: I was married for several years and during that time my now ex-wife and I purchased music from iTunes. Being married and foolishly adhering to that old adage that once two people are married they become one, we set up OUR Apple
-
Problems with Windows Vista for BPC, from Windows XP
Hello, We have developed some templates in excel 2003 in SAP BPC for Windows XP and these work perfectly. But this templates in excel 2003 and with Windows VISTA makes a fault. The fault is: when the template is opened and you select a year (made wit
-
Solved! Go to Solution.
-
I have the original iPad, and when I open an email with an attachment it doesn't give me the option to open it myself, it just automatically downloads in the text of the email. I need it to show up as an attachment to use a business app. What setting