Send e-mails
Hi. I'm using the function SO_NEW_DOCUMENT_SEND_API1 for sending e-mails. In this function, the sender is the user who had been logged at the moment of send the e-mail.
I want to know if i could change this sender for another, to always send e-mails from the same sender, without care the logged user.
Thanks.
Hi,
the sender address can be changed via parameter SENDER_ADDRESS.
It is set to sy-uname (user who is running the program) by default, but I think you can change it to any user...
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = ls_document_data
* put_in_outbox = 'X'
* SENDER_ADDRESS = 'USER_XY'
* SENDER_ADDRESS_TYPE = 'B'
commit_work = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
* SENDER_ID =
TABLES
packing_list = lt_packing_list
* OBJECT_HEADER =
* CONTENTS_BIN =
contents_txt = lt_contents_txt
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = lt_receivers
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.
Similar Messages
-
Error while sending a mail using UTP_MAIL package in Oracle 10g
Hi,
We are using UTP_MAIL package to send a mail from Oracle 10g.We have follwed the following steps ...
SQL> connect sys/password as sysdba
Connected.
SQL> @$ORACLE_HOME/rdbms/admin/utlmail.sql
Package created.
Synonym created.
SQL> @$ORACLE_HOME /rdbms/admin/prvtmail.plb
Package body created.
SQL > alter system set smtp_out_server = '<mail_server_ip:25>' scope =spfile;
System altered..
Now we try the code
begin
utl_mail.send(
sender => 'sender's mail',
recipients => 'receiver mail',
CC => 'optional',
subject => 'Testing utl_mail',
message => 'Test Mail'
end;
But we get the following error...
ERROR at line 1:
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at "SYS.UTL_SMTP", line 21
ORA-06512: at "SYS.UTL_SMTP", line 97
ORA-06512: at "SYS.UTL_SMTP", line 139
ORA-06512: at "SYS.UTL_MAIL", line 405
ORA-06512: at "SYS.UTL_MAIL", line 594
ORA-06512: at line 2
We also tried connecting to the mail server through telnet .But it is not getting connected..
Please help us to solve the issue.From your own posting you may have the clue, if you try to access your mail server through telnet and it is not successful, it means the service is down or there are networking issues.
On pre 10gR2 versions there was a bug 4083461.8. It could affect you if you are on 10gR1
"Bug 4083461 - UTL_SMTP.OPEN_CONNECTION in shared server fails with ORA-29278 Doc ID: Note:4083461.8"
This was fixed on 10gR2 base and on 9.2.0.8.0
~ Madrid -
Need to send a mail back to the user in Sender Mail adapter Scenario
Hi all,
I have a scenario where the user fills the Price form or the Article form (which is a Adobe Form).When the user clicks on the "submit" button,the form is converted into xml , gets attached to the mail and sent to PI.
Now the user sometimes attaches the pdf directly instead of submitting the form. This results in the mail being sent
with pdf as attachment.
Now my requirement is to send a mail back to the user asking them to send an xml instead of a pdf.
How can this be done ?
Kindly let me know friends.
Quick Response is appreciated.hi Sanjay,
Have a look on Michal's blog, it's for JMS, but it works for others: [PI/XI: Quick tip: Preserving attributes of XI messages via MultipartHeaderBean|PI/XI: Quick tip: Preserving attributes of XI messages via MultipartHeaderBean]
Mickael -
"This message cannot be sent at this time." I have been getting this pop-up for 3 days when trying to send out mail. I don't know what to do! I cannot send mail from this account on any ISP. Please help!
lots of people seem to be havgin a problem sending email from iCloud webmail.
does your email address have uppercase characters in it?
if so, try creating an alias in lowercase (go to preferences in iCloud webmail and select 'accounts') and see if email sends okay from that -
If I click on an e-mail address link in a web page instead of a blank message opening I always get a pop up screen with a log-in for googlemail. I do not have and do not want a googlemail account. I just want to be able to send e-mails using Outlook.
OUtlook was already set as the mail client for FF, and is my operating system (XP)'s default mail programme. therefore problem not solved at all. what I get whenever I follow a link in a webpage to send an e-mail is a little pop up window asking me to sign in to gmail or open an account. any other suggestions?
-
E72- Unable to send e-mail from work mailbox
I am unable to send e-mails from my work e-mail through my E72 although it receives perfectly. I have been in contact with Nokia via e-mail for the last 2 weeks and they have sent several suggestions to solve the issue but nothing is working. I have set-up my work e-mail on my husbands Blackberry with the same settings and can receive and send perfectly. From that I conclude there is no issue with the settings I have or my work e-mail but with
Nokia!! The latest 'help' I have received was to download a patch but I have no idea how to do this and get it onto my phone. So far Nokia have not replied to me.
Any suggestions how to get this to work would be greatly appreciatedIf you're using a much older firmware, updating the phone would be a good idea. Find the Software Updates section of nokia.com and type your phone model. If you can't do an over-the-air update, download and install either the OVI Suite or the standalone Software Updater. This may hard reset the phone, so back up anything important with OVI Suite first.
Ignoring firmware for now, IMAP and URL's are like apples and oranges. If you work for a small company, the server may always be called " mail.mycompany.com", but IMAP will never use an HTTP or HTTPS prefix. URL's are typically associated with Microsoft Exchange servers. Within the email program, check Options -> Settings -> Mailbox settings -> Mailbox settings -> Advanced mailbox settings. Are "Outgoing email settings" set to something like
User authentication: Same as for incoming
Outgoing mail server: <compare to the setting for the Incoming server name; in a small company this will likely be the same>
Since you're getting far enough for the mail sever to reject your connection, the other settings should be fine as-is.
It does look like an authentication issue, so I'd say you're either hitting the wrong server or there's a bad username or password in there somewhere. If the Blackberry works with an IMAP connection, then you should be using the same server name(s), and user/password.
If all else fails, you can always try removing and readding the mailbox completely. Choose Menu -> Applications -> Email -> Settings -> <highlight your work account> -> Options -> Remove mailbox. And then set it up from scratch. I hope that helps a little! -
URL link in send e-mail pl/sql procedure
I have a send e-mail procedure. I am trying to enclose in the body of the message a URL link with parameters from a form, but it is only taking part of it.
for example http://my.link&pid='||pid||'&uid'||uid
it only takes http://my.link
What is the way to do it successfuly?
Thanks,Thanks for your replies. I still did not get it to work. For example if I stick to your solution with :
urlname := 'my.link?pid='||pid||'&uid='||uid;
where should I stick the try this?
I am using a variable called message.
'message: ' 'click on the following link' ||CRLF || urlname
This is is not working. Any clues? Thanks a lot. Jeanne -
When using Windows 8.1 context menu: Send to --> Mail recipient, message is sent OK, but not saved in Sent folder, with error massage: There was an error saving the message to Sent. Retry? (selecting Retry doesn't help).
Similar issue happens when I open a ".eml" file and Reply of Forward it.
When composing a new message from within Thunderbird, all is OK, including saving in the Sent folder.
Already tried:
Compacting the Sent folder.
Compacting all folders of the account.
Uninstall Thunderbird and install the latest version (31.6.0).When using Windows 8.1 context menu: Send to --> Mail recipient, message is sent OK, but not saved in Sent folder, with error massage: There was an error saving the message to Sent. Retry? (selecting Retry doesn't help).
Similar issue happens when I open a ".eml" file and Reply of Forward it.
When composing a new message from within Thunderbird, all is OK, including saving in the Sent folder.
Already tried:
Compacting the Sent folder.
Compacting all folders of the account.
Uninstall Thunderbird and install the latest version (31.6.0). -
Good Afternoon,
I'm using the following code to send e-Mails:
LOOP AT t_z3emailusr INTO w_z3emailusr.
t_receivers-receiver = w_z3emailusr-email.
t_receivers-rec_type = 'U'.
t_receivers-express = 'X'.
APPEND t_receivers.
ENDLOOP.
MOVE text-003 TO t_mailtxt-line.
APPEND t_mailtxt.
CLEAR t_mailtxt-line.
APPEND t_mailtxt.
MOVE text-001 TO t_mailtxt-line.
APPEND t_mailtxt.
CLEAR t_mailtxt-line.
APPEND t_mailtxt.
LOOP AT t_apqi INTO w_apqi.
MOVE w_apqi-groupid TO t_mailtxt-line.
APPEND t_mailtxt.
ENDLOOP.
MOVE text-002 TO t_mailtxt-line.
APPEND t_mailtxt.
CLEAR t_mailtxt-line.
APPEND t_mailtxt.
MOVE text-003 TO t_mailtxt-line.
APPEND t_mailtxt.
MOVE text-004 TO t_mailtxt-line.
APPEND t_mailtxt.
CLEAR t_mailtxt.
DESCRIBE TABLE t_mailtxt LINES mailtxt_size.
MOVE text-000 TO t_doc_att-obj_descr.
MOVE sy-langu TO t_doc_att-obj_langu.
MOVE 'O' TO t_doc_att-sensitivty.
t_doc_att-doc_size = mailtxt_size * 255.
CLEAR t_mailpack-transf_bin.
MOVE 1 TO t_mailpack-head_start.
CLEAR t_mailpack-head_num.
MOVE 1 TO t_mailpack-body_start.
MOVE mailtxt_size TO t_mailpack-body_num.
MOVE 'HTM' TO t_mailpack-doc_type.
MOVE sy-langu TO t_mailpack-obj_langu.
APPEND t_mailpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = t_doc_att
put_in_outbox = 'X'
TABLES
packing_list = t_mailpack
contents_txt = t_mailtxt
receivers = t_receivers
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.
Everything is ok except for the text...
Although i'm appending lines in t_mailtxt the text of the e-mail is continuous...
How to display text with "line breaks"? Do i need to change the doc_type of t_mailpack?
Regards,
Pedro GasparYes .. change the doc_type.
-
Sending external mail using SO_NEW_DOCUMENT_ATT_SEND_API1
When i use this RFC by appending the internal table receiver with receiver: sapuser name and rec_type B it triggers mail to the sap user login .But when i give external email address for receiver with rec_type 'U' it is not triggering any mail.Can anyone please tell me how to use this RFC in sending external mails??
I went back and you are right "INT" was not the REC_TYPE it was the COM_TYPE.
Sorry for any confusion caused.
However,
I suggest 2 more tests and then I give up and can not think about anything else.
Try:
#1
REC_TYPE = 'X'.
if it does not work.
#2
REC_TYPE = 'R'.
Hope that will do the trick. I was trying a lot when I had to get that working some time ago.
And surely the other colleagues point to something which must be setup as well. Transaction SCOT the SMTP settings.
Furthermore there could be another issue. I remember that I worked at a client who had turned off the send settings on their email server. So SAP finished everything and handed the emails on to a mail server. The mail server had a setting to block any emails from the development environment.
So that might be another cause of your issue. -
I want to email a Pages document as a Word doc. I used to be able to do this by clicking on 'share' then 'send via mail' then on 'Word' and an email would appear with my word doc attached. Now the email does not come up. Why?
It's difficult to do more than guess when you don't say what version of OS X or Pages you're running, but if you're on the latest, have you tried the Share menu -> Send via Mail command?
If that doesn't help, you may have better luck if you ask in the Pages forum:
Pages
When you repost, be sure to include full details about your versions so that people know what it is you're working with.
Regards. -
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 -
Error while sending E-Mail -- 501 Syntax error in parameters or arguments
Dear Friends,
I was trying to send E-Mail using the NTLM Authentication mechanism using the below program:
import java.util.Properties;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.mail.PasswordAuthentication;
import java.util.Date;
import com.sun.mail.smtp.*;
public class MailerWithAuthentication
private String smtpServer;
private String fromEmailId;
private String toEmailId;
private String ccEmailId;
private String bccEmailId;
private String subject;
private String message;
private String host;
public MailerWithAuthentication(String toemail, String msg,String sub,String fromId,String host)
this.toEmailId = toemail;;
this.subject = sub;
this.message = msg;
this.fromEmailId=fromId;
this.host=host;
public void sendMail()
String mailContent = "";
try
Authenticator authenticator = new Authenticator();
Properties props = new Properties();
props.put("mail.smtp.host",this.host );
props.put("mail.smtp.port", "25");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.auth.mechanisms", "NTLM");
props.put("mail.smtp.auth.ntlm.flags", "0x00000200");
props.put("mail.smtp.auth.ntlm.domain","sal.ad");
props.put("mail.debug", "true");
Session session = Session.getDefaultInstance(props,authenticator);
Message msg = new MimeMessage(session);
MimeMessage message = new MimeMessage(session);
message.setContent("This is a test", "text/plain");
message.setFrom(new InternetAddress(this.fromEmailId));
message.addRecipient(Message.RecipientType.TO,new InternetAddress(this.toEmailId));
Transport.send(message);
catch (Exception e)
e.printStackTrace();
System.out.println("Exception in MailerThread : run: " + e.getMessage());
private class Authenticator extends javax.mail.Authenticator {
private PasswordAuthentication authentication;
public Authenticator() {
String username= "sal.ad\mailuser";
String password = "mail@123";
authentication = new PasswordAuthentication(username, password);
protected PasswordAuthentication getPasswordAuthentication() {
return authentication;
public static void main(String args[])
try
System.out.println(" Usage : java MailerWithAuthentication <To-Email> <Message> <Subject> <From-Email> <Mail-Server-IP>");
MailerWithAuthentication mailer = new MailerWithAuthentication (args[0],args[1],args[2],args[3],args[4]);
mailer.sendMail();
catch(Exception e)
e.printStackTrace();
Following is the output while running the program:
DEBUG: JavaMail version 1.4ea
DEBUG: java.io.FileNotFoundException: /usr/java/jdk1.5.0_14/jre/lib/javamail.providers (No such file or directory)
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.providers
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.address.map
DEBUG: java.io.FileNotFoundException: /usr/java/jdk1.5.0_14/jre/lib/javamail.address.map (No such file or directory)
Mechanishm = NTLM
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "192.168.14.6", port 25, isSSL false
220 ****************************************************************************
DEBUG SMTP: connected to host "192.168.14.6", port: 25
EHLO
501 Syntax error in parameters or arguments -
HELO
501 Syntax error in parameters or arguments -
javax.mail.MessagingException: 501 Syntax error in parameters or arguments -
=================================
The error is :
EHLO
501 Syntax error in parameters or arguments -
HELO
501 Syntax error in parameters or arguments -
=================================
Please tell me what went wrong here. Is it due to any mistake in the program ?
Thanks in advance.hello Anirudh Pucha,
thanks for your message,
i'm downloading all the files you advised and one more doubt regarding SOA installation,
i'm using BPEL Process manager 10.1.3.1.0 installed on my machine and not installed SOA Suite (problem in installing AS Middle tier), i send voice,sms through BPEL PM which works fine, and faced problem in e-mail notification only, according to me with out installing SOA suite we can use BPEL PM or please let me know the procedure to install the downloading files.
if possible please send me a details in word documents to my mail "[email protected]".
Thanks again -
Send a mail with the class CL_HTTP_CLIENT
hi,
i use this program and i would send a mail with a attachment file PDF. I try to use the function module SO_NEW_DOCUMENT_ATT_SEND_API1 but i dont know to translate the data XSTRING to internal table.
Thank you.
*& Report ZYTEST_TRANSFER_URL2 *
REPORT zytest_transfer_url2 .
*- begin of internal data
TYPE-POOLS: swfxc, icon.
DATA: l_http_client TYPE REF TO if_http_client.
DATA: l_url TYPE string.
DATA: l_code TYPE sy-subrc.
DATA: l_code_string TYPE string.
DATA: l_message_string TYPE string.
DATA: lt_http_fields TYPE tihttpnvp.
DATA: l_http_field_wa TYPE ihttpnvp.
DATA: l_char_header(40) TYPE c.
DATA: l_body_string TYPE string.
DATA : line TYPE string.
DATA: result_tab TYPE TABLE OF string,
result_str TYPE string.
*- end of internal data
DATA: lv_contents TYPE string.
DATA: lv_location TYPE string.
*- begin of parameters
PARAMETERS: url TYPE swc_value.
PARAMETERS : receiver TYPE somlreci1-receiver LOWER CASE.
*- end of parameters
START-OF-SELECTION.
PERFORM main.
*& Form main
text
FORM main.
PERFORM get_contents USING lv_contents.
*- Create the HTTP-Client
l_url = url.
l_proxy_host =
l_proxy_service =
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = l_url
proxy_host = l_proxy_host
proxy_service = l_proxy_service
IMPORTING
client = l_http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*- send the http post
CALL METHOD l_http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
IF sy-subrc <> 0.
WRITE: / icon_red_light AS ICON.
CALL METHOD l_http_client->get_last_error
IMPORTING
code = l_code
MESSAGE = l_message_string.
CALL METHOD l_http_client->close.
l_code_string = l_code.
CONCATENATE 'HTTP-Send: RC=' l_code_string "#EC NOTEXT
INTO l_code_string .
CONCATENATE l_code_string l_message_string
INTO l_message_string SEPARATED BY space.
PERFORM print_string USING l_message_string.
EXIT.
ENDIF.
*- receive the result of http post
CALL METHOD l_http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
IF sy-subrc <> 0.
WRITE: / icon_red_light AS ICON.
CALL METHOD l_http_client->get_last_error
IMPORTING
code = l_code
MESSAGE = l_message_string.
CALL METHOD l_http_client->close.
l_code_string = l_code.
CONCATENATE 'HTTP-Receive: RC=' l_code_string "#EC NOTEXT
INTO l_code_string .
CONCATENATE l_code_string l_message_string
INTO l_message_string SEPARATED BY space.
PERFORM print_string USING l_message_string.
EXIT.
ENDIF.
*- print the results
CALL METHOD l_http_client->response->get_status
IMPORTING
code = l_code.
IF l_code < 300.
HTTP-codes: 100 - 199 = informations
HTTP-codes: 200 - 299 = client-request successful (200 = OK)
WRITE: / icon_green_light AS ICON.
ELSE.
HTTP-codes: 300 - 399 = redirected; further actions required
HTTP-codes: 400 - 499 = client-request incomplete
HTTP-codes: 500 - 599 = server errors
WRITE: / icon_red_light AS ICON.
ENDIF.
*-- get the http header fields
CALL METHOD l_http_client->response->get_header_fields
CHANGING
fields = lt_http_fields.
LOOP AT lt_http_fields INTO l_http_field_wa.
l_char_header = l_http_field_wa-name.
WRITE: / l_char_header.
l_char_header = l_http_field_wa-value.
WRITE: l_char_header.
ENDLOOP.
WRITE: / sy-uline.
*- get the body
DATA: lv_bin_contents TYPE xstring.
lv_bin_contents = l_http_client->response->get_data( ).
PERFORM save_file USING lv_bin_contents.
ENDFORM. "main
*& Form print_string
FORM print_string USING p_string TYPE string.
REFRESH result_tab.
SPLIT p_string AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab.
LOOP AT result_tab INTO result_str.
WRITE:/ result_str.
ENDLOOP.
ENDFORM. " print_string
*& Form save_file
text
FORM save_file USING lv_bin_contents.
DATA: save_file(1000) TYPE c VALUE '/tmp/test3.pdf'.
DATA: lv_file TYPE localfile.
DATA : g_file(80).
g_file = url.
DO.
SHIFT g_file LEFT UP TO '/'.
IF sy-subrc NE 0.
EXIT.
ENDIF.
SHIFT g_file LEFT.
ENDDO.
SHIFT g_file RIGHT UP TO '.'.
SHIFT g_file RIGHT.
lv_file = save_file.
OPEN DATASET lv_file FOR OUTPUT IN BINARY MODE.
IF sy-subrc NE 0.
WRITE:'SY-SUBRC :',sy-subrc.
MESSAGE i000 WITH text-014. "'File Directory not found'.
EXIT.
ENDIF.
TRANSFER lv_bin_contents TO lv_file.
CLOSE DATASET lv_file.
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF sy-subrc EQ 0.
MESSAGE i000 WITH text-012."'Successfully downloaded to Application
server'.
EXIT.
ENDIF.
ENDFORM. "save_filehi,
i use this program and i would send a mail with a attachment file PDF. I try to use the function module SO_NEW_DOCUMENT_ATT_SEND_API1 but i dont know to translate the data XSTRING to internal table.
Thank you.
*& Report ZYTEST_TRANSFER_URL2 *
REPORT zytest_transfer_url2 .
*- begin of internal data
TYPE-POOLS: swfxc, icon.
DATA: l_http_client TYPE REF TO if_http_client.
DATA: l_url TYPE string.
DATA: l_code TYPE sy-subrc.
DATA: l_code_string TYPE string.
DATA: l_message_string TYPE string.
DATA: lt_http_fields TYPE tihttpnvp.
DATA: l_http_field_wa TYPE ihttpnvp.
DATA: l_char_header(40) TYPE c.
DATA: l_body_string TYPE string.
DATA : line TYPE string.
DATA: result_tab TYPE TABLE OF string,
result_str TYPE string.
*- end of internal data
DATA: lv_contents TYPE string.
DATA: lv_location TYPE string.
*- begin of parameters
PARAMETERS: url TYPE swc_value.
PARAMETERS : receiver TYPE somlreci1-receiver LOWER CASE.
*- end of parameters
START-OF-SELECTION.
PERFORM main.
*& Form main
text
FORM main.
PERFORM get_contents USING lv_contents.
*- Create the HTTP-Client
l_url = url.
l_proxy_host =
l_proxy_service =
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = l_url
proxy_host = l_proxy_host
proxy_service = l_proxy_service
IMPORTING
client = l_http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*- send the http post
CALL METHOD l_http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
IF sy-subrc <> 0.
WRITE: / icon_red_light AS ICON.
CALL METHOD l_http_client->get_last_error
IMPORTING
code = l_code
MESSAGE = l_message_string.
CALL METHOD l_http_client->close.
l_code_string = l_code.
CONCATENATE 'HTTP-Send: RC=' l_code_string "#EC NOTEXT
INTO l_code_string .
CONCATENATE l_code_string l_message_string
INTO l_message_string SEPARATED BY space.
PERFORM print_string USING l_message_string.
EXIT.
ENDIF.
*- receive the result of http post
CALL METHOD l_http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
IF sy-subrc <> 0.
WRITE: / icon_red_light AS ICON.
CALL METHOD l_http_client->get_last_error
IMPORTING
code = l_code
MESSAGE = l_message_string.
CALL METHOD l_http_client->close.
l_code_string = l_code.
CONCATENATE 'HTTP-Receive: RC=' l_code_string "#EC NOTEXT
INTO l_code_string .
CONCATENATE l_code_string l_message_string
INTO l_message_string SEPARATED BY space.
PERFORM print_string USING l_message_string.
EXIT.
ENDIF.
*- print the results
CALL METHOD l_http_client->response->get_status
IMPORTING
code = l_code.
IF l_code < 300.
HTTP-codes: 100 - 199 = informations
HTTP-codes: 200 - 299 = client-request successful (200 = OK)
WRITE: / icon_green_light AS ICON.
ELSE.
HTTP-codes: 300 - 399 = redirected; further actions required
HTTP-codes: 400 - 499 = client-request incomplete
HTTP-codes: 500 - 599 = server errors
WRITE: / icon_red_light AS ICON.
ENDIF.
*-- get the http header fields
CALL METHOD l_http_client->response->get_header_fields
CHANGING
fields = lt_http_fields.
LOOP AT lt_http_fields INTO l_http_field_wa.
l_char_header = l_http_field_wa-name.
WRITE: / l_char_header.
l_char_header = l_http_field_wa-value.
WRITE: l_char_header.
ENDLOOP.
WRITE: / sy-uline.
*- get the body
DATA: lv_bin_contents TYPE xstring.
lv_bin_contents = l_http_client->response->get_data( ).
PERFORM save_file USING lv_bin_contents.
ENDFORM. "main
*& Form print_string
FORM print_string USING p_string TYPE string.
REFRESH result_tab.
SPLIT p_string AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab.
LOOP AT result_tab INTO result_str.
WRITE:/ result_str.
ENDLOOP.
ENDFORM. " print_string
*& Form save_file
text
FORM save_file USING lv_bin_contents.
DATA: save_file(1000) TYPE c VALUE '/tmp/test3.pdf'.
DATA: lv_file TYPE localfile.
DATA : g_file(80).
g_file = url.
DO.
SHIFT g_file LEFT UP TO '/'.
IF sy-subrc NE 0.
EXIT.
ENDIF.
SHIFT g_file LEFT.
ENDDO.
SHIFT g_file RIGHT UP TO '.'.
SHIFT g_file RIGHT.
lv_file = save_file.
OPEN DATASET lv_file FOR OUTPUT IN BINARY MODE.
IF sy-subrc NE 0.
WRITE:'SY-SUBRC :',sy-subrc.
MESSAGE i000 WITH text-014. "'File Directory not found'.
EXIT.
ENDIF.
TRANSFER lv_bin_contents TO lv_file.
CLOSE DATASET lv_file.
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF sy-subrc EQ 0.
MESSAGE i000 WITH text-012."'Successfully downloaded to Application
server'.
EXIT.
ENDIF.
ENDFORM. "save_file -
How do I send e-mail to a distribution list using LabWindows/CVI?
I need to be able to send e-mail to a user-defined distribution list using LabWindows/CVI? Has anyone done this? Any ideas where I could look?
I commented on something similar to this awhile back. My issue was that I had the base version and didn't have the Internet classes. So this external app worked like a charm
It has a lot of command-line inputer options to use as well.
http://forums.ni.com/t5/LabWindows-CVI/Need-Help-for-Sending-Email-with-LabWindows-8-5-or-9/m-p/1095...
Maybe you are looking for
-
I've contracted the grey square issue on iTunes (from fannying about trying to figure out how to rename image files so that they correspond on iTunes and Finder). I've followed the instructions which appear in duplicate throughout this section howeve
-
Capture change of relationship in HRP1001
How can I capture the change of relationship in HRP1001? For example, the relationship of Position and Org Unit change from A003 to A012. Appreciate your help.
-
Air,Flex ,Cold Fusion There is a problem with P4990 Release of AIR Updater
using Air/Flex/cf I am not able to connect to my Cold Fusion component after running the P4990 UPdate this morning, It worked fine on both an XP and Vista Machine running P4880 , but now even after a restart my simple connection to the cfcomponent is
-
I want to format binary output in text fields to confrom to the following scheme: head data1 data2 return offSet id 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits where the first row are field names and the second is the filed width. What that means is th
-
Download Failures continue to oppress loyal customer
Photoshop CC is once again failing to install updates. Desktop component failed - new install. So much time wasted!