Delimited File - Double lines, Delimiter At End
I just installed Patch 9 for Forms and Reports. I have rebuilt my forms and reports.
I get a good PDF preview, but when I use Generate to file... Delimited... the resulting file has a delimiter at the end of each line and the lines are doubled(?); there is a description field that looks ok and then the numeric data which looks wrong on the extra lines.
In addition, any way to use delimiter_hdr=no in the Generate to file... in the preview window?
It turns out that driving the report with different parameters (DESFORMAT=DELIMITED, DESTYPE=FILE, etc.) and skipping the preview, I get the correct results. It looks like the trailing delimiter is still there, but I don't get double lines.
Generate to file seems to be broken, unless there is something in my report that makes preview/generate different than using the command line parameters.
Similar Messages
-
How to skip line for delimited file type?
Hi, i wanna ask how to skip (example: the first two line) for delimited file type?
Thanks...
Here is my script
Function NY_Skip06Center [strField, strRecord]
' FDM DataPump Import Script:
'Created by: FDM_Admin
'Date created: 2/28/2006
Dim strEntity
'Check first two characters of entity
For strEntity = 1 to 6
'Skip line
Res.PblnSKip = True
Next strEntity
End if
End Function
But it returns this error when imported
Error: An error occurred importing the file.
Detail: Object variable or With block variable not set
Anyone knows what's wrong
Edited by: user649207 on Mar 19, 2010 2:15 AM
Edited by: user649207 on Mar 19, 2010 3:04 AMstrAcc = DW.Utilities.fParseString (strField, 1, 1, chr(9))
I didn't look closely enough last time. The above is illogical. The parsestring function parses a string based on a delimiter.
The function has these arguments:
String to Parse
How many fields are in the string
The parsed field to return
Field delimiter
In the above, strField is returning the field specified in your import format. You are also saying that there is a total of 1 field. If that were the case, you wouldn't need to parse anything.
I am guessing that your call needs to look something more like this:
strAcc = DW.Utilities.fParseString (*strRecord*, *8*, 1, chr(9))
Make sense?
If not, maybe you can include a few sample lines from your data file and that will make it easier to help you.
Is your import format fixed or delimited? -
Large line to internal tables from tab delimited file
Dear All
I am trying to upload the large file of tab delimited data into a SAP internal table. I am basically stuck with the fact that there are multiple lines and multiple columns in tab delimited file. There are around 300 columns which are tab delimited and separated
For e.g (* indicates tab)
1material*****************1**9888**********5**********34*********3*********346************************-->upto 5000 columns
1material*****************1**99338************4***********************************6************7************-->upto 5000 columns
1material*****************1**22888********************5*********7*********************6*****7**************-->upto 5000 columns
1material*****************1**44844************************5***5*********************************************-->upto 5000 columns
1material***********34****1**54*******33********33*****33**************************************************-->upto 5000 columns
1material*****************1**99888*****************************************************************************-->upto 5000 columns
below upto 500 rows or more
I want to read this file into a columner internal table.
I am trying several ways . I have file on APP server. However Line breaks after 1024 characters or comes on another line.
Currently I am not able to load it in single line of internal table. The structure of file is dynamic .. not static
AmolHi Amolsonaikar,
you may try like this:
TYPES:
begin of line,
t_field type table of string,
end of line,
t_line type table of line.
DATA:
lt_line type t_line,
lv_line type string,
lt_field type table of string.
open dataset 'XYZ' for input in text mode encoding default.
while sy-subrc = 0.
read dataset into lv_line.
split lv_line at '|' into lt_field.
append lt_field to lt_line.
endwhile.
Regards,
Clemens -
Feature request : import of multi-line notes in CSV or tab-delimited file
This is a feature request to the AddressBook development team:
Following a question posted here and asked to support (thanks to Barry and Julia from ADC), it turns out that AddressBook is not ready yet to import multi-line notes from a CSV or tab-delimited file.
I would like to kindly suggest the AddressBook development team to update the import methods for such flat files to parse the text of what is assigned to the Notes field, and convert documented escape sequences to their pre-determined corresponding special character.
I would think that the following would be pretty easy to implement, and easy for the targeted audience (enthousiasts power-users and up) to remember:
"\n " : mark a new line (same as ^p in Word)
"\t " : replace by a tab
I would keep the trailing space to avoid problems with DOS-type file path problems.
and of course...
"\\n " and "\\t " for whoever would want to import notes about \n and \t
For example, in a Notes column, the text:
"Escape sequence \\n :\n move the text to a new line\n \n while escape sequence \\t :\t move the text to the next horizontal tab"
would give the following (just consider text between <Note> marks):
<Note>
Escape sequence \n:
move the text to a new line
while escape sequence \t: move the text to the next horizontal tab
</Note>
Thanks for reading...
Frédéric DenisThe developers do not necessarily read these USER discussion pages. If you want to make suggestions and know they will be read (which is at least a step towards implementation) use the OS X feedback page.
AK -
Delimited file, jsp front end browse, insert into oracle db.
Hey all. I know I've seen this around somewhere, and instead of me rewriting the whole thing, I thought I would try and find it. If someone else knows where I could find it please let me know. We have some delimited files that we would like to upload into or Oracle DB (10g). Simple jsp front end browse for the file and upload it. Would like to be able to choose what type of file, and the delimiter type. Also, we have SQL Loader, but I am not sure how to integrate that.
Thanks in advance
orozcomYeah, I think I will just create a java/jsp app to do this. I just found out that the data does not need to be saved. The info that is going into this table is a schedule for a university. The schedule will be upload like every time they have changes, or every semester.
So I think I will do is just create a new table each time, or I could just clear the table each time. I don't know yet. This seems like an easy way of doing it. If there is already something out there that I could modify then that would be great. If not I could easily write this program tonight.
orozcom -
Detecting line-breaks within a column of an uploaded tab-delimited file.
Suppose you upload a tab-delimited file from your laptop and split each row of the file into some structure that you append to an itab.
Is there a way inside ABAP to detect that a field of the uploaded file has a CR or CRLF in it? And if so, where it is ?
Thanks in advance ...You can use any of the following for those char.
DATA: head_crnl(1) TYPE c VALUE cl_abap_char_utilities=>cr_lf,
top_crnl(1) TYPE c VALUE cl_abap_char_utilities=>cr_lf,
end_crnl(1) TYPE c VALUE cl_abap_char_utilities=>cr_lf,
blank_crnl(1) TYPE c VALUE cl_abap_char_utilities=>cr_lf,
final_crnl(1) TYPE c VALUE cl_abap_char_utilities=>cr_lf,
first_pgbr(1) TYPE c VALUE cl_abap_char_utilities=>form_feed.
Declare the above variables and check if they occur in the file. Hope this helps. -
Upload tab-delimited file from the application server to an internal table
Hello SAPients.
I'm using OPEN DATASET..., READ DATASET..., CLOSE DATASET to upload a file from the application server (SunOS). I'm working with SAP 4.6C. I'm trying to upload a tab-delimited file to an internal table but when I try load it the fields are not correctly separated, in fact, they are all misplaced and the table shows '#' where supposedly there was a tab.
I tried to SPLIT the line using as separator a variable with reference to CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB but for some reason that class doesn't exist in my system.
Do you know what I'm doing wrong? or Do you know a better method to upload a tab-delimited file into an internal table?
Thank you in advance for your help.Try:
REPORT ztest MESSAGE-ID 00.
PARAMETER: p_file LIKE rlgrap-filename OBLIGATORY.
DATA: BEGIN OF data_tab OCCURS 0,
data(4096),
END OF data_tab.
DATA: BEGIN OF vendor_file_x OCCURS 0.
* LFA1 Data
DATA: mandt LIKE bgr00-mandt,
lifnr LIKE blf00-lifnr,
anred LIKE blfa1-anred,
bahns LIKE blfa1-bahns,
bbbnr LIKE blfa1-bbbnr,
bbsnr LIKE blfa1-bbsnr,
begru LIKE blfa1-begru,
brsch LIKE blfa1-brsch,
bubkz LIKE blfa1-bubkz,
datlt LIKE blfa1-datlt,
dtams LIKE blfa1-dtams,
dtaws LIKE blfa1-dtaws,
erdat LIKE lfa1-erdat,
ernam LIKE lfa1-ernam,
esrnr LIKE blfa1-esrnr,
konzs LIKE blfa1-konzs,
ktokk LIKE lfa1-ktokk,
kunnr LIKE blfa1-kunnr,
land1 LIKE blfa1-land1,
lnrza LIKE blfa1-lnrza,
loevm LIKE blfa1-loevm,
name1 LIKE blfa1-name1,
name2 LIKE blfa1-name2,
name3 LIKE blfa1-name3,
name4 LIKE blfa1-name4,
ort01 LIKE blfa1-ort01,
ort02 LIKE blfa1-ort02,
pfach LIKE blfa1-pfach,
pstl2 LIKE blfa1-pstl2,
pstlz LIKE blfa1-pstlz,
regio LIKE blfa1-regio,
sortl LIKE blfa1-sortl,
sperr LIKE blfa1-sperr,
sperm LIKE blfa1-sperm,
spras LIKE blfa1-spras,
stcd1 LIKE blfa1-stcd1,
stcd2 LIKE blfa1-stcd2,
stkza LIKE blfa1-stkza,
stkzu LIKE blfa1-stkzu,
stras LIKE blfa1-stras,
telbx LIKE blfa1-telbx,
telf1 LIKE blfa1-telf1,
telf2 LIKE blfa1-telf2,
telfx LIKE blfa1-telfx,
teltx LIKE blfa1-teltx,
telx1 LIKE blfa1-telx1,
xcpdk LIKE lfa1-xcpdk,
xzemp LIKE blfa1-xzemp,
vbund LIKE blfa1-vbund,
fiskn LIKE blfa1-fiskn,
stceg LIKE blfa1-stceg,
stkzn LIKE blfa1-stkzn,
sperq LIKE blfa1-sperq,
adrnr LIKE lfa1-adrnr,
mcod1 LIKE lfa1-mcod1,
mcod2 LIKE lfa1-mcod2,
mcod3 LIKE lfa1-mcod3,
gbort LIKE blfa1-gbort,
gbdat LIKE blfa1-gbdat,
sexkz LIKE blfa1-sexkz,
kraus LIKE blfa1-kraus,
revdb LIKE blfa1-revdb,
qssys LIKE blfa1-qssys,
ktock LIKE blfa1-ktock,
pfort LIKE blfa1-pfort,
werks LIKE blfa1-werks,
ltsna LIKE blfa1-ltsna,
werkr LIKE blfa1-werkr,
plkal LIKE lfa1-plkal,
duefl LIKE lfa1-duefl,
txjcd LIKE blfa1-txjcd,
sperz LIKE lfa1-sperz,
scacd LIKE blfa1-scacd,
sfrgr LIKE blfa1-sfrgr,
lzone LIKE blfa1-lzone,
xlfza LIKE lfa1-xlfza,
dlgrp LIKE blfa1-dlgrp,
fityp LIKE blfa1-fityp,
stcdt LIKE blfa1-stcdt,
regss LIKE blfa1-regss,
actss LIKE blfa1-actss,
stcd3 LIKE blfa1-stcd3,
stcd4 LIKE blfa1-stcd4,
ipisp LIKE blfa1-ipisp,
taxbs LIKE blfa1-taxbs,
profs LIKE blfa1-profs,
stgdl LIKE blfa1-stgdl,
emnfr LIKE blfa1-emnfr,
lfurl LIKE blfa1-lfurl,
j_1kfrepre LIKE blfa1-j_1kfrepre,
j_1kftbus LIKE blfa1-j_1kftbus,
j_1kftind LIKE blfa1-j_1kftind,
confs LIKE lfa1-confs,
updat LIKE lfa1-updat,
uptim LIKE lfa1-uptim,
nodel LIKE blfa1-nodel.
DATA: END OF vendor_file_x.
FIELD-SYMBOLS: <field>,
<field_1>.
DATA: delim TYPE x VALUE '09'.
DATA: fld_chk(4096),
last_char,
quote_1 TYPE i,
quote_2 TYPE i,
fld_lth TYPE i,
columns TYPE i,
field_end TYPE i,
outp_rec TYPE i,
extras(3) TYPE c VALUE '.,"',
mixed_no(14) TYPE c VALUE '1234567890-.,"'.
OPEN DATASET p_file FOR INPUT.
DO.
READ DATASET p_file INTO data_tab-data.
IF sy-subrc = 0.
APPEND data_tab.
ELSE.
EXIT.
ENDIF.
ENDDO.
* count columns in output structure
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
columns = sy-index.
ENDDO.
* Assign elements of input file to internal table
CLEAR vendor_file_x.
IF columns > 0.
LOOP AT data_tab.
DO columns TIMES.
ASSIGN space TO <field>.
ASSIGN space TO <field_1>.
ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
SEARCH data_tab-data FOR delim.
IF sy-fdpos > 0.
field_end = sy-fdpos + 1.
ASSIGN data_tab-data(sy-fdpos) TO <field_1>.
* Check that numeric fields don't contain any embedded " or ,
IF <field_1> CO mixed_no AND
<field_1> CA extras.
TRANSLATE <field_1> USING '" , '.
CONDENSE <field_1> NO-GAPS.
ENDIF.
* If first and last characters are '"', remove both.
fld_chk = <field_1>.
IF NOT fld_chk IS INITIAL.
fld_lth = strlen( fld_chk ) - 1.
MOVE fld_chk+fld_lth(1) TO last_char.
IF fld_chk(1) = '"' AND
last_char = '"'.
MOVE space TO fld_chk+fld_lth(1).
SHIFT fld_chk.
MOVE fld_chk TO <field_1>.
ENDIF. " for if fld_chk(1)=" & last_char="
ENDIF. " for if not fld_chk is initial
* Replace "" with "
DO.
IF fld_chk CS '""'.
quote_1 = sy-fdpos.
quote_2 = sy-fdpos + 1.
MOVE fld_chk+quote_2 TO fld_chk+quote_1.
ELSE.
MOVE fld_chk TO <field_1>.
EXIT.
ENDIF.
ENDDO.
<field> = <field_1>.
ELSE.
field_end = 1.
ENDIF.
SHIFT data_tab-data LEFT BY field_end PLACES.
ENDDO.
APPEND vendor_file_x.
CLEAR vendor_file_x.
ENDLOOP.
ENDIF.
CLEAR data_tab.
REFRESH data_tab.
FREE data_tab.
Rob -
Import text into a form from a tab delimited file using an action
Good evening.
I am using Adobe Acrobat XI Pro
I have been working all weekend so far on this, and have tried many options.
What I am wanting is to import a line of data from an excel file into a form, save the file with a name drived from the form fields, close the new file, then go back to the original file, import a line of data, and so on and so on.
I had all of this working in livecyle with a tool, but now that we are going to Windows 8 and Microsoft Office 2013, the driver that I need to load the excel file into the form is not available--so now I have to redo the forms in Adobe and import using a tab delimited file.
I would like to do this with an action.
Thus far, I have the following.
**Credit goes to George Johnson who helped me with the script to save the file using field names a few months ago**
To start, I have a folder level script
mySaveAs = app.trustPropagatorFunction(function(doc,path)
app.beginPriv();
var myDoc = event.target;
myDoc.saveAs(path);
app.endPriv();
myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path)
//privileged and/or non-privileged code above
app.beginPriv();
mySaveAs(doc, path);
app.endPriv
//Privileged and/or non-privileged code below
For the Action, I start with the Form file loaded
Then I execute a javascript to import the text into the file.
this.importTextData("/c/data/clerical.txt");
The next step is to save the file using field names as part of the file name
--credit goes to George Johnson who assisted me with this on a similar project a few months ago.
//Get the Field Value
var fn=getField("Last").valueAsString + "-" + getField("First").valueAsString;
//Specify the folder
var fldr = "/c/data/";
//Determine the full path
var fp=fldr + fn + ".pdf";
//save the file
myTrustedSpecialTaskFunc(this, fp);
That is as far as I have gotten.
What I want to do now is load the original form file, import the next line into the form, save the file, repeat.
If anyone could assist me, I would greatly appreciate it.
**note I had to type this from my I-pad because I kept getting kicked off the internet from my computer. I hope my code is typed correctly.George
Thank you so much for your response.
Yes--there are multiple lines in the data file--it will vary from month to month. It looks like from what you are saying is that I need to do the global variable since it will constantly change, and then increment it as it goes through the text file. When it reaches the end, then it will stop.
I looked at the following links--but this is from Adobe 9 API--I don't know if things have changed with XI--especially since 9 used batch processing and XI has actions.
Count PDF Files
http://help.adobe.com/livedocs/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/js/html/ wwhelp.htm?href=JS_API_AcroJS.88.1.html
Global counter
http://help.adobe.com/livedocs/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/js/html/ wwhelp.htm?href=JS_API_AcroJS.88.1.html
I am not exactly sure how to include this in my code.
If you could point me in the right direction, I would appreciate it. -
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? -
UPLOADING tab delimited file onto FTP server
Hello all
Can i upload a tab delimited file onto the FTP server. If yes then how
points guranteed if answered!!Hi,
Yes you can do this one .. you can have a look at the standard program 'RSEPSFTP'.
REPORT ZFTPSAP LINE-SIZE 132.
DATA: BEGIN OF MTAB_DATA OCCURS 0,
LINE(132) TYPE C,
END OF MTAB_DATA.
DATA: MC_PASSWORD(20) TYPE C,
MI_KEY TYPE I VALUE 26101957,
MI_PWD_LEN TYPE I,
MI_HANDLE TYPE I.
START-OF-SELECTION.
*-- Your SAP-UNIX FTP password (case sensitive)
MC_PASSWORD = 'password'.
DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
*-- FTP_CONNECT requires an encrypted password to work
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
ID 'DSTLEN' FIELD MI_PWD_LEN.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
*-- Your SAP-UNIX FTP user name (case sensitive)
USER = 'userid'
PASSWORD = MC_PASSWORD
*-- Your SAP-UNIX server host name (case sensitive)
HOST = 'unix-host'
RFC_DESTINATION = 'SAPFTP'
IMPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
CHECK SY-SUBRC = 0.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = MI_HANDLE
COMMAND = 'dir'
TABLES
DATA = MTAB_DATA
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
LOOP AT MTAB_DATA.
WRITE: / MTAB_DATA.
ENDLOOP.
ELSE.
* do some error checking.
WRITE: / 'Error in FTP Command'.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
OTHERS = 1.
Regards
Sudheer -
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. -
SQL-Loader Control file for Tab-delimited fields
i want to import a text-file with TAB-DELIMITED fields and a line-break + return at the end of each record.
a want to do this by sql-loader and a control file.
please, can someone give me the statement:
e.g.
load data
infile 'exaple.txt' .......
(...field1, field2,....)
thank you very muchCase Study 3: Loading a Delimited, Free-Format File
http://otn.oracle.com/pls/db92/db92.to_URL?urlname=http:%2F%2Fdownload-west.oracle.com%2Fdocs%2Fcd%2FB10501_01%2Fserver.920%2Fa96652%2Fch10.htm%231006907
Modify the example and use 'terminated by whitespace' instead
For more information on TERMINATED Fields see
http://otn.oracle.com/pls/db92/db92.to_URL?remark=drilldown&urlname=http:%2F%2Fdownload-west.oracle.com%2Fdocs%2Fcd%2FB10501_01%2Fserver.920%2Fa96652%2Fch06.htm%231013838 -
How to read and parse a comma delimited file? Help
Hi, does anyone know to read and parse a comma delimited file?
Should I use StreamTokenizer, StringTokenizer, or the oro RegEx packages?
What is the best?
I have a file that has several lines of data that is double-quoted and comma delimited like:
"asdfadsf", "asdfasdfasfd", "asdfasdfasdf", "asdfasdf"
"asdfadsf", "asdfasdfasfd", "asdfasdfasdf", "asdfasdf"
Any help would be greatly appreciated.
thanks,
Spackimport java.util.*;
import java.io.*;
public class ResourcePortalParser
public ResourcePortalParser()
public Vector tokenize() throws IOException
File reportFile = new File("C:\\Together5.5\\myprojects\\untitled2\\accessFile.txt");
Vector tokenVector = new Vector();
StreamTokenizer tokenized = new StreamTokenizer(new FileReader(reportFile));
tokenized.eolIsSignificant(true);
while (tokenized.nextToken() != StreamTokenizer.TT_EOF)
switch(tokenized.ttype)
case StreamTokenizer.TT_WORD :
System.out.println("Adding token - " + tokenized.sval);
tokenVector.addElement(tokenized.sval);
break;
return tokenVector;
[\code] -
could someone please provide a sample code of how to upload a text "|" delimited file into SAP internal structure? i used GUI_upload with field_separator but didn't work. many thanks.
HI Voo,
i think this is the FM you are looking for..
see the sample functionality ..
DATA: BEGIN OF itab OCCURS 0,
vbeln LIKE vbak-vbeln,
ernam LIKE vbak-ernam,
END OF itab.
DATA itab2 LIKE TABLE OF KCDE_CELLS WITH HEADER LINE.
CALL FUNCTION 'KCD_CSV_FILE_TO_INTERN_CONVERT'
EXPORTING
i_filename = 'D:dataupl.txt'
i_separator = '|'
tables
e_intern = itab2
* EXCEPTIONS
* UPLOAD_CSV = 1
* UPLOAD_FILETYPE = 2
* OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT itab2.
SPLIT itab2-value AT '|' INTO itab-vbeln itab-ernam.
APPEND itab.
CLEAR itab.
ENDLOOP.
And the file: upl.txt
12345|text
12346|text2
12347|text3
regards
satesh -
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
-
Getting the bounds of a drawn image on a panel
Hello, I have a problem with getting the bounds of a drawn image on a panel...Since it is drawn as graphics, i tried getClipBounds and since my class extends JPanel i tried to get the bounds from the panel but neither of them worked properly. It only
-
Give me information on user mapping in EP
Hi we are using Ep7.0 with backend ECC 6.0 and we have LDAP server for SSO. Here my question is: Is there any automated process for mapping EP user with backend user. Note: our ume datasource is config as LDAP readonly and DB. rgds..
-
Volume Control on Satellite Pro A200 with Ubunutu 7.10
I have a Satellite Pro A200GE-1F9 which I have recently made dual boot with Vista and Ubuntu 7.10. This is the first time I have used Linux and most things are going well so far. However, the volume control (a scroll wheel on the front of the laptop)
-
Space Bar doesn't play after paste in Pro 7.4.5
I am trying to sync up a sound file with a video file in QT Pro, and every time I paste the sound file (opt-apl-V), I can no longer play the movie by hitting the space bar. I have to use the mouse and click the play button, which after an hour of hit
-
All-in-one 4620 won't scan in wireless in windows 8.1
got new laptop, windows 8.1, wireless 4620 all-in-one won't scan, not from laptop, not manually