How to read long line from text file
Hi,
I just faced problem when reading a big text file.
BufferedReader br = new BufferedReader(new FileReader("D:\\afile.txt"));
String str;
int i;
while ((str = br.readLine())!=null)
i++;
//do some work here...
...This code throws exception:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap spaceSo I thought file line is very long. When I opened it in FAR it only displays no more than 4096 characters as a line.
Help me to read a text file that's line is very long?
try,
$ java -X
-Xmixed mixed mode execution (default)
-Xint interpreted mode execution only
-Xbootclasspath:<directories and zip/jar files separated by ;>
set search path for bootstrap classes and resources
-Xbootclasspath/a:<directories and zip/jar files separated by ;>
append to end of bootstrap class path
-Xbootclasspath/p:<directories and zip/jar files separated by ;>
prepend in front of bootstrap class path
-Xnoclassgc disable class garbage collection
-Xincgc enable incremental garbage collection
-Xloggc:<file> log GC status to a file with time stamps
-Xbatch disable background compilation
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size
-Xss<size> set java thread stack size
-Xprof output cpu profiling data
-Xrunhprof[:help]|[:<option>=<value>, ...]
perform JVMPI heap, cpu, or monitor profiling
-Xdebug enable remote debugging
-Xfuture enable strictest checks, anticipating future default
-Xrs reduce use of OS signals by Java/VM (see documentation)
-Xcheck:jni perform additional checks for JNI functions
The -X options are non-standard and subject to change without notice.
Similar Messages
-
How to read a line from a file which contains 45000 characters?
Hi all,
Iam a receiving a .CSV file which contains n number of rows ,each row has a data seperated with delimiter.
These values based on delimiter it is seperated and certain validations are handled.
Iam using UTL_FILE.GET_LINE operator to read the value and store it in a variable which is declared as l_text VARCHAR2(30000).
when we receive a line which contains huge characters say 45000 then it throws an error(Unable to read the file).
Only on rare cases we used to receive these kind of files with huge size.
Kindly help to solve this issues.
Database details.
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Hereby i have tried with long Raw data type but still same error unable to read the file.pls find the sample code below,
declare
l_text LONG RAW;
l_importTypeFile UTL_FILE.FILE_TYPE ;
begin
PKG_COMMON.PROC_FOPEN(g_Directory, P_FILENAME, 'RB',l_importTypeFile, p_error_cd, p_error_msg) ;
UTL_FILE.GET_RAW(l_ImportTypeFile,l_Text);
End;
Thanks in Advance
SivaHi Siva,
Are you trying to use data from this .csv file into your realtion tables. If yes and If you are using 11g Oracle database. I would suggest you create External Tables using the below query,
http://www.oracle.com/technetwork/issue-archive/2011/11-mar/o21nanda-312277.html
STEP1: You need a Directory where your SCHEMA has read/write access. Store the csv file in that directory.
STEP2: Create an EXTERNAL Table script. Please refer the above URL. Examples are for coma delimiter (,); replace it with your pipe (|) in the code
STEP: Once your external table is created you can simply create a relational table as below:
CREATE TABLE relation_table
AS
SELECT * FROM external_table;
Regards,
RaviR -
Read lines from text file to java prog
how can I read lines from input file to java prog ?
I need to read from input text file, line after line
10x !If you search in THIS forum with e.g. read lines from file, you will find answers like this one:
Hi ! This is the answer for your query. This program prints as the output itself reading line by line.......
import java.io.*;
public class readfromfile
public static void main(String a[])
if you search in THIS forum, with e.g. read lines from text file
try{
BufferedReader br = new BufferedReader(new FileReader(new File("readfromfile.java")));
while(br.readLine() != null)
System.out.println(" line read :"+br.readLine());
}catch(Exception e)
e.printStackTrace();
} -
How can I input read a line from a file and output it into the screen?
How can I input read a line from a file and output it into the screen?
If I have a file contains html code and I only want the URL, for example, www24.brinkster.com how can I read that into the buffer and write the output into the screen that using Java?
Any help will be appreciate!
======START FILE default.html ========
<html>
<body>
<br><br>
<center>
<font size=4 face=arial color=#336699>
<b>Welcome to a DerekTran's Website!</b><br>
Underconstructions.... <br>
</font> </center>
<font size=3 face=arial color=black> <br>
Hello,<br>
<br>
I've been using the PWS to run the website on NT workstation 4.0. It was working
fine. <br>
The URL should be as below: <br>
http://127.0.0.1/index.htm or http://localhost/index.htm
<p>And suddently, it stops working, it can't find the connection. I tried to figure
out what's going on, but still <font color="#FF0000">NO CLUES</font>. Does anyone
know what's going on? Please see the link for more.... I believe that I setup
everything correctly and the bugs still flying in the server.... <br>
Thank you for your help.</P>
</font>
<p><font size=3 face=arial color=black>PeerWebServer.doc
<br>
<p><font size=3 face=arial color=black>CannotFindServer.doc
<br>
<p><font size=3 face=arial color=black>HOSTS file is not found
<br>
<p><font size=3 face=arial color=black>LMHOSTS file
<br>
<p><font size=3 face=arial color=black>How to Setup PWS on NT
<BR>
<p><font size=3 face=arial color=black>Issdmin doc</BR>
Please be patient while the document is download....</font>
<font size=3 face=arial color=black><br>If you have any ideas please drop me a
few words at [email protected] </font><br>
<br>
<br>
</p>
<p><!--#include file="Hits.asp"--> </p>
</body>
</html>
========= END OF FILE ===============Hi!
This is a possible solution to your problem.
import java.io.*;
class AddressExtractor {
public static void main(String args[]) throws IOException{
//retrieve the commandline parameters
String fileName = "default.html";
if (args.length != 0) fileName =args[0];
else {
System.out.println("Usage : java AddressExtractor <htmlfile>");
System.exit(0);
BufferedReader in = new BufferedReader(new FileReader(new File(fileName)));
StreamTokenizer st = new StreamTokenizer(in);
st.lowerCaseMode(true);
st.wordChars('/','/'); //include '/' chars as part of token
st.wordChars(':',':'); //include ':' chars as part of token
st.quoteChar('\"'); //set the " quote char
int i;
while (st.ttype != StreamTokenizer.TT_EOF) {
i = st.nextToken();
if (st.ttype == StreamTokenizer.TT_WORD) {
if (st.sval.equals("href")) {
i = st.nextToken(); //the next token (assumed) is the '=' sign
i = st.nextToken(); //then after it is the href value.
getURL(st.sval); //retrieve address
in.close();
static void getURL(String s) {
//Check string if it has http:// and truncate if it does
if (s.indexOf("http://") > -1) {
s = s.substring(s.indexOf("http://") + 7, s.length());
//check if not mailto: do not print otherwise
if (s.indexOf("mailto:") != -1) return;
//printout anything after http:// and the next '/'
//if no '/' then print all
if (s.indexOf('/') > -1) {
System.out.println(s.substring(0, s.indexOf('/')));
} else System.out.println(s);
}Hope this helps. I used static methods instead of encapsulating everyting into a class. -
How to read the data from Excel file and Store in XML file using java
Hi All,
I got a problem with Excel file.
My problem is how to read the data from Excel file and Store in XML file using java excel api.
For getting the data from Excel file what are all the steps i need to follow to get the correct result.
Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
Thanks & Regards,
Sreenu,
[email protected],
india,If you want someone to do your work, please have the courtesy to provide payment.
http://www.rentacoder.com -
How to read every line from a text file???
How can i read every line from my text file ("eka.txt")
now it only reads the first line and prints it out.
What is wrong with this?
import java.io.*;
import java.util.*;
class Testi{
public static void main(String []args)throws IOException {
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
File inputFile = new File ("eka.txt");
FileReader fis =new FileReader(inputFile);
BufferedReader bis = new BufferedReader(fis);
String test=bis.readLine();
String tmp= "";
while((bis.readLine().trim() != null)) {
int spacefound=0;
int l=test.indexOf(" ");
for(int i=0;i<test.length();i++){
char c=test.charAt(i);
if(c!=' ') tmp+=""+c;
if(c==' ' && (spacefound<1) && !(tmp.equals(""))){
tmp+=""+c;
spacefound++;
if(tmp.length()==l) {
System.out.println(tmp);
tmp="";
spacefound=0;
if(tmp.length()<l){
for(int i=0;i<=(l-tmp.length());i++)
tmp+=""+' ';
System.out.println(tmp);Try this code, Hope it servers your purpose.
import java.io.*;
import java.util.*;
class Testi {
public static void main(String []args)throws IOException {
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
File inputFile = new File ("Eka.txt");
FileReader fis =new FileReader(inputFile);
BufferedReader bis = new BufferedReader(fis);
String test=bis.readLine();
while(test != null) {
StringTokenizer st = new StringTokenizer(test," ");
while(st.hasMoreTokens())
System.out.println(st.nextToken());
test = bis.readLine();
}Sudha -
How to read some lines from a text file using java.
hi,
i m new to java and i want to read some lines from a text file based on some string occurrence in the file. This file to be read in steps.
we only want to read the file upto the first Occurrence of "TEXT" string.
How to do it ,,,
Kinldy give the code
Regards,
Sagar
this is the text file
dfgjdjj
sfjhjkd
ghjkdg
hjkdgh TEXT
ikeyt
ujt
jk
tyk TEXT
rukl
rHendawy wrote:
Since the word "TEXT" is formed of 4 letters, you would read the text file 4 bytes by four bytes. Wrong on two counts. First, the file may not be encoded 1 byte per character. It could be utf-16 in which case it would be two byte per character. Second, even if it were 1 byte per character, the string "Text" may not start on a 4 byte boundary.
Consider a FileInputStream object "fis" that points to your text file. use fis.read(byte[] array, int offset, int len) to read every four bytes. Convert the "TEXT" String into a byte array "TEXT".getBytes(), and yous the Arrays class to compare the equality of the read bytes with your "TEXT".getBytes()Wrong since it relies on my second point and will fail when fis.read(byte[] array, int offset, int len) does not read 4 bytes (as is no guaranteed to). Check the Javadoc. Also, the file may not be encoded with the default character encoding.
The problem is easily solved by reading a line at a time using a BufferedReader wrapping an InputStreamReader wrapping a FileInputStream and specifying the correct character encoding.
Edited by: sabre150 on Apr 29, 2009 2:13 PM -
How to handle multiple threads to read one line from a file each time?
Dear Sir or Madam,
I'm new to multiple threads java programming. What I want to do is as following:
1. I'm writing a program to read one line of text from a very large file, and then do some process on this one line of text, then read the next line of text from this file, then process on this line of text, ...... When reach the end of the file, close the file.
This is a single thread scenario.
2. To fullly untilized computer resource, I want to create multiple threads to process this large file.
One thing is very important is that each line of text in the large file has to be read sequentially. This means that the first line of text in the large file is read first, then the second line, then the third line ......
My question is that if I create multiple threads to process the same file, how can I make sure that different threads will read the line of text from the same file sequentially?
I don't have enough experience on java multiple threads programming, so it will be very appreaciated if you can help me on this as soon as you are available.
Thanks and regards,
Steven WuA better solutoin would be to have a single thread that reads each line an puts it into a queue, and then multiple threads reading from the queue to process these lines.
This will only be effective if the amount of processing to be done on each line is very large compared to how long it takes to read the line, or if you have more than one CPU on your machine. -
How to store data into database by reading sql statements from text file
how to write java program for storing data into database by reading sql statements from text file
Step 1: Create a property file to add various queries.
Step 2: Read the properties file using ResourceBundle
Step 3: Use the jdbc to execute the query read from the property file.
So in future if you need to change query no need do any modifications in java program. But depends on how you use the property file. -
How can we read a column from text file
hai,
the Text file contains :
m1 m2 m4 89
m1 m2 m4 89
m0 m4 m2 90
I need one array for each column
m[0]= m1,m1,m0 (first column from text file)
m[1]= m2,m2,m2 (second column from text file)
m[2]= 89,89,90 (third column from text file)
andvance thanksIf a 2D array is OK (instead of 4 separate arrays), try something like this
import java.io.*;
import java.util.ArrayList;
class FileReadColumns
public static void main(String args[]) throws IOException, FileNotFoundException
String line;
ArrayList lines = new ArrayList();
BufferedReader in = new BufferedReader(new FileReader("data.txt"));
while ((line = in.readLine()) != null) lines.add(line);
String bits[];
bits = lines.get(0).toString().split(" ");
String grid[][] = new String[bits.length][];
for(int i=0;i<grid.length;i++)grid[i] = new String[lines.size()];
for(int i = 0; i < lines.size(); i++)
bits = lines.get(i).toString().split(" ");
for(int ii = 0; ii < bits.length; ii++) grid[ii] = bits[ii];
for(int i = 0; i < grid.length; i++)
for(int ii=0;ii<grid[i].length;ii++)System.out.print(grid[i][ii]+" ");
System.out.println();
System.exit(0); -
How to write empty line in text file
hey
i want to insert one empty line in text file.
how to write this.
i declared
data: emptyrec(240) type c value space,
and used
TRANSFER emptyrec to e_file.
but its not inserting empty line in the record.
is there any special way have to do.
ambichan.hai anand,
I am posting the code snippet.
i have commented that transfer line in '----
' like this
pls refer below.
ambichan
DATA: PAGENO(4) TYPE N VALUE 1,
DATAKBN(2) TYPE N VALUE 1,
SUBNO(3) TYPE N VALUE 1,
VPAGENO(4) TYPE C,
VDATAKBN(2) TYPE C,
VSUBNO(3) TYPE C,
VREC(255) TYPE C,
VRECORD(255) TYPE C,
EMPTYREC(255) TYPE C VALUE SPACE,
VCODE(10) TYPE C,
VNAME2(35) TYPE C,
VPAYDAT(10) TYPE C,
VSGTXT(60) TYPE C VALUE SPACE,
VSGTXT1(10) TYPE C,
VKINGAKU(15) TYPE C VALUE SPACE,
VBIKKO(30) TYPE C VALUE SPACE,
VBELNR(10) TYPE C VALUE SPACE,
VDMBTR(15) TYPE C,
VGLT0-KSLVT(15) TYPE C,
VGLT0-TSL01(15) TYPE C,
VGLT0-TSL02(15) TYPE C,
VGLT0-TSL03(15) TYPE C,
VGLT0-TSL04(15) TYPE C,
VGLT0-TSL05(15) TYPE C,
VKIN(15) TYPE C,
VTEGA(15) TYPE C.
FORM FRM_OUTPUT_DATA.
SORT ITAB_OUTPUT_SUMMARY BY LIFNR DTYPE.
SORT ITAB_OUTPUT_ITEMS BY LIFNR DTYPE BELNR.
IF P_DISP = 'X'."checkボクスを選ぶ場合、ファイル作成処理へ行く
OPEN DATASET E_FILE FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC <> 0.
WRITE: 'error',SY-SUBRC.
EXIT.
ENDIF.
LOOP AT ITAB_LIFNR.
PERFORM LISTDATA.
PAGENO = PAGENO + 1.
SUBNO = 1.
ENDLOOP.
CLOSE DATASET E_FILE."ファイルクローズ
ENDFORM. " End of frm_output_data
FORM LISTDATA.
DATA:
WK_PAY_AMOUNT LIKE BSEG-DMBTR, " 純支払額算出用
VWK_PAY_AMOUNT(15) TYPE C,
GLT0-TSL05_VAL LIKE GLT0-TSL05.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 1.
BSIK-DMBTR = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
GLT0-TSL01 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 2. " 区分:2
GLT0-TSL02 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 3. " 区分:3
GLT0-TSL03 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 4. " 区分:4
GLT0-TSL04 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 5. " 区分:5
GLT0-TSL05 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
glt0-tsl05 = glt0-tsl05 + glt0-tsl04.
WK_PAY_AMOUNT = GLT0-TSL05 + GLT0-TSL04.
CHECK WK_SUBRC = 0.
BSEG-KOART = ' '. 情報不要
CLEAR: BSEG-SGTXT, BSEG-DMBTR, TGSBT-GTEXT, BKPF-BELNR.
BSEG-KOART = 'Y'. " フラグ:ヘッダに相殺額を出力
CLEAR: BSAK-DMBTR.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 6. " 区分:6
BSAK-DMBTR = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
WK_PAY_AMOUNT = WK_PAY_AMOUNT - BSAK-DMBTR.
WRITE : / PAGENO,
SUBNO,
DATAKBN,
ITAB_LIFNR-LIFNR,
ITAB_LIFNR-NAME2(25),
P_PAY_T,
GLT0-TSL01,
GLT0-TSL02,
GLT0-TSL03,
GLT0-TSL04,
GLT0-TSL05.
VPAGENO = PAGENO.
VSUBNO = SUBNO.
DATAKBN = 1.
VDATAKBN = DATAKBN.
VCODE = ITAB_LIFNR-LIFNR.
VNAME2 = ITAB_LIFNR-NAME2.
VPAYDAT = P_PAY_T.
VGLT0-TSL01 = GLT0-TSL01.
VGLT0-TSL02 = GLT0-TSL02.
VGLT0-TSL03 = GLT0-TSL03.
VGLT0-TSL04 = GLT0-TSL04.
VGLT0-TSL05 = GLT0-TSL05.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT VKINGAKU
VBIKKO VBELNR VGLT0-TSL01 VGLT0-TSL02 VGLT0-TSL03
VGLT0-TSL04 VGLT0-TSL05 INTO VREC SEPARATED BY ','.
CLEAR: BSAK-DMBTR, BSID-DMBTR, BSAD-DMBTR, BSEG-DMBTR, BSIK-DMBTR,
WK_10 , WK_11 , GLT0-TSL05.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 7. " 区分:7
BSID-DMBTR = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
WK_PAY_AMOUNT = WK_PAY_AMOUNT - BSID-DMBTR.
郵送料の出力処理
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 8. " 区分:8
BSAD-DMBTR = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
WK_PAY_AMOUNT = WK_PAY_AMOUNT - BSAD-DMBTR.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 9. " 区分:9
BSEG-DMBTR = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
WK_PAY_AMOUNT = WK_PAY_AMOUNT - BSEG-DMBTR.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 10.
WK_10 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 11.
WK_11 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
GLT0-TSL05 = WK_PAY_AMOUNT - WK_10 - WK_11.
WK_PAY_AMOUNT = WK_PAY_AMOUNT - GLT0-TSL05.
VWK_PAY_AMOUNT = WK_PAY_AMOUNT.
VKIN = WK_10.
VTEGA = WK_11.
CONCATENATE VREC VWK_PAY_AMOUNT VKIN VTEGA INTO
VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
WRITE :
VWK_PAY_AMOUNT,
WK_10,
WK_11.
WRITE:/.
BSEG-KOART = 'X'. " フラグ:請求金額を出力
LOOP AT ITAB_OUTPUT_ITEMS WHERE LIFNR = ITAB_LIFNR-LIFNR
AND DTYPE = 5. " 区分:5
BSEG-SGTXT = ITAB_OUTPUT_ITEMS-SGTXT. " 明細テキスト
GLT0-KSLVT = ITAB_OUTPUT_ITEMS-DMBTR * WK_RATIO. " 金額
TGSBT-GTEXT = ITAB_OUTPUT_ITEMS-GTEXT. BKPF-BELNR = ITAB_OUTPUT_ITEMS-BELNR.
SUBNO = SUBNO + 1.
VSUBNO = SUBNO.
DATAKBN = 2.
VDATAKBN = DATAKBN.
VGLT0-KSLVT = GLT0-KSLVT.
VBIKKO = TGSBT-GTEXT.
VBELNR = BKPF-BELNR.
VSGTXT1 ='請求金額:'.
CLEAR VRECORD.
CONCATENATE VSGTXT1 BSEG-SGTXT INTO VSGTXT.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
VGLT0-KSLVT VBIKKO VBELNR INTO VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
WRITE :/ VPAGENO,VSUBNO,VDATAKBN,'請求金額:', VSGTXT, VGLT0-KSLVT,
VBIKKO,VBELNR.
ENDLOOP.
CLEAR: BSEG-SGTXT,GLT0-KSLVT,BKPF-BELNR.
LOOP AT ITAB_OUTPUT_ITEMS WHERE LIFNR = ITAB_LIFNR-LIFNR
AND DTYPE = 6. " 区分:6
BSEG-SGTXT = ITAB_OUTPUT_ITEMS-SGTXT. " 明細テキスト
IF ITAB_OUTPUT_ITEMS-SHKZG = CNS_CREDIT. " 金額
GLT0-KSLVT = ITAB_OUTPUT_ITEMS-DMBTR * WK_RATIO.
ELSEIF ITAB_OUTPUT_ITEMS-SHKZG = CNS_DEBIT.
GLT0-KSLVT = ITAB_OUTPUT_ITEMS-DMBTR * WK_RATIO * -1.
ENDIF.
TGSBT-GTEXT = ITAB_OUTPUT_ITEMS-GTEXT. " 事業領域テキスト
BKPF-BELNR = ITAB_OUTPUT_ITEMS-BELNR. " 伝票番号
SUBNO = SUBNO + 1.
VSUBNO = SUBNO.
DATAKBN = 3.
VDATAKBN = DATAKBN.
VGLT0-KSLVT = GLT0-KSLVT.
VBIKKO = TGSBT-GTEXT.
VBELNR = BKPF-BELNR.
VSGTXT1 ='相殺金額:'.
CLEAR VRECORD.
CONCATENATE VSGTXT1 BSEG-SGTXT INTO VSGTXT.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
VGLT0-KSLVT VBIKKO VBELNR INTO VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
concatenate vpageno vsubno vdatakbn
WRITE :/ PAGENO,SUBNO,DATAKBN,'相殺金額',BSEG-SGTXT, GLT0-KSLVT,
TGSBT-GTEXT, BKPF-BELNR.
ENDLOOP.
CLEAR VRECORD.
*Insert empty line.
TRANSFER EMPTYREC TO E_FILE.
DATAKBN = 3.
VDATAKBN = DATAKBN.
SUBNO = SUBNO + 1.
VSUBNO = SUBNO.
VSGTXT ='源泉金額'.
VDMBTR = BSID-DMBTR.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
VDMBTR INTO VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
WRITE :/ PAGENO, SUBNO,DATAKBN, ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
P_PAY_T,'源泉金額', BSID-DMBTR.
CLEAR: VDMBTR, VSGTXT, VRECORD.
SUBNO = SUBNO + 1.
VSUBNO = SUBNO.
VSGTXT = '郵送料'.
VDMBTR = BSAD-DMBTR.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
VDMBTR INTO VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
WRITE :/ PAGENO, SUBNO,DATAKBN,ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
P_PAY_T,'郵送料', BSAD-DMBTR.
CLEAR: VDMBTR, VSGTXT, VRECORD.
SUBNO = SUBNO + 1.
VSUBNO = SUBNO.
VSGTXT = '振込み手数料'.
VDMBTR = BSEG-DMBTR.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
VDMBTR INTO VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
CLEAR: VDMBTR, VSGTXT, VRECORD.
WRITE :/ PAGENO,SUBNO,DATAKBN,ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
P_PAY_T,'振込み手数料',BSEG-DMBTR.
*その他の支払いの処理
SUBNO = SUBNO + 1.
VSUBNO = SUBNO.
VSGTXT = 'その他の支払い'.
VDMBTR = GLT0-TSL05.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
VDMBTR INTO VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
WRITE :/ PAGENO,SUBNO,DATAKBN,ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
P_PAY_T, 'その他の支払い',GLT0-TSL05.
glt0-tsl05.
ULINE.
CLEAR: VREC, VRECORD,VCODE,VNAME2,VPAYDAT,VSGTXT,VSGTXT1,VKINGAKU.
CLEAR: VBIKKO,VBELNR,VDMBTR,VGLT0-KSLVT,VGLT0-TSL01,VGLT0-TSL02.
CLEAR: VGLT0-TSL03,VGLT0-TSL04,VGLT0-TSL05,VKIN,VTEGA,VWK_PAY_AMOUNT.
ENDFORM. -
Reading first word from text file
Hello all,
I created a program which I can type in a line and store it into a file. What I need my next program to do is read and display just the first word from each line on the text file.
Here is what I have:
import java.io.*;
public class ReadFromFile
public static void main (String args[])
FileInputStream firstWord;
try
// Open an input stream
firstWord = new FileInputStream ("FileofWords.txt");
// Read a line of text
System.out.println( new DataInputStream(firstWord).readLine() );
// Close our input stream
firstWord.close();
System.err.println ("Unable to read from file");
System.exit(-1);
}what i would like is my program to get the first word of every line and put it in my array.
This is what i have attempted.
import java.io.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
public class testing {
String[] tmp = new String [2];
String str;
public void programTest()
try
BufferedReader in2 = new BufferedReader(new FileReader("eventLog.log"));
while ((str = in2.readLine()) != null)
tmp = str.split(" ");
System.out.println(tmp[0]);
catch(IOException e)
System.out.println("cannot read file");
public static void main(String[] args)
testing B = new testing();
B.programTest();
}//end classAny help is most appreciated -
How to read a byte[] from a file
Hi can someone help me to read a byte[] from a file. I need to save a byte[] to a file and then retrieve it later can someone help in this..
Thanxthere are actually docs on the classes ByteArrayInputStream and ByteArrayOutputStream here:
http://java.sun.com/javase/6/docs/api/
go there (copy & paste in browser) and text search for the above classes.
Then read into it. That way, you will come to a better comprehension of the entire thing. You may as well want to read this:
http://java.sun.com/docs/books/tutorial/essential/io/index.html
And for the future: if you have general problems, search API docs and tutorials first and solve them yourself. The guys around here can get pretty annoyed about "Teach me the entire Java Thing" (also called "someone do my homework") requests.
If you have a special problem, ie an Exception you don?t understand or a method wich you don?t know how it works, everybody will like to help you.
Only few real serial killers frequent these forums. -
How to upload schedule line from flat files to sap file
dear all,
i want to upload the schedule lines from flat files to sap schedulle lines
but the flat files have 15 schedule lines and the data is as per date
so how to upload that and the fields available in flat files are more than the sap screen
we are having more than 6 items
and 15scedule lines its abt 90data to be upload
for one customer in every 15 day
so how to do this
is there any direct use in functional side
with out the help of any abap
but my user will do it
so he need a permanent solution
with regards
subratHi Subrat ,
u can upload the data either ( Master /Transaction) data with the help of lsmw. for that all u need to do is go through the lsmw and do it. in that u can go Batch input recording/ BAPI/ IDOC any of that. here i am sending the LSMW Notes go through it and do the work.
once u create the LSMW project then u can ask the data from user or u can explain the user about the program and can run the flat file to upload the data.
if u require LSMW material Just send me blank mail from u. my mail id is [email protected]
Reward if Helpful.
Regards,
Praveen Kumar.D -
How to find largest number from text file
I am using the "Read from text file" block to read the data from my .txt file into labview. It is now in string format. I have many numbers in the file.
For example:
0.45
0.35
0.12
1.354
1.56
2.89
5.89
0.56
That is what a text file might look like. I want to find which of these numbers is largest, and do calculations with that number. I am having trouble with strings/number formats/arrays, etc. Thanks
Solved!
Go to Solution.The spreadsheet functions and VIs typically work on strings representing numbers separated by delimiters. This is a typical way to save a "spreadsheet" (of numbers) to a text file, for example .csv files. These are quite versatile and powerful functions. Spend a bit of time becoming familiar with them because you may find yourself using them a lot.
Lynn
Maybe you are looking for
-
Creative Cloud Packager fails when downloading Media Encoder 7.2.2 update
Hi all, I am wondering if anyone else is seeing this. I am attempting to use CCP 1.4 (Macintosh platform) to build a package for deployment to the Macs in our department. It is failing, specifically, when trying to download the Adobe Media Encoder 7.
-
Get values in dropdown field based on f4 help in another field
Hi Experts, How to Get values in dropdown field based on another field which is F4 Help. If I select one value in f4 help field(ex: 1) I need to get values in dropdown field (ex:a, b, c),If I select another value in f4 help (ex:2) I need to populate
-
New command for radius-server source-ports
I am trying to find the new command fro radius-server source-ports 1645-1646 since it appears to be depricated. We use tacacs so we do not have the radius server specified but we do need to put in the ports. Can someone please tell me the new comma
-
Using Magento Commerce 1.2 with Firefox v 3.0.19, and going in to edit a product in the admin, you are able to select the product categories you want the product to show in. The categories show up in outline format (subcategories are indented below t
-
REPLACE() whit a inverted commas
Hi All How do I use the Replace() function to replace inverted commas ( " ) character in a string . I tried to update: UPDATE tmp_pos SET address = REPLACE(address,'"'); But it not updates anything .