FTP Sender - file as attachment
Hi all,
I need to build a scenario where I have two files that needs to be picked up from ftp location.
One file needs to be attached as binary document to the second file (xml).
How can I achieve this?
We are using SAP PI 7.31.
Thanks in advance!
Hi Tim,
Option1: You can consider the files as single zip file and then use payloadzipbean to unzip them in sender file adapter.
Option2: You can write an adapter module with similar functionality of "Specifying Additional Files"
Regards,
Praveen Gujjeti
Similar Messages
-
Hi,
I recently switch from a complete Windows envrionment to a Mac one. I use a MacBook air with Mac OS X Lion.
I recently installed Office for Mac 2011 to use Outlook 2011 with my Exchange. I changed the setting in the Mail app and Outlook to use my Outlook as default mail client.
There's still something I need to correct. When I "right-click" a file and select send file as attachment, it opens the Mail App to send it. I don't know how to completely switch to Outlook. I don't care about not using mail app at all.
I've tried a couple of things, like deleting com.apple.LaunchServices.plist but I still have the same issue.
Any suggestions ?
ThanksThat service is hard-coded to Mail and can't be changed through any user setting. Try this workaround:
http://www.officeformachelp.com/2010/11/create-a-service-to-attach-files-to-a-ne w-outlook-for-mac-mail-message/
If Library in Automator does not list Microsoft Outlook, the "Create New Outlook Mail Message" action should be listed in the second pane (along with all the other Microsoft application actions).
Regards. -
Sending File as attachment using Mail adapter with naming convention
Dear All,
I am working on a scenario in which my sender file adapter is sending one file named 'ABC.ok' in one of the folders in application server. I have to send the same file with the same name to one of the folders at FTP and also to my customer at his email id.
I have used File Content onversion at the receiver side and has selected adapter specific attributes due to which the required file is getting generated at FTP folder with the same name as that of the source. But how to send the same file using the mail adapter by keeping same name as "ABC.ok". Kindly guide me out in this.
Regards,
NJwhat you need to do:
1) Select ASMA in Sender and receiver File CC...already done
2) Using the Dynamic Config UDF get the sender file name in the field Content-Type...for this you need to have a return statement in your UDF
3) now before pushing this file name to the Content-Type you have to append (concat)the actual type of the file content (xml, txt)
so your entire Content-Type node will have something like text/plain; name="abc.ok"
SAP Note has reference on how to do this:
https://service.sap.com/sap/support/notes/856599
From the note:
Q: How can I set the file name of a mail attachment?
Regards,
Abhishek. -
How to send file as attachment and call RFC to trigger event in ECC?
Hello,
A file is retrieved from FTP into PI (w/ NO MAPPING required - just pass through) and placed on the ECC appl. Server. Then, a RFC is made to trigger an event to process the file in ECC. However, a RFC cannot be called in the graphical mapping if there is no mapping required.
I have seen this Blog, u201CFile to R/3 via ABAP Proxyu201D, http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/1847. [original link is broken] [original link is broken] [original link is broken] But we are told not to touch the file as it will be converted in ECC by a program.
Also, I read that using ABAP proxy-PI-FTP, I can do a pseudo mapping, simple one node, (just so a RFC can be triggered) and also pass the file as an attachment. Letu2019s say this works:
Question 1: What configuration steps in the FTP adapter that will allow me to u201Calsou201D send the file as an attachment?
Question 2: (Continue with ABAP proxy option) How do I control where will it be deposited so that the program can access it?
Question 3: If this is not the best approach, how many steps would I need to do it in BPM (i.e. pick up the file from FTP, place it on appl server, and trigger a RFC to call an event to process file)?
Thanks for any suggestions!
John_XiI have read those two help file and was able to use it in the ABAP proxy code. Thanks.
This is the current outcome. I totally understand that SAP PI communicates via XML. So when PI picks up a file that contains XML tags, the Inbound proxy is triggered. I can see its processing in SM50. However, when I give the Sender FTP adapter a non-XML file to pick up, the Inbound Proxy does not trigger. The file itself should be read into memory so that I can save it to the application server via ABAP code (with no mapping). That is why there is no operation mapping
The reason I am using using FTP to ABAP proxy is because I need to call a subsequent RFC step to process the file. Else, I will just use FTP to File Adapter scenario.
Question 1: I am thinking that that file is the attachment. Is that where I am incorrect and I still need to send in an XML file with the attachment as an addition?
Question 2: Is this the best approach or should I use BPM? If BPM, what steps do I need? -
Issue while fetching the file through *.extension by FTP sender file adapte
Hello Experts,
I am facing a issue while fetching the data through sender File adapter with ' *.file extension' .I am illustarting the scenario as below .
It is a simple scenarion of File to File inboumd scenarion.Here file is getting picked up from a third party system
through FTP sender chanel and stored in a temp folder of PI through NFS rceiver file adapter .
The problem is however I am getting, while picking the file with file name as "*.exo"(where exo is the file extension).
But while fetching the file with particular name like"abcd_10032011*.exo"(file naming has been done by combination of abcd(always same)_currentdate(change according to current date)),file picked successfully .
So here ,in the prior case file not getting picked up,but in later case it dose .
Can anyone please let me know what might be the issue?Hi Sunit,
Connect from your PI System to 3rd Party System (where are placed the Source Files)
FTP <PartySystemHostName>
eg. FTP 10.2.3.456 (then insert Username & Password to Login)
Go to source directory
cd \<SourceDirectory>
eg. cd \donaldduck\directory\
Execute a File List command
ls -la *.<extension>
eg. ls -la *.exo
In this way you should be able to view all files with this extension (*.exo), the same action that Sap XI perform to pickup the file.
Then, try to copy that file to your Local PI System (to check if there're some permissions issue):
mget <filename>.exo
eg. mpget File1_01012011.exo -
Converting Sender File as attachment using PayloadSwapBean module
Hi Expert,
I have a scenario where I have to pick up a file from PI & send it to another PI server as an attachement using XI Adapter.
I went through SDN & found several messages describing configuration for attachement for mail & SOAP adapter.
I attached PayloadSwapBean in my sender File channel & passed keyname as Conent-Disposition & keyValue as attachment however I dont see file being converted as an attachment in SXMB_MONI. It still shows it as main payload.
Please help me on how to convert a sender file payload into attachement. I would like to keep attachment name same as file name. Let me know how we can do that. I also noticed that on receiver XI adapter (which I would be using to send data to next PI system), you can't attach modules. Let me know if there is some other standard way of achieving this requirement.
Thanks
Regards
SushilHi Stefan,
No, I dont see dynamic configuration values in second PI system. I am able to see them in first system.
Hi Amol,
Do you see dynamic configuration in second PI? I am still referring ASMA in second PI system as file parameters? Should it be HTTP header? (How are you referring ASMA in second PI). Below is my code which give me null at run time.
DynamicConfiguration dCon =(DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey dKey = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","Directory");
String FileDirectory = dCon.get(dKey);
return FileDirectory; -
Send files as attachment with BCS-methods
Hi,
I want to load file(s) from application server
and send it as attachment per mail.
In 4.6c I had a program with fm 'SO_DOCUMENT_SEND_API1'
that worked fine. But not any longer in 7.01.
So i tried it with the new method of BCS*
But it worked not fully correct.
German mutations are not correct.
and e.g. in excel ther is a message "too many columns" although there're only 130 col.
In 4.6 I opend the data file(s) in binary mode and saved it to solix
Which addition I must choose to the open-command?
And what I have to note by the converting method cl_bcs_convert=>string_to_solix?
Do you know a sample program to my problem ?
In BCS_EXAMPLE* I did not found anyone
thanks
Andreas
Edited by: Andreas Mann on Oct 25, 2011 4:22 PMI do have sample code
sending email with attachment using BCS,
i can only post it by thursday,
currently refer this.. i will post sample code later
DATA lt_message TYPE bcsy_text.
DATA lv_mail_title TYPE so_obj_des.
DATA document TYPE REF TO cl_document_bcs.
DATA recipient TYPE REF TO if_recipient_bcs.
DATA send_request TYPE REF TO cl_bcs.
DATA sent_to_all TYPE os_boolean.
DATA bcs_execption TYPE REF TO cx_bcs.
DATA email_id TYPE ADR6-SMTP_ADDR
send_request = cl_bcs=>create_persistent( ).
*Create Title
CONCATENATE 'Mail Subject' '-' 'xxx'
INTO lv_mail_title RESPECTING BLANKS.
*Create Message(EMAIL Body)
APPEND '<p>Dear Sir/Madam</p>' TO lt_message.
APPEND '<p>The Message body.......</p>' TO lt_message.
APPEND '<br>' TO lt_message.
*Create Document
document = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = message_body
i_subject = subject ).
*Add Attachement
document->add_attachment(..
...). "Check this method
*Add document to email
send_request->set_document( document ).
recipient = cl_cam_address_bcs=>create_internet_address(
i_address_string = email_id ).
*add recipients to send request
send_request->add_recipient( i_recipient = recipient ).
sent_to_all = send_request->send(
i_with_error_screen = 'X' ).
COMMIT WORK.
IF sent_to_all = 'X'.
MESSAGE s398(00) WITH 'Message Sent Succesfully'.
RETURN.
ENDIF.
thanks & regards,
suji -
Finder: Right Click to send file as attachment of new thunderbird email
Hi,
I am working with Thunderbird.
To open Thunderbird from the Terminal with a new message and an attachment, I have to write in Terminal:
/Applications/Thunderbird.app/Contents/MacOS/thunderbird-bin -compose attachment='/Users/JoergMeier/Documents/2010/OpenOfficeHilfeInhaltsVerzeichnis. pdf'
Now I would like to add an action to the context menu, to use in finder, to send the marked file as attachment of a new thunderbird email.
How can I do this?
Automator?
Thx
JoergThat service is hard-coded to Mail and can't be changed through any user setting. Try this workaround:
http://www.officeformachelp.com/2010/11/create-a-service-to-attach-files-to-a-ne w-outlook-for-mac-mail-message/
If Library in Automator does not list Microsoft Outlook, the "Create New Outlook Mail Message" action should be listed in the second pane (along with all the other Microsoft application actions).
Regards. -
How to send file as attachment in Email in Oracle UCM
Hi All,
I have created a simple html form which executes my custom service( internally calls java method) to send a email "forms data" to the user. I need to send file as attchment in email so how i can do it in oracle ucm.Currently i am using intradoc api.I am using a jquery plugin for sending forms data including uploaded file.
function which i am using in java for sending emails:-
InternetFunctions.sendMailTo(emailStr, "MyMail", subject, this.m_service);
I have set method="post" and enctype="multipart/form-data" in the form
So plz help to provide a solution to send a file as attchment in email
Thanks,
user9018217From what I remember, there isn't an "out of the box" solution since InternetFunctions only provides some basic email functions (try decompiling the class to see what's available).
Here's the link for the original Stellent 10gR3 sample components: http://www.oracle.com/technetwork/middleware/content-management/index-092832.html. Take a look at the AcmeMail component within the HowTo Components sample. It shows how to create a custom idcservice that sends basic emails. You can use that as a baseline for creating your own email service and then use something like JavaMail to implement attachments. That's what I did.
Good luck, and please award points as necessary. -
Send file as attachment via mail
Dear All,
I want to send a report (ALV) as attachment to some mail. I am using SO_NEW_DOCUMENT_SEND_API1. Can you please suggest how can I send mail as attachment. I am able to send ALV report as HTML format. I want to send it as attachment.
Thanks and regards,
AtanuHi,
plz check the below code.
it sends Excel sheet attachment with the mail using FM 'SO_DOCUMENT_SEND_API1'
code>>>>>>>>>>>>>>>>>>>>.
form send_email_with_attachment .
DATA: l_t_objbin LIKE solisti1 OCCURS 100 WITH HEADER LINE.
DATA: i_body TYPE soli_tab WITH HEADER LINE.
DATA: l_t_objtxt LIKE solisti1 OCCURS 100 WITH HEADER LINE.
DATA: l_t_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: l_t_objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: l_t_reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: w_tabln TYPE i . "for number of table lines
DATA: w_line TYPE so_text255. " Line of text
DATA: l_doc_chng LIKE sodocchgi1.
DATA: l_tab_lines LIKE sy-tabix.
DATA: l_att_lines TYPE i.
DATA: lv_lines TYPE i.
DATA : BEGIN OF wa_mrpnm,
werks TYPE ZCSVT024D-werks,
dispo TYPE ZCSVT024D-dispo,
name_first TYPE ZCSVT024D-name_first,
name_last TYPE ZCSVT024D-name_last,
END OF wa_mrpnm,
l_i_mrpnm LIKE STANDARD TABLE OF wa_mrpnm.
DATA : l_name TYPE string.
*Used for delimiting the columns in Excel Sheet.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS:
cr_mark(2) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
constants c_l_newline type ABAP_CHAR1 value %_NEWLINE. "#EC NOTEXT
CLEAR : l_t_objpack,
l_t_objhead,
l_t_objbin,
l_t_objtxt,
l_t_reclist.
REFRESH: l_t_objpack,
l_t_objhead,
l_t_objbin,
l_t_objtxt,
l_t_reclist.
Creating the content of the e-mail message text
IF sy-sysid(1) = 'P'.
IF p_order = 'X'.
l_doc_chng-obj_name = 'Subcontracting Setup Report'(m02).
CONCATENATE 'Details of Orders Extract'(028) 'for Plant'(029)
p_werks
INTO l_doc_chng-obj_descr SEPARATED BY space.
l_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( l_t_objtxt ).
ELSE.
l_doc_chng-obj_name = 'TEST ONLY!! SC Setup Report'(m03).
CONCATENATE 'Details of Forecast Extract'(030) 'for Plant'(029)
p_werks
INTO l_doc_chng-obj_descr SEPARATED BY space.
l_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( l_t_objtxt ).
ENDIF.
ELSE.
IF p_order = 'X'.
l_doc_chng-obj_name = 'Subcontracting Setup Report'(m02).
CONCATENATE 'Details of Orders Extract'(028) 'for Plant'(029)
p_werks 'TEST TEST TEST'
INTO l_doc_chng-obj_descr SEPARATED BY space.
l_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( l_t_objtxt ).
ELSE.
l_doc_chng-obj_name = 'TEST ONLY!! SC Setup Report'(m03).
CONCATENATE 'Details of Forecast Extract'(030) 'for Plant'(029)
p_werks 'TEST TEST TEST'
INTO l_doc_chng-obj_descr SEPARATED BY space.
l_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( l_t_objtxt ).
ENDIF.
ENDIF.
l_t_objtxt = 'Hi,'(036).
APPEND l_t_objtxt.
CLEAR l_t_objtxt.
APPEND l_t_objtxt.
CONCATENATE 'Please open the attachment to review details of the Report'(031)
'for plant'(029) p_werks INTO l_t_objtxt
SEPARATED BY space.
APPEND l_t_objtxt.
CLEAR l_t_objtxt.
APPEND l_t_objtxt.
DESCRIBE TABLE t_ddow LINES sy-tfill .
IF sy-tfill GT 0 .
MOVE 'These Materials have been marked as DDOW materials.'(032)
TO l_t_objtxt.
APPEND l_t_objtxt.
CLEAR l_t_objtxt.
APPEND l_t_objtxt.
APPEND l_t_objtxt.
APPEND l_t_objtxt.
CONCATENATE 'Note! - This is an automatically generated email by the'(034)
'SAP system. Pls do not reply to the sender.'(035)
INTO l_t_objtxt
SEPARATED BY space.
APPEND l_t_objtxt.
DESCRIBE TABLE l_t_objtxt LINES l_tab_lines.
READ TABLE l_t_objtxt INDEX l_tab_lines.
l_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( l_t_objtxt )
Creating the entry for the email text in the packing list
CLEAR l_t_objpack-transf_bin.
l_t_objpack-head_start = 1.
l_t_objpack-head_num = 1.
l_t_objpack-body_start = 1.
l_t_objpack-body_num = l_tab_lines.
l_t_objpack-doc_type = 'RAW'.
lv_lines = l_tab_lines.
APPEND l_t_objpack.
Columns Heading for Excel Attachment.
CONCATENATE 'MRP Controller'(044)
'MRP Name'(047)
'Material'(037)
'Plant'(026)
'PP Cal'(038)
'Ship Date'(009)
'PO Number'(014)
'PO Line'(033)
'PP Text'(041)
INTO i_body
SEPARATED BY cr_mark.
concatenate ' ' i_body into i_body separated by c_l_newline.
APPEND i_body TO l_t_objtxt.
CLEAR i_body.
Get MRP Names
SELECT werks dispo name_first name_last
FROM ZCSVT024D
INTO TABLE l_i_mrpnm
FOR ALL ENTRIES IN t_ddow
WHERE werks = t_ddow-werks
AND dispo = t_ddow-dispo.
IF sy-subrc = 0.
SORT l_i_mrpnm by werks dispo.
ENDIF.
Data to be shown in Excel Sheet.
LOOP AT t_ddow INTO w_ddow.
CLEAR : l_name.
READ TABLE l_i_mrpnm INTO wa_mrpnm WITH KEY werks = w_ddow-werks
dispo = w_ddow-dispo
BINARY SEARCH.
IF sy-subrc = 0.
CONCATENATE wa_mrpnm-name_first wa_mrpnm-name_last
INTO l_name SEPARATED BY space.
ENDIF.
CONCATENATE w_ddow-dispo
l_name
w_ddow-matnr
w_ddow-werks
w_ddow-mrppp
w_ddow-datum
w_ddow-ebeln
w_ddow-ebelp
w_ddow-pptxt
INTO i_body
SEPARATED BY cr_mark.
concatenate ' ' i_body into i_body separated by c_l_newline.
APPEND i_body TO l_t_objtxt.
CLEAR : w_ddow.
ENDLOOP.
DESCRIBE TABLE l_t_objtxt LINES l_tab_lines.
DESCRIBE TABLE l_t_objtxt LINES l_att_lines.
l_tab_lines = l_tab_lines - lv_lines.
Creating the entry for attachment in the packing list
objpack-transf_bin = 'X'.
lv_lines = lv_lines + 1.
l_t_objpack-head_start = 2.
l_t_objpack-head_num = 1.
l_t_objpack-body_start = lv_lines.
l_t_objpack-body_num = l_tab_lines.
l_t_objpack-doc_type = 'XLS'.
l_t_objpack-obj_name = 'DDOW_Materials'(045).
l_t_objpack-obj_descr = 'DDOW Marked Materials'(046).
l_t_objpack-doc_size = l_tab_lines * 255.
APPEND l_t_objpack.
lv_lines = l_att_lines.
**RECEIVERS...
LOOP AT t_ddow INTO w_ddow.
REFRESH l_t_reclist .
CLEAR l_t_reclist.
* get the MRP controller from table
READ TABLE t_mrpc INTO w_mrpc WITH KEY werks = p_werks
dispo = w_ddow-dispo
BINARY SEARCH .
IF sy-subrc EQ 0 .
MOVE: 'X' TO l_t_reclist-express ,
'U' TO l_t_reclist-rec_type ,
w_mrpc-smtp_addr TO l_t_reclist-receiver .
APPEND l_t_reclist.
EXIT.
ENDIF.
ENDLOOP.
Sending the document
IF NOT l_t_reclist[] IS INITIAL.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = l_doc_chng
commit_work = 'X'
TABLES
packing_list = l_t_objpack
object_header = l_t_objhead
contents_bin = l_t_objbin
contents_txt = l_t_objtxt
receivers = l_t_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
ENDIF.
IF sy-subrc <> 0.
* Do nothing
ELSE.
COMMIT WORK AND WAIT.
MESSAGE s899(8a) WITH 'Email Message sent successfully'."#EC
ENDIF.
ENDIF.
<<<<<<<<<<<<<<<<<<<<<<<
regards,
vikas.
plz reward if helpful.. -
FTP - Sender File Adapter - Exactly Once In Order
We are running SP10 on PI7.0
I have a file (FTP - content conversion) to idoc scenario and this works well apart from the communication channel picking up the files in the wrong order.
I have set to Exactly Once In Order, and the nuemrically file is being picked up in the correct order, however we wish to pick the file up by time and date stamp.
If I flag the Adapter Specific Message Attributes - and Source File Time Stamp, will this then process the files by timestamp instead of by File name?
How else can we get the files to process by time created?but this option is valid for NFS transport protocol
http://help.sap.com/saphelp_nw70/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm
● Processing Sequence (for transport protocol File System (NFS))
If you used placeholders when specifying the file name, define the processing sequence of the files:
○ By Name: Files are processed alphabetically by file name.
○ By Date: Files are processed according to their time stamp in the file system, starting with the oldest file.
Message was edited by:
Prabhu S -
Regarding sending Email as attachment
Hi guys.
One unique issue.
I meed to send a file as an attachment to one perticular address. Got to knowt that some function module like So_attmail would work. But that sends the content as body of the mail. But i want the file to be sent as attachment. Could someone help me this plz.
If possible also let me know what are the parameters that i need to pass in short.
Thanks in advance.
Abhi.Hi Abhi,
Have a look at this example:
http://www.sap-img.com/abap/sending-email-with-attachment.htm
http://www.sap-img.com/abap/sending-mail-with-attachment-report-in-background.htm
http://www.sap-img.com/fu016.htm
1. We can send files with attachment.
However, There is some trick involved
in the binary files.
2. I have made a program (and it works fantastic)
ONLY 6 LINES FOR EMAILING
BELIEVE ME
ITS A FANTASTIC PROGRAM.
IT WILL WORK LIKE OUTLOOK EXPRESS !
3. The user is provided with
a) file name
b) email address to send mail
and it sends ANY FILE (.xls,.pdf .xyz..)
Instantaneously !
4. Make two things first :
1. Include with the name : ZAMI_INCLFOR_MAIL
2. Report with the name : ZAM_TEMP147 (any name will do)
3. Activate both and execute (2)
4. After providing filename, email adress
5. Code for Include :
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
Data
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
CODE FOR PROGRAM
5.
REPORT zam_temp147 .
INCLUDE zami_inclfor_mail.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
<b>PS : Reward points if helpful</b>
Thanks,
Ramya. -
Help regd in sending mails with attachment
Hi All,
I have a requirement to send mails with attachements.The attachments can be simple word , excel anything. Please help.Is there a way I can send these from workflows also?hi use this , this is one of the best examples for sending mail ....
1. We can send files with attachment.
However, There is some trick involved
in the binary files.
2. I have made a program (and it works fantastic)
ONLY 6 LINES FOR EMAILING
BELIEVE ME
ITS A FANTASTIC PROGRAM.
IT WILL WORK LIKE OUTLOOK EXPRESS !
3. The user is provided with
a) file name
b) email address to send mail
and it sends ANY FILE (.xls,.pdf .xyz..)
Instantaneously !
4. Make two things first :
1. Include with the name : ZAMI_INCLFOR_MAIL
2. Report with the name : ZAM_TEMP147 (any name will do)
3. Activate both and execute (2)
4. After providing filename, email adress
5. Code for Include :
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
Data
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8
IF sy-subrc 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
CODE FOR PROGRAM
5.
REPORT zam_temp147 .
INCLUDE zami_inclfor_mail.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
regards,
venkat. -
FTP adapter should send file as binary attachment
Hello,
we user XI 3.0 and want to implement the following scenario:
- FTP adapter has to read binary files (*.tif and *.xls)
- Receiver adapter is an ABAP proxy
We want to get the file content as attachment to the message or as binary string in the payload. Is it possible? I Think the FTP adapter can only handle the file content over as complete message payload and not as an attachment. File content conversion is not possible because we read non textual files. Do any adpater modules exist that could swap the payload to attachment? In my point of view the PayloadSwapBean can only handle the other way.
Any suggestions?
Thanks in Advance,
DanielHello,
with the file adapter in NFS mode it is easy to attach one file as payload and further files as attachment.
But as I stated above we use the FTP mode (and we have no NFS server!). The binary file is read by the adapter and assigned to the message as main payload. The proxy inbound handling is not able to parse the payload because it will see it as application/xml.
I'm looking for one of the following solutions:
1) swap the content of the main payload to an attachment. This can be processed at the proxy
2) perhaps it is possible to change the mime type of the main payload to reflect the xls or tif content with the MessageTransformBean. But what has to be done at the proxy inbound side?
Best regards,
Daniel -
File/FTP to ABAP Proxy (file as attachment)
I have the following scenario: File/FTP -> XI -> ABAP Proxy but not the normal case. What I need is the picked file as attachment and the file name. I hope this is possible.
I have found the following blogs:
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
/people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments
I have no idea where I have to start. How I should define the sender and receiver message interface? How I have to configure the sender file/ftp adapter?
I'm using PI 7.1 SP 7.At the moment I have the following problem. I always get an error during mapping the request message. This is the error message:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Mapping der Request-Message
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
<SAP:Category>Application</SAP:Category>
<SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>
<SAP:P1>com/sap/xi/tf/_MT_SCANFILE_to_MT_SAP_SCANFILE_</SAP:P1>
<SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException:</SAP:P2>
<SAP:P3>Fatal Error: com.sap.engine.lib.xml.parser.ParserE</SAP:P3>
<SAP:P4>xception: XMLParser: No data allowed here: (hex) ~</SAP:P4>
<SAP:AdditionalText />
<SAP:Stack>Während des Anwendungs-Mappings com/sap/xi/tf/_MT_SCANFILE_to_MT_SAP_SCANFILE_ ist eine RuntimeException aufgetreten. com.sap.aii.utilxi.misc.api.BaseRuntimeException:Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) ~</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
And if I use transaction sxmb_moni I see that the payload MainDocument is my pdf document and I can read it.
MG%PDF-1.3
%âãÏÓ
2 0 obj
/WinAnsiEncoding
endobj
3 0 obj
<<
%Devtype POST2 Font COURIER normal Lang DE
/Type /Font
/Subtype /Type1
/BaseFont /Courier
/Name /F001
/Encoding 2 0 R
>>
endobj
4 0 obj
<<
/Length 5 0 R
u2026.
I believe there is still an error at my communication channel configuration of the ftp sender adapter.
Maybe you are looking for
-
Report Generation: New Report.vi
Running applicaion in development mode works fine. After compiling however I get Error 7: Open VI Reference in New Report.vi Why am I getting this error?
-
This software was installed without my permission when running the Linksys router setup when installing a new router. My network functioned perfectly fine before this awful software hacked into my system. Now it wants me to re-setup my system using t
-
Checking for X continuous periods for a certain item
Hi, simplified, I have a table like this: ROWNUM VEHICULE_ID FROM(DD/MM/YYYY) TILL(DD/MM/YYYY) ============================================== 1 1 10/09/2009 02/02/2010 2 2 01/01/2010 31/12/2010 3 1 01/01/2010 31/12/2010 4 3 01/10/2009 31/03/2010 5 1
-
I have never had a problem using messages to send messages to imessage. However as of about half an hour ago, every message fails to send. Any ideas?
-
No contracts are replicated with xMAM 3.0 SR3
Hi, my xMAM configuration works fine so far. The only thing is that no contracts are replicated. The MAM settings are done for doing so and a test contract for an equipment is also created. Which SyncBO is responsible for contracts in xMAM 3.0 and wh