Create tab delimited file
Hi,
I must create a tab delimited output complex text file from a read on a database table. The file has multiple record lines in it. I have created the XSD from the sample output file and have each field terminated by a './T' . I must pass a tab for each field regardless of whether it is populated from my source data. I can not send a space in the field. How can I map a null value through the XSLT so that the output file has a tab? I've tried setting a default on the xsd but that seems to do nothing. Currently I am setting a fixed text through the mapper to space for all the fields that I do not use. I then go into the XSL and remove the space from the <xsl:text></xsl:text> element. This works, however when I go back into the mapper and change anything through the xslt, it wipes out all of my empty text elements.
Any ideas on how to create a tab delimited file that has tabs for fields that have no data?
Thank you much,
Kevin Meyer
Hi,
I must create a tab delimited output complex text file from a read on a database table. The file has multiple record lines in it. I have created the XSD from the sample output file and have each field terminated by a './T' . I must pass a tab for each field regardless of whether it is populated from my source data. I can not send a space in the field. How can I map a null value through the XSLT so that the output file has a tab? I've tried setting a default on the xsd but that seems to do nothing. Currently I am setting a fixed text through the mapper to space for all the fields that I do not use. I then go into the XSL and remove the space from the <xsl:text></xsl:text> element. This works, however when I go back into the mapper and change anything through the xslt, it wipes out all of my empty text elements.
Any ideas on how to create a tab delimited file that has tabs for fields that have no data?
Thank you much,
Kevin Meyer
Similar Messages
-
Hi,
Can anybody tell me how to create tab delimited file using ABAP. I am using 4.6C ( so I cant use cl_gui_char_utilities ) and I want to download the file to application server ( GUI_DOWNLOAD cant be used ).
Thanks,
SameejHi,
-> here's an example to separate the fields by tab:
DATA: BEGIN OF tabulator,
x(1) TYPE x VALUE '09',
END OF tabulator.
data tabilator_c.
CALL FUNCTION 'SYSTEM_CODEPAGE'
IMPORTING
codepage = c_to.
tabulator_c = tabulator.
TRANSLATE tabulator_c FROM CODE PAGE c_from TO CODE PAGE c_to.
*for int. table
loop at itab.
clear string.
do.
assign component sy-index of structure itab to <f>.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
concatenate string <f> tabulator_c into string.
enddo.
append string to tab_download.
endloop.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILETYPE = 'ASC'
FILENAME = FILE
TABLES
DATA_TAB = tab_download.
Grx Andreas -
GUI_Download problem in tab delimited file
Hi,
I am trying to download tab delimited file using F.M GUI_DOWNLOAD.We have
4.6C version.I have declared internal table with 5 columns.The file created using F.M is very strange.Column 1 and 2 and 3 and 4 are seaprated by tab but column 2
and 3 and column 4 and 5 are not seaprated by tab but have fixed length.
I am not getting where I am doing mistake.Any help is appericiated.
Below is the structure of internal table.
DATA:BEGIN OF IT_FINAL OCCURS 0,
Company(3) type c,
County(30) type c,
FId(35) type c,
Wellno(15) type c,
Welldesc(35) type c,
END OF IT_FINAL.
Data populated in table it_final.
it_final-Company = '300'.
it_final-County = 'Greenwood'.
it_final-fid = 'testts'.
it_final-wellno = '10000000'.
it_final-welldesc = 'tebsbvd'.
append it_final.
F.M GUI_DOWNLOAD
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = l_path
FILETYPE = 'ASC'
APPEND = ' '
write_field_separator = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = it_final
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
Thanks,
Rekha.Hi,
i think it is because tou need to uncomment:
FILETYPE = 'ASC'
try it.
Best regards. -
Hi All,
I am trying to create a tab delimited file using Sender File adapter using <b>File content Conversion in Adapter Module</b>. I want a constant space beteween the fields of length 8 spaces. When i use ' ' as field seperater , the file that is generated is <b>19' 'Stringtest14,Hiring' '09/03/2007' 'Managing Dir, Operations</b>. I want the file without colons i.e <b>19 Stringtest14,Hiring' 09/03/2007 Managing Dir, Operations</b>.
Please Advice...
Regards,
XIerHi Xler
<b>content conversion parameters ,, just like</b>
Recordset structure = DT_PRY,*
DT_PRY.fieldnames = ID,empname,empno,country
DT_PRY.fieldSeparator = '0x09' (tab delimited)
DT_PRY.endSeparator = 'nl'
<b>
The FCC...</b>
Document Name : MT_PRY
Document Namespace : http://product.com/prvsoup
Recordset Name : recordset
Recordset structure = DT_PRY,*
DT_PRY.fieldnames = ID,empname,empno,country
DT_PRY.fieldSeparator = '0x09'
DT_PRY.endSeparator = 'nl'
ignoreRecordsetName = true
http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
<b>can take the help of this blog</b>
/people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
<b>Conversion agent</b>
/people/william.li/blog/2006/03/17/how-to-get-started-using-conversion-agent-from-itemfield
/people/paul.medaille/blog/2005/11/18/conversion-agent-a-free-lunch
/people/alexander.bundschuh/blog/2006/03/14/integrate-sap-conversion-agent-by-itemfield-with-sap-xi
/people/paul.medaille/blog/2005/11/17/more-on-the-sap-conversion-agent-by-itemfield
Thanks!
Questions are welcome here!!
<b>Also mark helpful answers by rewarding points</b>
Regards
Abhishek Agrahari -
How to convert Mail attachment file Tab Delimited file to XML.
Hi PI Experts
I have XI scenario: MAIL XI SAP (ABAP Proxy), the process is
1. XI will receive tab delimited file as attachment in mail.
2. XI will convert the tab delimited file into XML, then map to the target structure.
3. Target will be posted into ECC through ABAP Proxy.
Can anyone help me how can I convert the attachment file (i.e. Tab delimited file) to XML while configuring the sender side.
Thanks in AdvanceI just grabed what I answered from another thread. It should work.
Processing sequence as follows:
1. localejbs/AF_Modules/PayloadSwapBean Local Enterprise Bean swap1
2. localejbs/AF_Modules/MessageTransformBean Local Enterprise Bean tran1
3. sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local Enterprise Bean mail
Module Configuration as follows: Fill the XXXX part with your info.
swap1 swap.keyName payload-name
swap1 swap.keyValue MailAttachment-1
tran1 Transform.Class com.sap.aii.messaging.adapter.Conversion
tran1 Transform.ContentType ext/xml;charset=utf-8
tran1 xml.conversionType SimplePlain2XML
tran1 xml.documentName XXXXXXX_Mail
tran1 xml.documentNamespace http://XXXXX.com.au/XXXX
tran1 xml.fieldSeparator \t
tran1 xml.processFieldNames fromConfiguration
tran1 xml.structureTitle rows
Once you set up the above configuration, you will get one record at a time.
Create a souce message interface like the followings:
XXXXXXXXX_Mail
rows
record
Target message interface:
XXXXXXXXX
rows
field 1
field 2
field 3
Write a UDF function to remove the TAB space
public removeTABSpace(String record,Container container){
//write your code here
StringTokenizer st = new StringTokenizer(record,"\t",false);
String t="";
while (st.hasMoreElements()) t += st.nextElement();
return t;
Write another UDF to get the field 1 for example:
public String getField1(String input,Container container){
int counter=0;
int beginIndex=0;
int endIndex=0;
int i;
for (i=0;i<input.length();i++){
if (input.charAt(i)==34){
counter=counter+1;
if (counter==1){
beginIndex=i+1;
counter=0;
break;
for (i=0;i<input.length();i++){
if (input.charAt(i)==34){
counter=counter+1;
if (counter==2){
endIndex=i;
counter=0;
break;
input=input.substring(beginIndex,endIndex);
return input;
Get the mapping like the followings:
record - removeTABSpace - getField1 - field 1
If you need to get field 2, you will need to write another UDF similar to the above one to handle it. -
Formatting a tab delimited file
Hello All,
I am populating a tab delimited text file with data from a resultset and I'm having problems lining up the columns properly. I tried using tabs, but the variable length of some of the entries are messing up the positioning of the data. Is there a way to create tab delimited fixed length fields with column headers? or is there some better way to do this in general?
Thanks,
JamesI got it working using StringBuffers. Where I missed it was that the formatting of the text of the report originally didn't work under the
code. It was being automatically formatted when it was passed as a message in an email under javamail. I had forgotten that Outlook will do that on it's own. When I tried to make the report an attachment, the defect in the formatting became apparent.
I also got it working (better solution) using POI. That way the attachment is an .xls file, rather than tab-delimited file.
FYI,
James -
Opening a tab delimited file and replacing a space
Hi,
I am trying to open a tab delimited file with 4 columns and corresponding values under it. If no value under the column, 0 should be replaced. I used the StringTokenizer and the split methods, but this doesnt seem to work. Any ideas?
E.g
Title1 Title2 Title3
4 7
5 2
SHould be like this:
Title1 Title2 Title3
4 0 7
0 5 2
Thanks..The answer, however, is no. Java is a strongly typed
language; there is no predefined manner in which a
String object can be casted to an Integer object
because a String is not an Integer.
However, if you'd like to create an Integer based on
the contents of a String, you can pass the String to
the Integer.parseInt(String) method. That method
will do one of two things: return the Integer object
representing the integer contained within the String
(if the String represents an Integer) or throw a
NumberFormatException (if the String is not an
Integer).Hi,
Thanks tvynr for your reply. Ok first things, sorry, I had written that post in a hurry. Yes i dont usually put capital letters for my fields. Also i did mean using the add method. Not the get..
And yes I have tried various different type castings. Just to see if one of them would work. And yes i did try Integer.parseInt() by passing in the string to get back its contents as an integer. *And yes the String content is an integer.
Heres a snippet of my code -
List ArrScore1 = new ArrayList(); //List to store Score in one Array
List ArrScore2 = new ArrayList(); //List to store same Scores in another Array. FOr comparisions
List SCORES = new ArrayList();
int dist1,dist2 = 0;
float distance,percent;
while ((record = br.readLine())!= null) //To read from a file line by line from first line
recCount++;
String rec = record;
String [] ScoreScop = rec.split("\t");
ArrScore1.add(ScoreScop[4]));
ArrScore2.add(ScoreScop[4]);
} //End of While loop
System.out.println("Total Records: " + recCount);
for (int i=0; i<ArrScore1.size(); i++)
for (int j = i + 1; j < ArrScore2.size(); j++)
dist1 = Integer.parseInt(ArrScore2.get(j)); //Error I get here is is Cannot resolve symbol. What does this mean exactly?
dist2 = Integer.parseInt(ArrScore1.get(i)); //Same error
distance = dist1/dist2;
percent = distance * 100;
SCORES.add(percent); //Again same error
} //End of j loop
} // End of i loop
I have included all the necessary packages as well. Including :
import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.List;
import java.util.ArrayList;Any idea what I am doing wrong here? -
Is there any methodology whereby a file can be exported, or saved, as a Tab Delimited File?
ThanksSelect All
Copy
Paste in a Pages document
Export as text.
Other way (my preffered one) :
Select All
Copy
run this Script :
--[SCRIPT clipboard2textFile]
Enregistrer le script en tant que Script :clipboard2textFile.scpt
déplacer le fichier créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:
Copiez la table à exporter dans le Presse-papiers.
menu Scripts > clipboard2textFile
Le script créera un fichier TSV (valeurs séparées par TAB).
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
+++++++
Save the script as a Script :clipboard2textFile.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:
Copy the table to export into the clipboard
menu Scripts > clipboard2textFile
The script will create a TSV file (Tab separated values).
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
+++++++
Yvan KOENIG (VALLAURIS, France))
2009/07/07
2010/01/10 : Corrigé quelques coquilles dans les explications
--=====
on run
try
set enTexte to the clipboard as text
set fName to (do shell script "date " & quote & "+_%Y%m%d-%H%M%S" & quote) & "." & "txt"
set p2d to path to desktop
tell application "System Events" to make new file at end of p2d with properties {name:fName}
write enTexte to file ((p2d as text) & fName)
on error
if my parleAnglais() then
error "The clipboard doesn’t contain text data. Maybe you selected a Numbers sheet !"
else
error "Le presse-papiers ne contient pas de données texte. Vous avez peut-être copié une feuille de Numbers !"
end if
end try
end run
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) mardi 16 février 2010 21:57:42 -
Download Tab Delimited file from spool!
Hi Experts,
Is there any way to download tab delimited txt file from spool?
Spool is created for Statements and Invoices from Sap Script and Smartform which is in OTF format.
I am able to download this in Text file but I need this file in tab delimited format.I don't understand what you want to do as it seems impossible : the spool contains miscellaneous data, not compatible with tab delimited files which are used to store 2-dimensional tables (columns, rows).
-
I am using OWB to read data from a bunch of oracle tables and putting the results in a flat file. I've defined is as a tab delimited file and everything works fine except for one thing. What I need is to include double quotes for only those fields that are of character type. Currently, all the fields are being enclosed with double quotes. Where can I specify double quotes as enclosures for character fields only? Any feedback would be greatly appreciated.
Thanks.the best option that i would suggest is:
create a staging table with columns datatype as varchar2 or have one single large column with carchar2(4000)
put all values from the source table to the staging table by concatenating all the columns
have a logic to add " " to the required fields, this can be easily done using expression builder by concatenating the "" before and end of the string
export the table as tab delimited so at the end of it you will ahve the required fields enclosed by strings. -
How can I save a Numbers spreadsheet as a tab delimited file?
Okay, I would like to save a Numbers spreadsheet as a tab delimited file. But of course I can't do that, since Numbers only saves as a comma separated values file.
Plan B: I can open up a CSV file created by Numbers in TextEdit, and I would like to Find and Replace all the commas with tabs. So I open up the Find window, enter a comma under Find, but of course when I put the cursor in the Replace blank and hit the Tab key, it just goes to the next blank instead of giving me a Tab.
Is there a way I can get a Tab into that blank so I can replace all the commas with tabs?
--DaveHello
When we use TextEdit as I described, rows are separated by Returns.
It appears that your program requires LineFeeds.
Here is a neat soluce.
Save this script as an Application Bundle.
--\[SCRIPT tsv2csv]
(* copy to the clipboard a block of datas separated by tabs
run the script
You will get on the desktop a csv file named from the current date-time.
The values separator is set to match the Bento's requirements:
If the decimal separator is period, the script uses commas.
If the decimal separator is comma, the script uses semi-colons.
This may be changed thru the setting of the property maybeSemiColon.
According to the property needLF,
embedded Returns will be replaced by LineFeeds
or
embedded LineFeeds will be replaced by Returns
Yvan KOENIG (Vallauris, FRANCE)
le 10 octobre 2008
property needLF : true
(* true = replace Returns by LineFeeds
false = replace LineFeeds by Returns *)
property maybeSemicolon : true
(* true = use semiColons if decimal separator is comma
false = always uses commas *)
--=====
try
set |données| to the clipboard as text
on error
error "the clipboard doesn't contain text datas !"
end try
set line_feed to ASCII character 10
if |données| contains tab then
if maybeSemicolon then
if character 2 of (0.5 as text) is "," then
set |données| to my remplace(|données|, tab, quote & ";" & quote)
else
set |données| to my remplace(|données|, tab, quote & "," & quote)
end if -- character 2 of (0.5…
else
set |données| to my remplace(|données|, tab, quote & "," & quote)
end if -- maybeSemiColon
end if -- |données| contains tab
if needLF then
if |données| contains return then set |données| to my remplace(|données|, return, line_feed)
set |données| to my remplace(|données|, line_feed, quote & line_feed & quote)
else
if |données| contains line_feed then set |données| to my remplace(|données|, line_feed, return)
|données| to my remplace(|données|, return, quote & return & quote)
end if -- needLF
set |données| to quote & |données| & quote
set p2d to path to desktop as text
set nom to my remplace(((current date) as text) & ".csv", ":", "-") (* unique name *)
tell application "System Events" to make new file at end of folder p2d with properties {name:nom}
write |données| to file (p2d & nom)
--=====
on remplace(t, tid1, tid2)
local l
set AppleScript's text item delimiters to tid1
set l to text items of t
set AppleScript's text item delimiters to tid2
set t to l as text
set AppleScript's text item delimiters to ""
return t
end remplace
--=====
--[/SCRIPT]
Yvan KOENIG (from FRANCE vendredi 10 octobre 2008 13:47:36) -
Importing data from tab delimited file
Hi everyone,
This is my first question on here so I hope I am doing the right thing.
I've searched online as much as I can to find an answer or a way to fix my problem but I have not been able to find a resolution.
My issue is I'm trying to import name and contact information from a excel file, that I have saved as a tab delimited file, into a fillable PDF file. I'm able select the text file through the import option and it shows the correct information as different rows that I can import but when I select one and click on to finish the import of the data I get an error message advising that some of the text could not be imported. The issue is nothing is being imported at all.
I've made sure that all the relevant fields are the same name as what the form has but still cannot get anything to import.
Does anyone have any ideas why this may not be working? Also I basically have no ability to write JavaScript to import the information otherwise I would look at travelling down that path.
Please let me know if I need to be any more specific.
Regards,
AdamOk I can share the form itself and will need to quickly create some data itself to go along with it
PDF Form Shared Files - Acrobat.com
Here is the tab delimited file I am trying to use (well the format anyway).
Test Data File Shared Files - Acrobat.com
Adam
Thanks Pat Willener -
How to extract a tab delimiter file on appli server in openhub destination
Hi All,
in my scenario i want download a file on application server in tab delimiter file where iam not able to do it.while creating OHD iam selecting seperator feild has ';'(semicolan).tab delimiter fule format is not posible with semicolan and even i tried it with "comma" also but not getting the tab delimiter formate.please help how to get that particular format..
thanks
vamshi..Hi Dashyam,
May help you:----
with comma delimiter file read
I want to download comma delimiter file on to presentation server from inte
http://wiki.sdn.sap.com/wiki/display/ABAP/UploadaCommaDelimitedCSVfilethatcontainscommasindata+fields
Regards,
Suman -
Reading in a tab delimited file
I have the following table in oracle 9i:
arc_book
arc_id, arc_title, arc_publisher, arc_release_date
And a tab delimited file called smc_book. Here is how the smc_book tab delimited file looks like:
smc_id smc_title smc_publisher smc_release_date
1234 "Beautiful Wonder" "Wrox Books" 1/1/1999
2356 "Master PL/SQL" "OReilly Media" 6/5/2004
5432 "Harry Potter and Goblet of Fire" "Simon & Shuster" 2/4/2001
What I want to do is create a lookup table where I matchup the records that are the same book in the smc_book file and arc_book table.
So the lookup table would look like:
lookup
smc_id, arc_id, arc_title, arc_publisher
When I read in the smc_book file I don't want to re-add books that have already been added to the lookup table.
Also when I am matching up the books in the smc_book file and arc table I want to make sure it gets all similar book titles that have the same publisher and release date because the book title, publisher are not exactly the same in both table. For example with data:
smc_book file:
smc_id smc_title smc_publisher smc_release_date
1234 "Beautiful Wonder" "Wrox Books" 1/1/1999
2356 "Master PL/SQL" "OReilly Media" 6/5/2004
5432 "Harry Potter and Goblet of Fire" "Simon & Shuster" 2/4/2001
arc_book table:
arc_id arc_title arc_publisher arc_release_date
1245 "Wonder, Beautiful" "Wrox" 1/1/1999
1244 "The PL-SQL, Master" "Media, OReilly" 6/5/2004
4352 "Golbet of Fire, Harry Potter" "Simon and Shuster" 2/4/2001
So I want to match up "Beautiful Wonder" in the smc_book file with "Wonder, Beautiful" in the arc_book table even though the title and publisher data is not exact.
I would really appreciate it if someone could help me out.
Thanks
Robertwell you can use sql loader utility to load the data in your file in some temp table and use that temp table as a base for your comparisons,
other way around is to use external tables
sql loader:
http://www.orafaq.com/faqloadr.htm
http://www.oreilly.com/catalog/orsqlloader/chapter/ch01.html
external tables
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2153251 -
Attaching a tab delimited file to mail
Hi,
I have to attach a tab delimited file to a mail and sent it using Function Module 'SO_DOCUMENT_SEND_API1'.
I have filled in the following details but i am not sure about what should be given for 'lt_packing_list-doc_type'. Should it be a 'TXT 'or any other file format. Some one has suggested me a 'CSV' but i guess for that the data should be separated by a comma and i need a tab delimited file.
Please suggest me what needs to be done.
Thank you,
Taher
DATA:
con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
LOOP AT gt_output INTO ls_output.
CONCATENATE ls_output-email
ls_output-pos
ls_output-txt
ls_output-func
ls_output-mail
INTO gt_attach SEPARATED BY con_tab.
CONCATENATE con_cret gt_attach INTO gt_attach.
CONDENSE gt_attach.
APPEND gt_attach.
* Fill the document data.
lv_xdocdata-doc_size = 1.
* Populate the subject/generic message attributes
lv_xdocdata-obj_langu = sy-langu.
lv_xdocdata-obj_name = 'SAPRPT'.
lv_xdocdata-obj_descr = 'Report' .
* Fill the document data and get size of attachment
CLEAR lv_xdocdata.
READ TABLE gt_attach INDEX lv_xcnt.
lv_xdocdata-doc_size =
( lv_xcnt - 1 ) * 255 + STRLEN( gt_attach ).
lv_xdocdata-obj_langu = sy-langu.
lv_xdocdata-obj_name = 'SAPRPT'.
lv_xdocdata-obj_descr = ' Report'.
CLEAR lt_attachment. REFRESH lt_attachment.
lt_attachment[] = gt_attach[].
* Describe the body of the message
CLEAR lt_packing_list. REFRESH lt_packing_list.
lt_packing_list-transf_bin = space.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0. lt_packing_list-body_start = 1.
DESCRIBE TABLE lt_message LINES lt_packing_list-body_num.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
* Create attachment notification
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 1.
lt_packing_list-body_start = 1.
DESCRIBE TABLE lt_attachment LINES lt_packing_list-body_num.
lt_packing_list-doc_type = ?????. "TXT or any other format
lt_packing_list-obj_descr = 'Report'.
lt_packing_list-obj_name = 'Report'.
lt_packing_list-doc_size = lt_packing_list-body_num * 255.
APPEND lt_packing_list.
* Add the recipients email address
LOOP AT gt_receivers INTO ls_receivers.
CLEAR lt_receivers.
lt_receivers-receiver = ls_receivers.
lt_receivers-rec_type = 'U'.
lt_receivers-com_type = 'INT'.
APPEND lt_receivers.
ENDLOOP.Hi Taher,
Which table you populate your data to (CONTENTS_BIN,CONTENTS_TXT,CONTENTS_HEX) ?.
As both the message and attachment reside one table (contents_txt) in it_packing_list body of message should start with 1 line, but of an attachment when body of message ends. This is:
* Describe the body of the message
CLEAR lt_packing_list. REFRESH lt_packing_list.
lt_packing_list-transf_bin = space.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0. lt_packing_list-body_start = 1.
DESCRIBE TABLE lt_message LINES lt_packing_list-body_num.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
* Create attachment notification
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 1.
lt_packing_list-body_start = "start of attachemnt with next line after body of message
Next thing is what I appointed before. Both should be passed as ASCII so in both lt_packing_list-transf_bin = space.
Please see my code.
CONSTANTS: con_cret(2) type c VALUE cl_abap_char_utilities=>cr_lf,
con_tab(2) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
DATA: doc_attr TYPE sodocchgi1,
it_packing_list TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
it_message TYPE TABLE OF solisti1 WITH HEADER LINE,
it_attachment TYPE TABLE OF solisti1 WITH HEADER LINE,
it_txt TYPE TABLE OF solisti1 WITH HEADER LINE,
it_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE.
"Document attributes
doc_attr-obj_name = 'EXT_MAIL'.
doc_attr-obj_descr = 'External test mail'. "title
doc_attr-obj_langu = sy-langu.
doc_attr-sensitivty = 'F'. "functional message
"Message in ASCII (txt) format
APPEND 'This is body message' TO it_message. "message is from 1 to 2
APPEND 'and second line for message.' TO it_message.
APPEND LINES OF it_message TO it_txt.
"Determine how data are distrtibuted to document and attachment
"First line in it_packing describes message body
it_packing_list-transf_bin = space. "ASCII format
it_packing_list-body_start = 1. "message body starts from 1st line
DESCRIBE TABLE it_message LINES it_packing_list-body_num. "lines in it_txt table for message body
it_packing_list-doc_type = 'RAW'.
APPEND it_packing_list.
"Attachment in ASCII (txt) format
CONCATENATE '1first' 'second' 'third' 'fourth' into it_attachment SEPARATED BY con_tab. "first line
CONCATENATE con_cret it_attachment.
APPEND it_attachment.
CONCATENATE '2first' 'second' 'third' 'fourth' into it_attachment SEPARATED BY con_tab. "second line
CONCATENATE it_attachment con_cret into it_attachment.
APPEND it_attachment.
APPEND LINES OF it_attachment TO it_txt.
"Further lines in it_packing describe attachment
CLEAR it_packing_list.
it_packing_list-transf_bin = space. "ASCII format
it_packing_list-body_start = 3.
DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.
it_packing_list-doc_type = 'txt'.
it_packing_list-obj_name = 'Test attachment'.
it_packing_list-obj_descr = 'Title of an attachment'.
it_packing_list-obj_langu = sy-langu.
"size od attachment = length of last line + all remaining lines * 255
READ TABLE it_attachment INDEX it_packing_list-body_num.
it_packing_list-doc_size = STRLEN( it_attachment ) + 255 * ( it_packing_list-body_num - 1 ).
APPEND it_packing_list.
"Receivers
it_receivers-receiver = "some mail address.
it_receivers-rec_type = 'U'. "internet address
it_receivers-com_type = 'INT'. "send via internet
APPEND it_receivers.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_attr
put_in_outbox = 'X'
commit_work = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
packing_list = it_packing_list
* OBJECT_HEADER =
* CONTENTS_BIN =
contents_txt = it_txt
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = it_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.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
* WITH ouput = 'X'
AND RETURN.
ENDIF.
I am using SO01 t-code to see the document and attachemnt.
I am sure when you get rid of the differences with the codes you will get desired result.
Regards
Marcin
Maybe you are looking for
-
Serial-Number for creative Cloud
Hi, I purchased Creative Cloud some days ago, and I can´t get through to the programs without having a serial number. But I know I´m not supposed to need one. I asked the support team for help, and they said i should do this: Open a Finder window. C
-
Using cue points to acrivate movie clips
I'm trying to write a simple piece of ActionScript that I can adapt and re-use easily. (I'm not very good at programming and I've been finding the "help" information very confusing.) I've devised quite an elegant solution, if only I could get it to w
-
All, We have a task of transforming lot of XML payload formats as part of the OSB proxy service to business service calling. I am looking at this link for XQuery Mapper http://download.oracle.com/docs/html/E15866_01/mapper.htm#i1385064 I have downloa
-
DGCServer messages in log... "tried to renew lease"
Hi, I'm running three WL 4.5.2 servers clustered, JDK1.1.7b on Solaris 2.6. Normally the cluster runs just fine, but now I'm beginning to see the following message in all three servers: <DGCserver> tried to ren
-
Mountain Lion - Power Nap Question!
I understand the new ' Power Nap' application in Mountain Lion lets you download all the mails and other updates even Mac is in sleep mode. Do I have to be connected to Internet for automatic downloads? They say Mac adapter only needs to be connected