To delete the last line of the internal table
How to delete the last line of the internal table.???????
The list which gets displayed from the internal table adds a dummy line at the last which shows zeros and zeros.all the otheer selections are perfect.i just want to delete the last line which comes as zero zero.is there any way to do it...
Quite Easy......Use Describe command to Count the Total Number of Table Lines, and then Delete the Last Line using Index.
Data L like sy-tabix.
Describe Table Itab Lines L.
Delete itab index L.
Similar Messages
-
How can I search the last line in an internal table?
How can I search the last line in an internal table?
With a describe?? If it is , how can I do that?
Thanks!!Hi shilpa,
it seems to be you are NEW to SDN. welcome. if you want to get solutions to your Questions, you have to post a NEW thread.dont use the existing thread to post your question.
any way i am giving you the solution for your question
LOOP AT ITAB WHERE F1 = <SOME VALUE>
F2 = <SOME VALUE>.
ENDLOOP.
IF SY-SUBRC = 0.
ITAB WILL HAVE THE LAST RECORD which satisfying the given criteria in WHERE clause of LOOP.
write itab <--this ITAB will have the last record.
ENDIF.
regards,
Srikanth.
Message was edited by: Srikanth Kidambi -
I am writing papers for school which have strict page limits so I can't afford to be losing lines at the bottom of a page because Pages thinks it looks better to have a new paragraph start on the next page. It does this automatically and I have to go back and manually format to get the first line of the paragraph to start on the last line of the previous page. This then creates problems down the line when I am editing so I would really like to be able to turn the feature off.
e.g. with Pages auto-formatting
-----page 1-----
Paragraph #1 blah blah
blah blah blah
Paragraph #2 blah blah
blah blah blah
-----page 2-----
Paragraph #3 blah blah
blah blah
e.g. after manual formatting
-----page 1-----
Paragraph #1 blah blah
blah blah blah
Paragraph #2 blah blah
blah blah blah
Paragraph #3 blah blah
-----page 2-----
blah blahChange the keep with next rules in:
Inspector > Text > More > Pagination & Break
Peter -
How to only read the last line in the text file by using BufferedReader ?
Dear all,
Hello, I am new to Java. Do anybody know how to read the last line (this is the last record) in the text file.The method I am now using is reading from the first line until I reach the last line in the text file. Thank you!!
BufferedReader br = new BufferedReader(new FileReader("c:\\sdk1.4.1\\bin\\dbExport.txt"));
DataInputStream in = new DataInputStream(new FileInputStream("c:\\sdk1.4.1\\bin\\dbExport.txt"));
String input;
String firstinput;
String secondinput;
int count=90;
int year=1955;
while ((input = br.readLine()) != null) {
firstinput = input.substring(0, 10);
secondinput = input.substring(10);
String insertStore1 = ("INSERT INTO AUTHORS " +
"VALUES ('" + count + "', '" + firstinput + "', '" + secondinput + "', 1955)");
System.out.println(insertStore1);
int result = stmt.executeUpdate(insertStore1);I suppose you could use a java.io.RandomAccessFile.
-
JSP for Vcard cannot strip carriage return in the last line of the file.
I am using JSP to output a Vcard (http://en.wikipedia.org/wiki/VCard)
The following code works great in Windows but fails on the mac:
<%@ page contentType="text/x-vcard" %><%--
--%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%--
--%><%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %><%--
--%>BEGIN:VCARD
VERSION:2.1
<c:choose><%--
--%><c:when test="${not ((empty param.lan) and (empty param.fin)) }"><%--
--%>N:${param.lan};${param.fin}
FN:${param.fin} ${param.lan}
</c:when><%--
--%><c:otherwise><%--
--%>FN:${param.org}
</c:otherwise><%--
--%></c:choose><%--
--%>ORG:${param.org}
TITLE:${param.title}
TEL;WORK;VOICE:${param.phwork}
ADR;WORK:;;${param.st};${param.city};${param.state};${param.zip};
EMAIL;PREF;INTERNET:${param.email}
REV:20080424T195243Z
<c:out value="${fn:replace('END:VCARD','\\\r','')}" escapeXml="false"/>After some tests, I discovered that Mac (I used Tiger, latest update, not Leopard) needs extra white space and carriage returns stripped off. Once this is achieved, the vcard will automatically import into Address Book. I have followed other forums which advice on using JSP comments as in the code above. But for some strange reason the last line of the JSP outputs an extra carraige return. How do I get rid of the carriage return at the end of the file? the replace function from JSTL is not working.
Edited by: shogo2040 on Dec 18, 2008 7:11 PM : I added more detail to the SubjectI originally had that END:VCARD without any carriage return.
But I still get an extra carriage return at the end when the JSP renders to VCF
I'm using Tomcat running on Linux.
I found this, article which implies (but does not explicitly say) JSP in general adds a newline to the last line:
http://www.caucho.com/resin-3.0/jsp/faq.xtp (But its not tomcat either, so maybe this info is irrelevant).
Edited by: shogo2040 on Dec 22, 2008 3:31 PM - changed rendered to VCF from rendered to JSP -
How to make the last line of the textarea visible all the time?
Hello,
I am making an online chat application in JSP and XHTML. The chat log and online users� names textareas are refreshed every 5 seconds. When it comes to many messages in the chat log textarea, the scrollbar appears. Then, every time the chat log textarea is refreshed, I need to move the scrollbar down to see the last line of the textarea.
Are there any ideas how to make the last line of the textarea visible all the time without moving the scrollbar?
Thanks in advance.
DanI put the below code on the page, but it didn't work.
Are there any ideas? Thanks.
<table border="0" cellspacing="1">
<tr>
<th>Chat Log</th>
<th>Users now online</th>
</tr>
<tr>
<td><textarea rows="20" cols="60" name = "messages" readonly = "readonly"><%= texts %></textarea></td>
<td><textarea rows="20" cols="20" name = "names" readonly = "readonly"><%= names %></textarea></td>
</tr>
</table>
<script type="text/javascript">
<!--
document.messages.scrollIntoView(false);
//-->
</script> -
Please add exit to the last line of the sql script
Hi,
I am executing a sql script from UNIX shell. When I execute it at the command prompt the script executes successfully, but when I schedule the script on cron, the script is throwing an error with the above message
"Please add exit to the last line of the sql script"
Any idea what is happening? Thanks in advance for any help
thedbaIt works check this out..
<< script a.sh >>
logfile=/home/oracle/sri/x.log
sqlplus -s /nolog <<DOC >> ${logfile}
whenever sqlerror exit sql.sqlcode
connect scott/tiger
@a.sql a.log
DOC
<< script a.sql >>
set feedback off
set echo off
spool &1
select * from tab where tname like 'A%';
spool off
exit;
<< a.log >>
TNAME TABTYPE CLUSTERID
AQ$DEF$_AQCALL VIEW
AQ$DEF$_AQERROR VIEW
AQ$_DEF$_AQCALL_F VIEW
AQ$_DEF$_AQERROR_F VIEW
AQ$_INTERNET_AGENTS TABLE
AQ$_INTERNET_AGENT_PRIVS TABLE
AQ$_QUEUES TABLE
AQ$_QUEUE_TABLES TABLE
AQ$_SCHEDULES TABLE
<< x.log >>
TNAME TABTYPE CLUSTERID
AQ$DEF$_AQCALL VIEW
AQ$DEF$_AQERROR VIEW
AQ$_DEF$_AQCALL_F VIEW
AQ$_DEF$_AQERROR_F VIEW
AQ$_INTERNET_AGENTS TABLE
AQ$_INTERNET_AGENT_PRIVS TABLE
AQ$_QUEUES TABLE
AQ$_QUEUE_TABLES TABLE
AQ$_SCHEDULES TABLE-Sri -
Read the last record of an internal table
Hello All,
I need to read the last entry of the internal table? Is it possible to achieve this without using loop - endloop?
In the following example, I need to get the Batch '110776' and store it in a variable.
ITAB:
MATNR|CHARG
010780|110770
010780|110772
010780|110773
010780|110774
010780|110775
010780|110776
Thanks.Use DESCRIBE to get the number of entires in variable last_entry
and then use read table ....index last_entry -
I cant't read the last line in the grid
hello,
I use a grid to display a SQL query with a field-entry
When I loop through the grid, I manage to read all lines except the line or the cursor, it keeps the old value
Do you have an idea
Thank youIt's my code
Shared Sub ItemEvent_Maj_emplacement_lot(ByRef FormUID, ByRef pVal, ByRef BubbleEvent)
Dim EventEnum As SAPbouiCOM.BoEventTypes
EventEnum = pVal.EventType
If pVal.ItemUID = "1" Then
Dim jj As Integer
EventEnum = pVal.EventType
If EventEnum = BoEventTypes.et_CLICK Then
oform = SBO_application.Forms.Item(FormUID)
oitem = oform.Items.Item("MyGrid")
oGrid = oitem.Specific
Dim ColNum = oGrid.Columns.Count
Dim OgridCodeItem As Long
Dim OgridCodeMag As String
Dim OgridCodeLot As String
Dim OgridEmplacement As String
If oGrid.Columns.Count = 0 Then
Exit Sub
End If
For jj = 0 To oGrid.Columns.Count
Try
OgridCodeItem = oGrid.DataTable.GetValue(1, jj)
OgridCodeMag = oGrid.DataTable.GetValue(2, jj)
OgridCodeLot = oGrid.DataTable.GetValue(3, jj)
OgridEmplacement = oGrid.DataTable.GetValue(5, jj)
' This field OgridEmplacement is This field keeps the old value only on the last line before
' On the other lines, it works well
Catch oEx As Exception
' MessageBox.Show(oEx.Message & " jj = " & CStr(jj))
' Exit Sub
End Try
Next jj
End If
End If
End Sub -
As I stated in the title, I use the ScriptInclude command quite extensively, because we have at our company a policy of maintaining one large-ish (roughly 7k lines) function library which is included by various individual evaluation scripts. Debugging this with break points is often the only (useful) way to see into the state of the script, so I depend on them.
My problem is that often when I debug a script calling the function library, setting a break point in that library and running into it during debug mode will not transport the cursor to the location of the current break point, but instead to the very end of the included script. I have noticed this with a separate pair of scripts, as well, which includes a similar size script to call functions from (roughly 2k lines).
Now I wonder if this has to do with the size of the scripts included, or if it is dependent on something else. It seems to not be affected by restarting DIAdem, and sometimes it works as intended, but I have not been able to reliably replicate indivdual occurrences one way or the other.
Has anyone else had this problem happen to them?
Leo Zschokke
Test Engineer C-EPS
ThyssenKrupp Presta AGLeo
I also use scriptincludes extensively, Most of mine are in the range of 500 to 2000 lines. Usually I organize them in logical code topics, I like to use them to hold one class most of the time. When I debug these I can set a breakpoint, and it will stop at that location.
I also use custom log class as well, I find this quite helpful, in the applications that are unattended.
The only thing I can think of to try is to separate the 7k file into 2 2k line files and then script include them separately.
Paul
ps. I sometimes need to have intellisense work from a file that was scriptincluded, this requires copying the file into the end of the main script. (you most likely already know this )
One other note, Are you talking about debuging code in a SUD, that is whole different problem to deal with. -
How to fetch the perticular line of a internal Table
Hi Friends,
I am using Function Module VC_I_GET_CONFIGURATION and I am passing the instance Number.
Now i am getting 18 records in my ITAB.Here from this ITAB i need only ATBEZ = RELAY TYPES & ATBEZ = CASE Records.Only for the mentioned conditions i require the records.
How Can i Proceed.Plz suggest.As CASE is the reserved word and Types also reserved Word.
Plz suggest.Hi,
Thanks for ur Reply and Can i Use Read statement for the same. My requirement is ATBEZ = 'RELAY TYPES' AND 'CASE'.
While Printing in smart form for one item there will be only one Relay type.How can i proceed.
If i write LOOP AT ITAB WHERE ATBEZ = 'RELAY TYPES' or ATBEZ = ' CASE'.
2 records r coming and only the secong recored is appending.First Record will not append.
How can i do.
Plz suggest. -
I want to read the attached file from the second line to the last line befor the first NCOUNT
after i want put it in a array but just the 1.2.3.6.and the 7 column
ex: TIMET 0 1 1 0
after to count how much NCOUNT i have and put the values of every one in long vector or array with one element
Attachments:
file2.txt 204 KBHere's a VI I wrote that should help you out. Since you are wanting to place a string in that array, it will need to be an array of all string. Hope this helps.
J.R. Allen
Attachments:
File_Parser.vi 41 KB -
How to read the last line in a txt file?
Dear all,
I want to read the last line in a txt file. There are thousands of lines in this file. What I want is to move the file pointer directly to the last line of the file. But I did not know how do to it. Can anybody help me out?
Thank you very much!If the file is coded as ASCII or one of the encodings that maps a single byte to a char then the following class will assist you
import java.io.*;
import java.util.*;
public class GetLinesFromEndOfFile
static public class BackwardsFileInputStream extends InputStream
public BackwardsFileInputStream(File file) throws IOException
assert (file != null) && file.exists() && file.isFile() && file.canRead();
raf = new RandomAccessFile(file, "r");
currentPositionInFile = raf.length();
currentPositionInBuffer = 0;
public int read() throws IOException
if (currentPositionInFile <= 0)
return -1;
if (--currentPositionInBuffer < 0)
currentPositionInBuffer = buffer.length;
long startOfBlock = currentPositionInFile - buffer.length;
if (startOfBlock < 0)
currentPositionInBuffer = buffer.length + (int)startOfBlock;
startOfBlock = 0;
raf.seek(startOfBlock);
raf.readFully(buffer, 0, currentPositionInBuffer);
return read();
currentPositionInFile--;
return buffer[currentPositionInBuffer];
public void close() throws IOException
raf.close();
private final byte[] buffer = new byte[4096];
private final RandomAccessFile raf;
private long currentPositionInFile;
private int currentPositionInBuffer;
public static List<String> head(File file, int numberOfLinesToRead) throws IOException
return head(file, "ISO-8859-1" , numberOfLinesToRead);
public static List<String> head(File file, String encoding, int numberOfLinesToRead) throws IOException
assert (file != null) && file.exists() && file.isFile() && file.canRead();
assert numberOfLinesToRead > 0;
assert encoding != null;
LinkedList<String> lines = new LinkedList<String>();
BufferedReader reader= new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding));
for (String line = null; (numberOfLinesToRead-- > 0) && (line = reader.readLine()) != null;)
lines.addLast(line);
reader.close();
return lines;
public static List<String> tail(File file, int numberOfLinesToRead) throws IOException
return tail(file, "ISO-8859-1" , numberOfLinesToRead);
public static List<String> tail(File file, String encoding, int numberOfLinesToRead) throws IOException
assert (file != null) && file.exists() && file.isFile() && file.canRead();
assert numberOfLinesToRead > 0;
assert (encoding != null) && encoding.matches("(?i)(iso-8859|ascii|us-ascii).*");
LinkedList<String> lines = new LinkedList<String>();
BufferedReader reader= new BufferedReader(new InputStreamReader(new BackwardsFileInputStream(file), encoding));
for (String line = null; (numberOfLinesToRead-- > 0) && (line = reader.readLine()) != null;)
// Reverse the order of the characters in the string
char[] chars = line.toCharArray();
for (int j = 0, k = chars.length - 1; j < k ; j++, k--)
char temp = chars[j];
chars[j] = chars[k];
chars[k]= temp;
lines.addFirst(new String(chars));
reader.close();
return lines;
public static void main(String[] args)
try
File file = new File("/usr/share/dict/words");
int n = 10;
System.out.println("Head of " + file);
int index = 0;
for (String line : head(file, n))
System.out.println(++index + "\t[" + line + "]");
System.out.println("Tail of " + file);
int index = 0;
for (String line : tail(file, "us-ascii", n))
System.out.println(++index + "\t[" + line + "]");
catch (Exception e)
e.printStackTrace();
}Note, the EOL characters are treated as line separators so you will probably need to read the last two lines (think about it for a bit). -
Font changes in the last line of paragraph when printing
InDesign CS3 (5.0.2), Dell P4, 3Ghz, 1gb ram
This is a one page document with about half a page of text and some graphics. When printing to HP Laserjet, everything prints fine. When printing to Lanier 2138 color laser, everything prints fine EXCEPT for the last line of the second paragraph.
The text changes to an unrecognizable font. (The rest of the document uses Trebuchet.) It does happen on the line after a hyphenated word, but we've put the entire word on the last line (eliminating the hyphen) and get the same results.
As I mentioned, the entire page prints perfectly to the HP black and white laserjet. It also prints perfectly to the Lanier 2138 *IF* we create a PDF first and THEN send it to the 2138.
I've checked the knowledgebase and searched this forum, but haven't seen anything related to this issue. Any help or ideas is greatly appreciated.
Thanks in advance for your time.
ToddTodd,
That field is the font style field, not a "Paragraph" field. It just happens to be next to the button that changes the control panel to paragraph mode.
Is the file you posted the same one you made the jpeg from, or the one where you changed that field to "regular"? I'm thinking the latter, because the paragraph shows regular when I highlight it. Also, I don't think the font in the jpeg has changed, just it is printing gibberish on that last line.
Try this: File > Export and for type choose Interchange format (.inx). Open that file in InDesign and save again as an InDesign document. See if that prints.
If not, I'd say it's almost certainly the driver.
Peter -
Add a different character to the last line of a loop
Hi,
I'm attempting to use some pl/sql to generate an RMAN copy script. After each line there needs to be comma, but the last line of the loop should have a semi-colon to terminate the statement. How can I do that?
In the example below, the copy for controlfile 3 needs to be a semi-colon, not a comma:
run
SHUTDOWN IMMEDIATE
STARTUP MOUNT
COPY
DATAFILE 1 TO '/u20/oraflash/ORCL1/dbcopy/system01.dbf',
DATAFILE 2 TO '/u20/oraflash/ORCL1/dbcopy/undotbs01.dbf',
DATAFILE 3 TO '/u20/oraflash/ORCL1/dbcopy/drsys01.dbf',
DATAFILE 4 TO '/u20/oraflash/ORCL1/dbcopy/example01.dbf',
DATAFILE 5 TO '/u20/oraflash/ORCL1/dbcopy/indx01.dbf',
DATAFILE 6 TO '/u20/oraflash/ORCL1/dbcopy/tools01.dbf',
DATAFILE 7 TO '/u20/oraflash/ORCL1/dbcopy/users01.dbf',
DATAFILE 8 TO '/u20/oraflash/ORCL1/dbcopy/xdb01.dbf',
CURRENT CONTROLFILE TO '/u20/oraflash/ORCL1/dbcopy/control01.ctl',
CURRENT CONTROLFILE TO '/u20/oraflash/ORCL1/dbcopy/control02.ctl',
CURRENT CONTROLFILE TO '/u20/oraflash/ORCL1/dbcopy/control03.ctl',
ALTER DATABASE OPEN
My script is:
set serveroutput on format wrapped
set feedback off
spool db_copy.rcv
declare
cursor df is
select
file#,
substr(name,29,50) name
from
v$datafile;
cursor cf is
select
substr(name,27,50) name
from
v$controlfile;
BEGIN
DBMS_OUTPUT.ENABLE(2000);
DBMS_OUTPUT.PUT_LINE('run');
DBMS_OUTPUT.PUT_LINE('{');
DBMS_OUTPUT.PUT_LINE('SHUTDOWN IMMEDIATE');
DBMS_OUTPUT.PUT_LINE('STARTUP MOUNT');
DBMS_OUTPUT.PUT_LINE('COPY');
for dfbkup in df loop
dbms_output.put_line(' DATAFILE '||dfbkup.file#||
' TO ''' || '/u20/oraflash/ORCL1/dbcopy/' || dfbkup.name ||''',');
end loop;
for cfbkup in cf loop
dbms_output.put_line(' CURRENT CONTROLFILE' ||
' TO ''' || '/u20/oraflash/ORCL1/dbcopy/' || cfbkup.name ||''',');
end loop;
DBMS_OUTPUT.PUT_LINE(' ;');
DBMS_OUTPUT.PUT_LINE('ALTER DATABASE OPEN');
DBMS_OUTPUT.PUT_LINE('}');
end;
spool offHi
Try this then and remove any returns that I've put in as appropriate
DECLARE
l_string VARCHAR2(32767);
l_num NUMBER := 1;
CURSOR df IS
SELECT file#, SUBSTR (name, 29, 50) name
FROM v$datafile;
CURSOR cf IS
SELECT SUBSTR (name, 27, 50) name
FROM v$controlfile;
BEGIN
l_string := ('run
l_string := l_string||('{
l_string := l_string||('SHUTDOWN IMMEDIATE
l_string := l_string||('STARTUP MOUNT
l_string := l_string||('COPY
FOR dfbkup IN df
LOOP
l_string := l_string||( ' DATAFILE '
|| dfbkup.file#
|| ' TO '''
|| '/u20/oraflash/ORCL1/dbcopy/'
|| dfbkup.name
|| ''',
END LOOP;
FOR cfbkup IN cf
LOOP
l_string := l_string||( ' CURRENT CONTROLFILE'
|| ' TO '''
|| '/u20/oraflash/ORCL1/dbcopy/'
|| cfbkup.name
|| ''',
END LOOP;
l_string := RTRIM(l_string,'
l_string := l_string||(' ;
l_string := l_string||('ALTER DATABASE OPEN
l_string := l_string||('}');
WHILE l_num <= LENGTH(l_string) LOOP
DBMS_OUTPUT.PUT_LINE(SUBSTR(l_string, l_num, 200));
l_num := l_num + 200;
END LOOP;
END;Cheers
Ben
Maybe you are looking for
-
Dear Friends, I am sending the Idoc from one ECC server to other ECC server using XI, it has been completed ,but reciever side after one hour only it has to be updated. so in this case how it's possible with BPM or any other method is available. Pl
-
Asset Value depreciated to Rs 1 after 12 year
Hi, There is rule that Asset after 12 years should have Net Book Value Rs 1 and no further depreciation should be calculated on the asset after 12 years after capitalization date. How can we configure this scenario.
-
If i lose the drivers for windows detect my serial ata hd during installation?
SATA (serial ATA), FC-AL (fibre-channel-arbitrated loop), and SCSI host bus adapters may require additional drivers provided by the HBA (Host Bus Adapter) manufacturer to be installed during setup. I want to know if there is a web site where i can do
-
Loading from SQL Server gives an error
Hi, I try to load data from SQL server to Oracle. When I try to run my mapping, I get the following error: Job 4 error: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'kssefflataus.dbo.SLD_LAHETTEET_EFF'. while executing "java0x
-
i recently downgraded from ios 8 to ios 7.1.2 and it put my ipad back to factory settings. Is there a possible way i can get my photos back?