Select first 4 char
Hi all,
I am new to ABAP.
I want select first 4 char of variable.
Example:
X = '627128891'.
i want first 4 char of X save to Y.
Y= '6271'.
How can I do it with ABAP statement?
Thanks
Shiva.
hi,
data x(10) type c value '1234567'.
data y(4) type c.
y = x0(4). " xn(m) n is the starting position and m no of character from n.
output y = 1234.. first four characters
y = x+2(2).
output y = 34 ..
rewards if understood..
regards,
nazeer
Similar Messages
-
Selecting first char from column
In my qeury below i would like to select the first character from the column other_party_number. How can i do this? The left function does not seem to work
in pl/sql. I get an error statinf invalid identifier. Can anyone please help? Thanks
select call_date, left(other_party_number, 1) as number
from ccwebcf.calls_archiveHallo,
why do you think, that LEFT must work in SQL ? :-)
Dmytro,
Probably because LEFT works in other languages and other incarnations of SQL. Not everyone is tied to Oracle you know. ;-)
Oh look, if I run the SQL on an ingres database...
select left('blushadow',3) as name
name
bluMwuhahahaha!
:) -
Query for selecting first 3 characters of name of any person
query for selecting first 3 characters of name of any person
10:52:44 SQL> SELECT SUBSTR(ename, 1, 3) first_three FROM emp;
FIRST_THREE
SMI
ALL
WAR
JON
MAR
BLA
CLA
SCO
KIN
TUR
ADA
FIRST_THREE
JAM
FOR
MIL
Ton
15 rows selected.
Elapsed: 00:00:00.00 -
Hi
I need to select first n columns thru a query. i dont know the column names.
Thanks and Regards
Ananth Antonydesc emp
EMPNO
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPTNO
if n=3 means the output should be (i dont know the column name)
EMPNO ENAME JOB
7369 SMITH CLERK
7499 ALLEN SALESMAN
7521 WARD SALESMAN
7566 JONES MANAGER
7654 MARTIN SALESMAN
7698 BLAKE MANAGER
7782 CLARK MANAGER
7788 SCOTT ANALYST
7839 KING PRESIDENT
7844 TURNER SALESMAN
7876 ADAMS CLERK
EMPNO ENAME JOB
7900 JAMES CLERK
7902 FORD ANALYST
7934 MILLER CLERK
for emp Table.
Thanks
Ananth Antony -
Compare the last Char to the First Char in a Sting
Hello, this should be easy but I'm having problems so here goes.
I get the user to input a Stirng and I want it to compare the last Char to the first Char. I have writen this but StartWith can take a Char?
public static void main(String[] args) {
// TODO code application logic here
String strA = new String();
int length = 0;
char lastLetter;
System.out.println("Please input your first String: ");
strA = EasyIn.getString();
length = strA.length()-1;
lastLetter = strA.charAt(length);
if( strA.endsWith(lastLetter))
System.out.println("The first letter matches the last");
else
System.out.println("They Don't match");
}I have tried lastLetter.endsWith(strA) but that dosn't work some thing to do with it not taking Char
From reading you can go strA.startWith("R") and that would look for R but you can't put a char in that would be a single letter.
I also tried to lastletter to a string but then charAt wouldn't work.fixed it I used substring as its a string object any one recomend a better way let me know
public static void main(String[] args) {
// TODO code application logic here
String strA = new String();
int length = 0;
String lastLetter;
System.out.println("Please input your first String: ");
strA = EasyIn.getString();
length = strA.length()-1;
lastLetter = strA.substring(length);
if( strA.startsWith(lastLetter))
System.out.println("The first letter matches the last");
else
System.out.println("They Don't match");
} -
Af:inputListOfValues popup : selecting first row
Hi,
Is there a way to select first row inside lov popup, the by default behaviour is it selects the rowHeader rather than row itself.
When the lov popup is opened , there is no focus on table resides in the popup
- to focus on table, user has to press down arrow key - which will just focus on rowHeader and not the actual row itself
- to focus row for currently selected rowHeader user has to press right arrow key which will then select the table row itself
its cumbersome everytime when you open lov and do these extra steps to just to select a value from lov
any ideas?
Thanks,
Devso, why it supports keyboard navigation at all? either support full features or nothing. the fact that user can use up/down arrow keys which selects rowHeader of every row , rather than actual row
regarding "Search and Select : " it could be anything it has nothing to do with row selection,
Thanks, -
How to select first several records from a database table by using select?
Hi,
I want to select first 100 records from a database table by using select clause. How to write it?
Thanks a lot!hai long!
well select statement is used to retrive
records from the database.
following is the syntax to be used.
1) select * into corresponding fields of itab from basetable where condition.
endselect.
ex: select * into corresponding fields of itab from mara
where matnr >= '1' and matnr <= '100'.
append itab.
endselect.
select * is a loop statement.it will execute till matnr is less than or equal to 100.
note: you can also mention the required field names in the select statement otherwise it will select all the field from table mara.
note: itab means your internal table name.
hope you got the required thing.if it really solved u r problem then award me the suitable points.<b></b> -
Detecting the first char inside string
Hi,
I search through all the String and char method but it doesn't seems to be any method to do this.
Is there anyway I can detect the first char in a String
Eg:
@#@Hello!!
Is there a method that allows me to detect H directly?I guess you mean the first character of a particular type - excluding '@' and '#'.
morgalr wrote:
There isn't a built in function like String.firstChar() that would give you the first character of any String. You can easily make one though.There is [String.charAt(int index)|http://java.sun.com/javase/6/docs/api/java/lang/String.html#charAt(int)] which returns the character at position index. This method can't read your mind though, so charAt(0) will return the very first character regardless of whether it is "good".
In the Character class there is also a static method [isLetter(character)|http://java.sun.com/javase/6/docs/api/java/lang/Character.html#isLetter(int)] which reports "true" if the supplied character is a letter. There are lots of other methods in this class to report on the type of letter.
Perhaps you could put these ideas together: write a loop to inspect each letter in turn until you come to one that is "good". -
Check for first char of string
Let String myStr be the value I get from anywhere.
How do I check if the first char of myStr is "-" (a minus sign)?
Or how do i convert BigDecimal to integer?
All help appreciated!There is no doubt that myStr.charAt(0) == '-' is way faster than myStr.startsWith("-").
To both of the cases, a careful programmer needs to take care of some extreme values. Before checking charAt(), we need to do these:
<code>
if (myStr == null) return false;
if (myStr.equals("")) return false;
return myStr.charAt(0) == '-';
</code>
If you also consider " -100" is starting with a "-" sign, then you need to trim the string after the null check too.
--lichu -
Selection first n(20 )records from result page
Hi,
I have a requirement where the the users want to select first n(20) record from the result page after applying the date filter . They want to see all results and then select the records say first 50.I do not want to select manually clicking( browsing on page).Any thoughts how this can be achieved like adding text box at frame so that I can give number .Hello Senthil,
why you want to create one more textbox... you can achieve your requirement by entering 20 in "maximum number of fields". It will give first 20 results.
If you want to add one more textbox for your purpose then tell me.
Thanks and Regards,
Amit Singh -
VERIFY fails if Card Manager selected first
Hi,
If I send VERIFY with the appropriate key the card replies with 0x9000 (OK). The VERIFY command looks like this: A0 20 00 00 08 XX XX XX XX XX XX XX XX
If I first select the card manager (00 A4 04 00 07 A0 00 00 00 03 00 00) and then send VERIFY, the card replies with 0x6E00 (class byte expected by Transport Manager is not correct) or with 0x6D00 (Invalid instruction byte).
I would like to ask this:
Why does it matter if the Card manager is selected or not?
Does not the card manager get selected at reset automatically?
And who else would receive the command (and dispatch it) if not the card manager?
Why would I get an "Invalid instruction byte" error when the same command does not fail when sent first? Does that mean that different entities are involved in processing the command?
It is probably something silly, but buried somewhere where I cannot find it.
Thanks
Edited by: 815684 on Dec 20, 2010 7:02 AM815684 wrote:
It is a multiapplication card and it is for GSM (I was actually wondering what class A0 was). But is not the Card Manager supposed to be selected immediately after reset (all this happens immediately after reset)?If you have a default selectable applet loaded onto your card, this will receive any APDU's sent to the card if no other applet has been selected first. If you want to perform card management operations, you need to select the card manager before you can proceed. You do not need to select anything after reset, but there will need to be something receiving your APDU's for your card to respond.
We have a script that deletes our company's old applet (and its files) from the card and downloads a newer version. The first step of this process is to authenticate the user to the card. And though your reply clarified my question, it poses another one: Since I need to delete/download applets, why do I authenticate myself to someone else (the GSM applet) rather than the Card Manager (which is supposed to be in charge of deleting and downloading applets)? Is not the Card Manager supposed to be in charge of this?If you are doing card content management, you need to authenticate to the card manager. Your applet may have a mechanism that requires authentication to the applet before it will allow itself to be deleted. There is no official GP way of supporting this, so if this is the case someone that worked on the applet will be aware of this.
PS I am reading the GP, unfortunately it does take time to understand this stuffBe patient :) Reading this document will raise more questions. You just need to look through the document for these answers as there is a good chance you will find it in there somewhere. If and when that fails, you can always get help here. Just don't be surprised if the answer is: it is in the GP card spec. Hopefully we can point you to where as well.
Cheers,
Shane -
Select everything starting with first char
Hi,
I have a simple question and forgot how to do this. I need to do a select statement and select everything from the table for a field i.e. WERKS starting with 'D'. Any help would be greatly appreciated and rewarded.
Thanks,
-David.If you simply put your cursor on a SELECT statement and press F!, you'll get your answer very quickly.
Rob -
How to select first row of each group in a group by statement
Table
ProdCode PackType BatchCode ExpDate
BURSLO 1 BS20GO-2001 01/12/2004
BURSLO 1 BS20GO-2011 01/01/2007
BURSLO 2 BS20GO-2027 01/02/2003
BURSLO 3 BS20GO-2060 01/02/2004
BURSOI 9 BU10F12 01/02/2006
BURSOI 9 BU10GO-1301 01/05/2005
BURSOI 11 BU10GO-131 01/06/2008
BURSOI 2 BU10GO-1311 01/06/2007
BURSOI 13 BU10GO-1328 01/07/2006
Output
ProdCode PackType BatchCode ExpDate
BURSLO 1 BS20GO-2011 01/01/2007
BURSLO 2 BS20GO-2027 01/02/2003
BURSLO 3 BS20GO-2060 01/02/2004
BURSOI 9 BU10F12 01/02/2006
BURSOI 11 BU10GO-131 01/06/2008
BURSOI 2 BU10GO-1311 01/06/2007
BURSOI 13 BU10GO-1328 01/07/2006
i need first row after group by ProdCode, PackType and decreading order of ExpDate
Please Help me.
Thanks.
Try the below:
;With cte
as
(Select *,Row_Number()Over(partition by Prodcode,Packtype Order by expdate desc) Rn From Tablename)
Select * From cte where rn=1 -
JComboBox event notification when select first entry in pop-up menu JDK 6
I recently began testing a Java GUI, I originally developed with JDK 1.5.0_11, with JDK 1.6.0_3. I have used the JComboBox in several applications developed using JDK 1.3.x and 1.4.x over the years. In every one of these earlier JDKs the JComboBox widgets all behaved the same. When you select the JComboBox widget, the pop-up menu appears and you can select any of the items from the menu list. Having made the selection with either a mouse click or a key press, an event notification is sent. Typically, an ActionEvent as well as either a mouse click event or a keypressed event may be sent. When testing with 1.6.0_x versions of the JDK and JRE, I can't account for any event notification being sent when selecting the first item at the top of the pop-up menu as the initial selection. If I select some other item on the list and then the first item, it works as it is supposed to work, but only after selecting another item first.
I've placed the JComboBox in a JDialog and a JPanel. There are NO AWT widgets in any containers of the application. The same behavior seems to exist regardless of what other containing Swing component I place the JComboBox in. I'm running these applications on Windows XP, service pack 2. The system is an AMD 64 bit dual processor with 4Gb of RAM. The essential code follows:
private JComboBox getJcboAlias()
/* Note here that I am using a defaultComboModel as I have always done */
jcboAliases = new JComboBox(urls);
*jcboAliases.setEditable(false);* // Note here that the JComboBox is NOT editable
jcboAliases.addActionListener(new ActionListener() // ActionListener only receives a notification if the second or
{ // another item in the pop-menu list is selected...but never the
public void actionPerformed(ActionEvent ae) // first item in the list
String s = (String) jcboAliases.getSelectedItem();
for (int i = 0; i < connections.size(); i++)
conAlias = (String[]) connections.get(i);
if (s.equals(conAlias))
isSelected = true;
break;
jlblName.setVisible(true);
jlblAlias.setVisible(true);
jlblUID.setVisible(true);
jlblPWD.setVisible(true);
jtxtName.setText(conAlias[0]);
jtxtName.setVisible(true);
jtxtAddress.setText(conAlias[1]);
jtxtAddress.setVisible(true);
jtxtUID.setText(conAlias[2]);
jtxtUID.setVisible(true);
jtxtPWD.setVisible(true);
jtxtPWD.setText("");
jtxtPWD.requestFocus();
return jcboAliases;
} I'm using a non-editable JComboBox because there is a pop-up menu with this and not with the JList widget. JComboBox behaves more like the JList MicroSoft counterpart. Another code snippet follows in which the JComboBox is editable. The same errant behavior occurs when selecting the first item from the pop-up menu: private JComboBox getJcboPCMember()
jcboPCMember = new JComboBox(PCViewerCustom.getCurrentMembers());
jcboPCMember.setBounds(250, 103, 180, 20);
jcboPCMember.setToolTipText("PATHCHECK(ER) member name - Example: CKPPTHCK");
jcboPCMember.setSelectedIndex(Integer.valueOf(PCViewerCustom.getCurrentHost(3)));
jcboPCMember.setEditable(true); // Note here that this JComboBox IS editable
jcboPCMember.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ae)
if (ae.getActionCommand().equals("comboBoxEdited"))
boolean copy = false;
for (int i = 0; i < jcboPCMember.getItemCount(); i++)
if (jcboPCMember.getSelectedItem().equals(jcboPCMember.getItemAt(i)))
copy = true;
break;
if (!copy)
if (jcboPCMember.getItemCount() > 0)
if (jcboPCMember.getItemAt(0).equals("No Entries"))
jcboPCMember.removeItem("");
jcboPCMember.removeItem("No Entries");
jcboPCMember.insertItemAt((String) jcboPCMember.getSelectedItem(), 0);
else
jcboPCMember.removeItem("");
jcboPCMember.addItem((String) jcboPCMember.getSelectedItem());
enableJbtnOK();
else
if (jcboPCMember.getSelectedIndex() >= 0)
PCViewerCustom.setCurrentHost(3, Integer.toString(jcboPCMember.getSelectedIndex()));
enableJbtnOK();
else
JOptionPane.showMessageDialog(null, "Name not selected", "Error", JOptionPane.ERROR_MESSAGE);
return jcboPCMember;
I am able to add a new entry to the JComboBox, however, I am still unable to select the first item from the pop-up menu and fire any kind of notification event. I have not seen this behavior before in any earlier versions of the JDK and it's playing havoc with my ability to deploy the application into a JDK or JRE V6 environment, without adding a bunch of additional code to pre-select the first item on the list, which pretty much defeats the purpose of the JComboBox. I'll be the first to admit I've done something wrong, but i've built a number of test scenarios now on two systems runing Win XP SP2 and I get the same errant behavior. I've also added in event listeners for a MouseListerner, a KeyListener and an ItemListener. Still no event notification on this first item in the list. Again, however, if I select one of the other items from the pop-up menu list and then select the first item, all is well. Imagine selling that method of operation to a user.... It occurs to me that this must be a bug in the V6 JComboBox. I wanted to post this here first, however, in order to determine if this is, in fact, a bug - in other words, am I the only one seeing this, or is this a more widespread issue? Any assistance in making this determination is greatly appreciated.
David Baker
Edited by: Galstuk on Nov 27, 2007 12:21 PMhere is the other file as well:
Harold Timmis
[email protected]
Orlando,Fl
*Kudos always welcome
Attachments:
VI2.vi 5 KB -
Select first and last records in grouped results - Oracle 11g
Say I have the following information in an Oracle 11g table:
Qty
Production order
Date and time
20
00000000000000001
12-JAN-14 00:02
20
00000000000000001
12-JAN-14 00:05
20
00000000000000001
12-JAN-14 00:07
20
00000000000000001
13-JAN-14 00:09
30
00000000000000002
12-JAN-14 00:11
30
00000000000000002
12-JAN-14 00:15
30
00000000000000002
12-JAN-14 00:20
30
00000000000000002
14-JAN-14 00:29
I would like to write a query that would return the following:
Qty
Production order
First
Last
80
00000000000000001
12-JAN-14 00:02
13-JAN-14 00:09
120
00000000000000002
12-JAN-14 00:11
14-JAN-14 00:29
That is, the sum of the Qty column grouped by Production order, and the date/time of the first and last records for each Production order.
I came up with a query that yielded this result:
Qty
Production order
First
Last
80
00000000000000001
12-JAN-14 00:02
14-JAN-14 00:29
120
00000000000000002
12-JAN-14 00:02
14-JAN-14 00:29
Which means that the First and Last columns show the overall first and last date / time of the whole table. Please note that this is a dummy table. Sorry I am now allowed to write the actual query
I came up with since work policies do not allow me to share it. Also, I tried with windowing functions such as rank()and row_number() but my user does not have enough privileges to do so.
Any help or hints will be greatly appreciated.Due to the fact that Oracle does not record the rows in any particular order, it would be wrong that the "first date" would be the first row processed by the query.
Therefore you would have to supply some other column if you do not want to consider the table as ordered by date.
Also, any analytical functions will need you to supply the "order by" and if its the date, then just a simple query will do:
SQL>WITH Tab1 (Qty, Production_Order, Pdate)
2 AS (SELECT 20, '00000000000000001', TO_DATE ( '12-JAN-14 00:02', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
3 SELECT 20, '00000000000000001', TO_DATE ( '12-JAN-14 00:05', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
4 SELECT 20, '00000000000000001', TO_DATE ( '12-JAN-14 00:07', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
5 SELECT 20, '00000000000000001', TO_DATE ( '13-JAN-14 00:09', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
6 SELECT 30, '00000000000000002', TO_DATE ( '12-JAN-14 00:11', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
7 SELECT 30, '00000000000000002', TO_DATE ( '12-JAN-14 00:15', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
8 SELECT 30, '00000000000000002', TO_DATE ( '12-JAN-14 00:20', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
9 SELECT 30, '00000000000000002', TO_DATE ( '14-JAN-14 00:29', 'DD-MON-YY HH24:MI') FROM DUAL)
10 SELECT SUM ( Qty), Production_Order, MIN ( Pdate), MAX ( Pdate)
11 FROM Tab1
12 GROUP BY Production_Order
13* ORDER BY Production_Order
SQL> /
SUM(QTY) PRODUCTION_ORDER MIN(PDATE) MAX(PDATE)
80 00000000000000001 12-Jan-2014 00:02:00 13-Jan-2014 00:09:00
120 00000000000000002 12-Jan-2014 00:11:00 14-Jan-2014 00:29:00
Maybe you are looking for
-
Issues in Connecting SQL Server 2008 to BI om Solaris
Hi , I am trying to Connect a Standalone SQL Server to a BI System on UNIX Via UD Connect . Both SQL Server and BI System are on the Same Network ( Subnet ) . I have Deployed the JDBC Drivers in BI Via Visual Administrator PATH :- Server --> Services
-
Have to lock twice...in order for "slide to unlock" to work!
I have not found anything similar to my issue so I'm posting this hoping someone can help me! My iPhone 5S works fine, however I have the following situation... When I hit "Home" to unlock, I will get the "Slide to Unlock" message, but the screen is
-
on the old ipod (mini and downwards) when you select the ipod to repeat one song it repeats just that song untill you click the skip button to go to the next track. but on the new ipod video you cant do that. i have tried all the settings i could thi
-
Ideas for using One to One Open Training Appointment?
I have an appointment for the Open Training Appointment, but I don't have any projects that I am working on. Have some suggestions for something I can use it for? Thanks, Annie
-
HP Photosmart 7200 Colors are Wrong When Printing on Photo Paper
I'm running Windows 7 and am having a problem when printing on photo paper. The colors are off; mainly green. The colors are fine when printing on plain paper. I have tried printing from my computer as well as straight from the media card. Same r