Get a part of the string
Hi SAP gurus
i have a string where i need to eliminate 'A.B.N' from the following string please advice
as i am new to xslt i am not sure how
xsl:value-of select="concat('A.B.N. ',$vABNNameValue)"/
this is the part of the xsl i am trying to change the above statement in .
:for-each select="/ORDERS02/IDOC/E1EDKA1" >
<xsl:if test="PARVW = 'LF' ">
<Name3>
<xsl:variable name= "vABNNameValue">
<xsl:value-of select="''" />
<xsl:for-each select="E1EDKA3" >
< xsl:if test="QUALP = 'ABN' ">
<xsl:if test="STDPN != ''">
<xsl:value-of select= "STDPN"/>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test= "$vABNNameValue != ''">
< !xsl:value-of select="concat('A.B.N. ',$vABNNameValue)"/-!>
<xsl:value-of select="concat(' A.B.N. ',$vABNNameValue)"/>
<!<xsl:value-of select="$vABNvalue"/>>
</xsl:when >
<xsl:otherwise >
<!-- OVSD Call 324728 End -- >
< xsl:variable name="Name3Test">
<xsl:call-template name="Template_GetE1EDKA1Name3">
<xsl:with-param name= "TestValue">LF</xsl:with-param >
< /xsl:call-template>
< /xsl:variable>
< xsl:if test="$Name3Test != ''" >
<xsl:value-of select="$Name3Test"/ >
</xsl:if >
<!-- OVSD Call 324728 Begin -- >
< /xsl:otherwise>
< /xsl:choose>
< /Name3>
< /xsl:if>
< /xsl:for-eac
please advice its so urgent i have a production issue
i know there is a function substring
thanks
Have a look at this
http://www.w3schools.com/xpath/xpath_functions.asp#string
i guess this might be useful to you :
<b>replace(string,pattern,replace) </b>
Returns a string that is created by replacing the given pattern with the replace argument
Example: replace("Bella Italia", "l", "")
Result: 'Bea Itaia'
in your case
<b>replace("someA.B.Nssss","A.B.N","")</b>
I think it would work. try this....
PS: award points if answer helps you.
thanks,
Pooja
Similar Messages
-
Converting part of the string to a date and subtract with sysdate.
HINT! In order solve this you must know how the pnr is assembled. Study this:
650323-5510, we only need the first six characters. They inform us about when the person (car owner) was born. In this case it is 23 Mars 1965. You have to use several oracle built-in-functions to solve this. Hint! Begin by converting part of the string to a date and subtract with sysdate.
select to_char(to_date(cast(pnr,'YYMMDDMM'))) from car_owner;
please what am i doing wrong. i need the result to be something like this
Hans, Rosenboll, 59,6 years.Hi.
The main problem here is you have only last two digits of year. That could be the problem in a couple of years from now, when somebody born after 2k would get in to your database. For now if we ignore this problem the right solution would be :
<code>
SELECT months_between(trunc(SYSDATE),
to_date('19' || substr('650323-5510',
1,
6),
'YYYYMMDD')) / 12 years_old
FROM dual
</code>
Suppose you are expecting the age of the car owner as a result above code will give you that. One again notice the '19' I appended.
Best regards. -
Using INSTR to extract part of the string ?
Morning guys and Happy Friday.
I have a situation where I have to pull out part of the string using a select statement.
Here is the string and I have to get the contents between the 2nd and 3rd backslash. So, basically, I have to extract marypoppins. Any ideas ?
C:\USERS\marypoppins\Docs\SpecificationHere is where I started ... and I have stumbled upon trying to find the 3rd backslash. I can easily start the INSTR at 4 because I know that it will always be 'C:\'
select select substr(C:\USERS\marypoppins\Docs\Specification',
INSTRB('C:\USERS\marypoppins\Docs\Specification', '\', 4), .....) from dual;Additionally you can break it all up simply with regular expressions..
SQL> ed
Wrote file afiedt.buf
1 with t as (select 'C:\USERS\marypoppins\Docs\Specification' as txt from dual)
2 -- END OF TEST DATA
3 select rownum, regexp_substr(txt, '[^\]+',1,rownum) as element
4 from t
5* connect by rownum <= length(regexp_replace(txt,'[^\]'))+1
SQL> /
ROWNUM ELEMENT
1 C:
2 USERS
3 marypoppins
4 Docs
5 Specification
SQL> -
Addressing of part of the string in the container
Hello,
in a mail task I would like to print only some characters from a string - e.g. from second to tenth - is it possible to address some part of the string in the container as is usual in abap?
thx,
JJHi,
Yes , it is possible. If you want to show only some part of the string value in mail description you can use normal abap string operations. For example: In Mail description if you want to show only a part variable VALUE. you can just use &VALUE+a(b)&. It will work !!
You can try it out !!
Regards
Krishna Mohan -
How to get a part of the background image.
Hi
I have created a JPanel using paintComponent() and added it to the content pane of the JFrame. It consists of two colors blue and white. It consists of blue background color and on top of that a part of white background is also there. Now i want to place the components only on the white background. But still the components are getting placed on the blue one.Below is the code for creating the panel.
public void paintComponent(Graphics g)
try
Paint bckGrndPaint = new GradientPaint(200,0,new Color(5,62,95,255) ,200,
500, new Color(226,226,224,255), true);
Graphics2D g1d = (Graphics2D)g;
g1d.setPaint(bckGrndPaint);
g1d.fillRect(0, 0, getWidth(), getHeight());
RoundRectangle2D r = new RoundRectangle2D.Float(20,20, getWidth()-60, getHeight()-60, 25,
25);
g1d.setColor(Color.WHITE);
g1d.draw(r);
g1d.fill(r);
}Hi,
For this approach you should use two JPanels ... one for the blue part ... and the other for the white.
So you can place the components only at the white part. The gradient paint may be splitted
into two gradient paints. Without this you won't benefit from the
layout manager ... and setting the components hard coded is not a nice idea...
If you don't know how to use layouts take a look at this page.
Olek -
To validate each part of the string
Hi,
In one string, we have these
ID_A,ID_B,ID_C, ..., ...
I know that there's a way in PL/SQL to divide it into several parts and each part is for one ID. But can I expect that to divide the string into several parts, and then to store all IDs in something like an Array, in PL/SQL? Is this possible, though I know there's no array field type in PL/SQL?
Regards,
huaminxtender wrote:
You can use my package xt_regexp - http://github.com/xtender/XT_REGEXP
To install execute in this order: types.sql, xt_regexp.jsp, xt_regexp.pck
Example:
with t as (
select 'ID_A,ID_B,ID_C,' str from dual
union all
select 'ID_A,ID_B,ID_C,ID_D' str from dual
select
t.*,
row_number() over (partition by t.str order by t.str) substr_number,
substring.column_value substring
from t,
table(xt_regexp.split(t.str,',')) substring
That's nice, but you may want to benchmark that against an approach that doesn't make a bunch of external calls (for performance)...
with t as
select 1 as id,'ID_A,ID_B,ID_C' str from dual
union all
select 2 as id, 'ID_A,ID_B,ID_C,ID_D' str from dual
select
t.*,
regexp_substr (t.str, '[^,]+', 1, s.column_value) as split
from
t,
table( cast (multiset (select level from dual connect by level <= length(regexp_replace(t.str, '[^,]+')) + 1) as sys.odcinumberlist)) s
ID STR SPLIT
1 ID_A,ID_B,ID_C ID_A
1 ID_A,ID_B,ID_C ID_B
1 ID_A,ID_B,ID_C ID_C
2 ID_A,ID_B,ID_C,ID_D ID_A
2 ID_A,ID_B,ID_C,ID_D ID_B
2 ID_A,ID_B,ID_C,ID_D ID_C
2 ID_A,ID_B,ID_C,ID_D ID_D
7 rows selected.
Elapsed: 00:00:00.02
TUBBY_TUBBZ?For example. -
Formula for getting first letter of the string
Post Author: jmmj
CA Forum: Formula
Hi, I have a problem to get the first letter of the string. I need to compare first letter first and then change the rest of string to number as unit cost for calculation. For example, I have string K100, C200,... if first letter = K then 0 else if first letter = C then tonumber200..... I use CRXI, any assistance will be appreciate.jmmjPost Author: jmmj
CA Forum: Formula
It works, thanks Kai!But when I tried to print the report, there are multiple lines shown same invoice number but different unit price. My formular is: IF {OEINPR3.COINTYPE} = 2 OR CCur({OEINPR3.LINETYPE}) = 1 //line type 1 for item, 2 for misc. charge THEN( IF {OEINPR3.COIN}[1] = "K" OR {OEINPR3.COIN}[1] = "N" THEN TONUMBER(MID({OEINPR3.COIN},2,20)) ELSE 0)ELSE 2 //for testing only The result I have: Line# Inv# unitprice total1 IN001 0.00 10.00 IN001 10.00 10.00 2 IN002 0.00 20.00 IN002 20.00 20.00.......The second line of each invoice is correct. How can I print just one line for each invoice which is correct? Thanks!jmmj -
Display only part of the STRING field, but search ALL field
Hi all,
I have a field VARCHAR2(4000) that holds a lot of text.
When I make a report in APEX, it shows in each row, ALL text, so the report is very "ugly".
I want to limit the display of that column for only the first 60 characters.
I tried to use the SUBSTR function, that worked, but the search option will search for the text only in that 60 lenght characters, and will now search in the rest (not displayed) part of the field.
Is there a way to do this full search and display only part of the field?
ThanksYou can have the 'substring' column displayed to the user, but have another column which shows the full text lets say it has an ALIAS of "*SEARCH_LARGE_TEXT*" in the report definition(and is among the displayed columns).
You can hide the large text column(SEARCH_LARGE_TEXT) using JS as
$('th[id="SEARCH_LARGE_TEXT"],TD[headers^="SEARCH_LARGE_TEXT"]').hide()
Note: ^= syntax used to match data column even when break formatting used
You can make sure that the column stays hidden even after an IR filter or refresh by binding it to the refresh event of the IR by
$('#apexir_WORKSHEET_REGION').bind('apexafterrefresh', function(){
$('th[id="SEARCH_LARGE_TEXT"],TD[headers^="SEARCH_LARGE_TEXT"]').hide()
change the string "SEARCH_LARGE_TEXT" with your column's alias
Hope it helps -
How to get a part of a string?
Hi,
I get the value of a field from a database table as SAPKB70013.
Now I just want to get the last two digits (ie. 13 ) of this value ansd pass it to another variable.
How is it possible?Hi Harshit,
First calculate the length of your string through STRLEN statement and then,
use it with OFFSET.
Kindly go through this link below:
http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb341a358411d1829f0000e829fbfe/content.htm
Hope it helps
Regrds
Mansi -
Hello,
please, I have million of records and I need to replace LAST THREE characters, regardless of what they are, in column that is always of the same length e.g.,1234abc need to be:
1234000
i.e., to keep first four characters!
thanksHi,
If your column data type is of datatype varchar(max) or nvarchar(max)
you can use the WRITE clause in the UPDATE statment
DROP TABLE tblupdatewrite
CREATE TABLE tblupdatewrite
c1 VARCHAR(MAX)
INSERT INTO tblupdatewrite
SELECT '12345abc'
UPDATE tblupdatewrite
SET C1.WRITE('000',LEN(C1)-3,3)
SELECT * FROM tblupdatewrite
Best Regards Sorna -
Variable for restriction based on part of the String
Hello Experts,
I have a characteristic named Product Hierarchy (0PRODHIER) in the query. I want to create a variable so that the report displays the results based on the first character of 0PRODHIER. How can this be achieved?
Thanks,
RishiHi Mayank
Thanks for your response. I knew that we can do this at the Cube level but I was just wondering if there is any other way to achieve this at the BEx level.
Thanks
Rishi -
Remove some portion of the String
Hi,
My problem is String contains data is
artist1
title1
-1
artist2
title2
2
artist3
title3
-1
artist4
title4
2
i want to remove some portion of the string like artist2, title2, 2 so my updated string should be like
artist1
title1
-1
artist3
title3
-1
artist4
title4
2
Here i am using String.replaceAll("artist2","");
String.replaceAll("title3","");
String.replaceAll("2","")("[\code]
its deleting whole data in a string, can any one please help me how to delete particular part of the string. Here artist and title are unique and no are reapeated.Hey I had the same problem like you yesterday.
I tried using regEx with positiv lookahead but noticed that there was a problem when the String went over multiple lines. There is probably some solution to it that i havent found yet.
So what I did was get the Index of the first text I wanted deleted(in your case I guess "artist2"). Then got the Index of the end of the deletion point(In your case the "2"?) and then formed a new String with the substring from the orginal one and the indexes of the two deletion points.
Sounds kinda dirty but it did work out. Anyway I'll dig myself into regular expressions more today because if you get them to work, they're a charm :) -
Delete part of a string question
Hello I have this String 12a
I need to get a the value 12 of it an make it an int
But the problem is that I don't know what the string is it can be
12
or 12 a
or 12a
It is for people to fill in there house address and this is the number part.
The string is like this String number ="\"12a\"";
Is it possible to look for a letter in a String and delete it if you only want ints???Try this on the command line. Dealing with java.lang.NumberFormatException in cases where the number is too large is left as an exercise.
Harald.
import java.util.regex.*;
* demonstrates use of <code>java.util.regex</code> to check if a
* string starts with digits.
public class bla {
* thrown by {@link #getNumber} if the given string does not start
* with digits.
private static class BoomBoom extends Exception {
public BoomBoom(String msg) {super(msg);}
* reusable pattern to check for digits.
private static Pattern p = Pattern.compile("[0-9]+");
* convert leading digits of the parameter to an <code>int</code>
* and return it.
* @throws BoomBoom if the parameter does not start with digits.
public static int getNumber(String s) throws BoomBoom {
Matcher m = p.matcher(s);
if( !m.lookingAt() ) {
throw new BoomBoom("The string `"+s+"' does not start with "
+"a positive number.");
return Integer.parseInt(m.group(0));
// don't clutter the javadoc
private bla() {}
* passes each command line argument through {@link #getNumber} and
* prints the output or error to <code>System.out</code> or
* <code>System.err</code> respectively.
public static void main(String[] argv) {
for(int i=0; i<argv.length; i++) {
try {
System.out.println("Your string `"+argv[i]
+"' starts with number "
+getNumber(argv));
} catch( BoomBoom e ) {
System.err.println(e.getMessage()); -
How Do I Mirror A Part Of A String?
Dear Programmers,
Does Anyone know how to mirror a string in C#:
For example: looks -> skool
Thank you in advance,There is a Reverse method:
string s = "looks";
s = new string(s.Reverse().ToArray());
Best way to reverse a string:
http://stackoverflow.com/questions/228038/best-way-to-reverse-a-string
And you can get a part of a string using the Substring method:
https://msdn.microsoft.com/en-us/library/system.string.substring(v=vs.110).aspx
Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question. -
How to get InputStream from JTextArea.getText() string?
hello,
well the postname pretty much says it, i need to get an InputStream for the String of a JTextArea.
thing is, i want to save the string in a textfile, but the new line isnt recognized when i write it to the file.
FileWriter fw = new FileWriter ("text.txt");
fw.write(editField.getText()); // editField is my JTextArea instanceso i thought of doing smth like this
String lineSeparator = System.getProperty("line.separator");
// somehow getting the InputStream for my editField and save it in "is"
BufferedReader br = new BufferedReader(new InputStreamReader (is));
String line;
while ((line = br.readLine()) != null) {
fw.write(line);
fw.write(lineSeparator);
}pSaiko wrote:
hello,
well the postname pretty much says it, i need to get an InputStream for the String of a JTextArea.
thing is, i want to save the string in a textfile, but the new line isnt recognized when i write it to the file.
FileWriter fw = new FileWriter ("text.txt");
fw.write(editField.getText()); // editField is my JTextArea instanceso i thought of doing smth like this
String lineSeparator = System.getProperty("line.separator");
// somehow getting the InputStream for my editField and save it in "is"
BufferedReader br = new BufferedReader(new InputStreamReader (is));
String line;
while ((line = br.readLine()) != null) {
fw.write(line);
fw.write(lineSeparator);
This is very simple, it isn't buffered, but it should work for you.
Sting s = editfield.getText();
for(int i=0; i<s.length();i++) fw.write((int)s.charAt(i));
fw.flush();
fw.close();
Maybe you are looking for
-
Multiple desktops. One keeps switching to "desktop 5" when I click in the other.
I have 2 monitors running 5 desktops. Whenever I click on the monitor that isn't holding desktop 5 the other monitor automatically switches from whatever desktop it's currently displaying to desktop 5. Why? I need this to stop. please help.
-
Hello, I have a table with a primary key. There is an implicit index that is created with primary key - now I wish to alter this primary key so that I can use an another existing non-unique index (or by creating a new unique index). is there a way to
-
Need a simple example program code to use SF_EXAMPLE_01
Hi all, I have just try to learn smartforms. As i have SAP NW4 for learning. I found SF_EXAMPLE_01 in the system. Can any body help me out how to use this example in abap program code? Thanks. rob
-
is there anyway to increase the size of the array without losing previous information for example //String[] words = new String[2]; //words[0] = "Hello"; //words[1] = "Byes"; if i do this //words = new String[3]; //words[2] = "goodbye"; then the prev
-
Opening older documents text layers are confused
When opening older documents, why does PS CS6 mess up my text layers when I select them? I open the .psd from CS5 in a file with many text layers, the text is correct when opeinging the file but when i click on it to edit it, data from another layer