ABAP STRING OPERATIONS
What is the ABAP code to find characters of a string after the forward slash(/) ?
For eg : USER/SAP/ABC.CSV
How to retrive ABC.CSV which is after /.
HI Sai,
Use the Following Code:
DATA : G_FILE TYPE STRING,
G_EXTENSION TYPE STRING,
G_FILE_EXT TYPE CHAR255.
CALL FUNCTION 'CH_SPLIT_FILENAME'
EXPORTING
complete_filename = g_file " Your File Name
IMPORTING
extension = g_extension
name_with_ext = g_file_ext
EXCEPTIONS
invalid_drive = 1
invalid_path = 2
OTHERS = 3.
Thanks And Regards
Mohit
Similar Messages
-
To use Character string operator in ABAP
HI,
I have a problem with joining the two fields with different data length i.e
OBJKY has length (30).
tknum has length (10).
the above read table i_nast works as long as both has the records not greater than 10 and I do have some records with greater than 10 for OBJKY in the database and my read is failing at that scenario, I need to use a charater string operator, as I am new to ABAP, can any one suggest me how to do .
...SQL..
select OBJKY DATVR from nast
into corresponding fields of table i_nast
where KSCHL = 'ZBOL'.
sort i_nast by OBJKY.
LOOP at i_ship_data.
read table i_nast with key
OBJKY = i_ship_data-tknum binary search.
if sy-subrc = 0.
move: i_nast-datvr to i_ship_data-datvr.
endif.
modift i_ship_data.
ENDLOOP.HI,
Since OBJKY and TKNUM are with different lengths the Read statement works only
when OBJKY has a 10 character value identical to TKNUM.
but if we can assume that only first 10 characters of OBJKY are to be comapred with TKNUM then we can try the under mentioned approach:
Create a new field in the Internal table I_NAST with length 10 characters.(I_NAST-OBJKY_TEMP).
now assign the first 10 characters of OBJKY to this new field :
LOOP AT I_NAST.
MOVE I_INAST-OBJKY+0(10) TO OBJKY_TEMP.
MODIFY I_NAST.
ENDLOOP.
Now you can Modify your READ STATEMENT :
LOOP at i_ship_data.
read table i_nast with key
OBJKY_TEMP = i_ship_data-tknum binary search.
if sy-subrc = 0.
move: i_nast-datvr to i_ship_data-datvr.
endif.
modift i_ship_data.
ENDLOOP.
Hope this will help.
Note: You can pick up any 10 characters starting from 1 to 20 th character of the field
I_INAST-OBJKY.
Reward Points if found helpfull..
Cheers,
Chandra Sekhar. -
Error While converting xml to sap abap string.
Hi Experts,
As i am doing an cross Application from SAP to .Net and vice versa.I am receiving an xml from .Net and it should be converted to ABAP string Using the following function module SMUM_XML_PARSE
And the following string i am receiving from .net
<Root><qApprovalInfo><RequesterId>xxxx</RequesterId><RequesterName>xxx</RequesterName><ApproverId>xxxx</ApproverId><ApproverLevel>1</ApproverLevel><PendingApprovalId>0200169911</PendingApprovalId><CreatedDate>20/07/2011</CreatedDate><CreatedBy>xx</CreatedBy><ModifiedDate>2011-07-20 16:45</ModifiedDate><ModifiedBy>xxxx</ModifiedBy><ApplicationCode>EPAY</ApplicationCode><WorkFlowCode>EPX</WorkFlowCode><ApprovalStatus>APPROVED</ApprovalStatus><ActionComments><![CDATA[APPROVED(through Desktop)]]></ActionComments><Mode>CREATE</Mode><ActionSource>DESKTOP</ActionSource></qApprovalInfo><qApprovalHidden><Approverl>40002664</Approver><EmployeeId>40016515</EmployeeId></qApprovalHidden></Root>
In this xml i am getting all the values except the <ActionComments><![CDATA[APPROVED(through Desktop)]]></ActionComments>
is their any way to convert that CDATA value?..
have anybody come across the following issue ?...
can anybody provide the solution for this?.
Edited by: basavaraj.p on Aug 29, 2011 10:54 AMHi,
SMUM_XML_PARSE is a simplified, unreleased and undocumented version of the powerful, released and documented iXML
If you look at the GET_ELEMENT subroutine in that function module, you'll see that the nodes of type CO_NODE_CDATA_SECTION are simply ignored.
The simpliest thing for you, maybe, is to duplicate the code of SMUM_XML_PARSE (as it is rather easy to handle), and add a section to GET_ELEMENT. You'll have also to use IF_IXML_CDATA_SECTION interface and ixml_iid_cdata_section constant.
Documentation is here: [SAP Library: Interface if_ixml_cdata_section|http://help.sap.com/saphelp_nw70/helpdata/en/bb/576658dca511d4990b00508b6b8b11/frameset.htm ]
Best regards,
Sandra -
String operations on internal table text....
Original table is consists of 2 columns:
E
RFC error(SM_DHTCLNT010_READ): Error when opening connection
E RFC error(SM_DHLCLNT010_READ): Error when opening connection
E RFC error(SM_DHKCLNT010_READ): Error when opening connection
E RFC error(SM_E10CLNT000_READ): 'tdhtci00.emea.gdc:sapgw02' E No read RFC FOR SM_B72CLNT003_READ
E No read RFC FOR SM_B71CLNT003_READ
S Clients for system 'E21' found in RFC 'SM_E21CLNT001_READ'
S Clients for system 'E22' found in RFC 'SM_E22CLNT001_READ'
S Clients for system 'E23' found in RFC 'SM_E22CLNT001_READ'
Now we need to apply string operations such that result table is 3 columns with new refined message:
status sid
Message NEW_TEXT
E DHT
RFC error Error when opening connectionE DHL RFC error Error when opening connection
E DHK RFC error Error when opening connection
E E10 RFC error tdhtci00.emea.gdc:sapgw02
E B72 No RFC LINK
E B71 No RFC LINK
S E21 DATA READ
S E22 DATA READ
S E23 DATA READ
String conditions to arrive at new table is:
1) to get SID column : the conditions are
If the Status is RFC Error then next 3 Characters after the _ must be extracted as SID
Else the SID is between the first and the second inverted comma
Example: Clients for system 'E21' found in RFC 'SM_E21CLNT001_READ'extracts E21 as SID
2) for message column
· message RFC Error if the message text
starts with RFC Error
· message no RFC Link if the message text starts with No read RFC*
· message Data Read if the Substring found in RFC</b> was found in the Message
3) If the Status is RFC Error then the whole Textstring behind the : must be Extracted
For example if message is RFC error(SM_DHLCLNT010_READ): Error when opening connection NEW_TEXT will be Error when opening connection
Need ur inputs on these.
Bset regards,
SubbaHi,
this u can acheive simply using offset:
var_name+off(len). "
e.g. wa_message-fld+0(3) = first threee characters
wa_message-fld(3) same as above first three characters
wa_message-fld+2(2) " will display second and third characte of wa_message-fld
this u can use to set condtions like :
if wa_message-fld(9) = 'RFC Error'.
"process here
endif.
Hope this will help u...
Jogdand M B -
String operations in internal table
Dear friends..
Good morning.
I wish to know.. how i segregate the field from a database table to internal table into two different internal table field. say for example.
i have db table tab1 which has field number
tab1 -> number
and i have another internal table itab1 whic has two fields numa and numb
tab1 -> numa
-> numb
i have value in tab1->number is 001 and 0001
i wish to segregate this two values in to internal table
if the value is 001 then it should be into 001 -> numa
if the value is 0001 then it should be into 0001-> numb
i dont know how to perform the string operations in internal table.. would you like to tell me how i fix this problem any suggetion, article, code will be great help of mine..
thanking you
Regards
NaimHi,
what u can do is check the lenth
lit_data_tab.
lit_data_3
lit_data_4.
lv_char3 type char3.
lv_char4 type char4.
lv_length type i.
loop at lit_data_tab.
lv_length = STRLEN ( lit_data_tab-value ).
if lv_length = 3.
lv_char3 = lit_data_tab-value .
append lv_char3 to lv_char3 type char3.
else.
lv_char4 = lit_data_tab-value .
append lv_char4 to lv_char3 type char4.
endif.
endloop.
if u want
numa numb
003 0003.
then u have to loop in one table and modify other.
that is any one table should contains both the field.
read the table with one field
mark helpfull answers
Regards
Message was edited by: Manoj Gupta -
Efficiency of Java String operations
Hi,
for an Information Retrieval project, I need to make extensive use of String operations on a vast number of documents, and in particular involving lots of substring() operations.
I'd like to get a feeling how efficient the substring() method of java.lang.String is implemented just to understand whether trying to optimize it would be a reasonable option (I was thinking of an algorithm for efficient string pattern matching such as the Knuth-Morris-Pratt algorithm, but if java.lang.String already applies similarly efficient algorithms I would not bother).
Can someone help?
JThanks for your comment. Yes of course you're right, I
mean indexOf(). If so (thanks DrClap), let me enter the discussion.
The indexOf() implements a so called "brute force algorithm".
The performance is O(n*m), where n is the length of the text, and
m is the length of the pattern, but is close to n on the average.
The KMP is O(n), so the performance gain should be hardly noticeable.
To get a real performance gain you should look at the BM (Boyer-Moore,
O(n/m)) algorithm or some of its descendants.
As for java.util.regex package, as far as i understand it should be
several times slower than indexOf(), because it reads EACH character through an interface method (as opposed to direct array access in indexOf()).
Though it's still to be proved experimentally. -
Perl versus other "scripting" languages when doing string operations
I've been told that perl is a "scripting" language like the other languages mentioned in this forum.
If that's true, can these other languages handle the following spec as well as perl can? (See spec at end of this post.)
Or is perl stronger in string operations than the other scripting languages mentioned here?
Here's the spec:
1. I give your program a twenty-letter alphabet (any twenty letter alphabet)
For example:
ABCDEFGHIJKLMNOPQRST
2. I also give your program four groups (any four groups) of letters in this alphabet:
For example:
s: A,B,C,D,E
p: F,G,H,I,J
d: K,L,M,N,O
e: P,Q,R,S,T
3. I also give your program a sequence over the twenty-letter alphabet that I gave you in Step (1) above:
For example:
ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA
4. Given this sequence,you search for pairs of adjacent letters (x,y) where X and y are from different groups (the groups defined in Step (2) above.)
Also, you return the results of this search by giving me back the following two strings:
ABCD(EF)GHI(JK)LMN(OP)QRSTSRQ(PO)NML(KJ)IHG(FE)DCBA
ABCD(sp)GHI(pd)LMN(de)QRSTSRQ(ed)NML(dp)IHG(ps)DCBA
5. Note: if I give you a sequence that contains "overlapping" ordered pairs like:
...EFK...
then you ignore the second ordered pair. That is, you return:
...(EF)KOK - here is the final stuff on the "C" side.
To execute the program, the command line is:
20let.exe file1.txt file2.txt file3.txt > fileout.txt
Below, I've provided:
a) source code 20let.c
b) sample input file1.txt
c) sample input file2.txt
d) sample input file3.txt
e) output fileout.txt generated from these input files.
As soon as Bill finishes the perl version of the source code, I'll post that also.
source code of 20let.c
// 20let.c5
#include <stdio.h>
#include <stdlib.h>
int T[333],A[99999],G[333],B[99999],C[99999],N[299999],P[99999];
int n1,n2,f,p,x1,x2,n,m,a,b,c,i,j,k,x,y,z;
int E[233][233];
FILE *file;
int substrings(int x1,int x2);
int main(int argc, char*argv[]) {
if(argc<3){
printf("\nusage:20let protein-file nucleotide-file pairs-include-file\n\n");
printf("marks amino-acid-pairs from different groups in protein-file\n");
printf("iff they are in the include-file\n");
exit(1);
//----------------define the groups G['I'] = 's', e.g.
x='s'; G['I']=x;G['M']=x;G['V']=x;G['A']=x;G['G']=x;
x='p'; G['F']=x;G['L']=x;G['P']=x;G['W']=x;G['W']=x;
x='d'; G['H']=x;G['Q']=x;G['D']=x;G['E']=x;G['E']=x;
x='t'; G['S']=x;G['T']=x;G['Y']=x;G['N']=x;G['C']=x;G['K']=x;G['R']=x;
//----------------the 4 bases T['a'] = 0 thru 3
for(x=0;x<222;x++)
T[x]=-999;
T['a']=0;T['c']=1;T['g']=2;T['t']=3;
T['A']=0;T['C']=1;T['G']=2;T['T']=3;
for(i=65;i<70;i++)G<i>='s';
for(i=70;i<75;i++)G<i>='p';
for(i=75;i<80;i++)G<i>='d';
for(i=80;i<85;i++)G<i>='t';
//---------------- read include-file file3 xxxyyy pairs E[x][y] of interest
f=0;
for(x=0;x<222;x++)
for(y=0;y<222;y++)
E[x][y]=0;
if((file=fopen(argv[3],"rb"))==NULL){
printf("\ncan't open exclude-file %s\n",argv[1]);exit(1);
mq1: if(feof(file))
goto mq3;
x=fgetc(file);y=fgetc(file);x=fgetc(file);
x=T[fgetc(file)]*16+T[fgetc(file)]*4+T[fgetc(file)];
y=T[fgetc(file)]*16+T[fgetc(file)]*4+T[fgetc(file)];
if(x<64 && x>=0 && y<64 && y>=0){
E[x][y]=1;
f++;
mq2: if(feof(file))
goto mq3;
a=fgetc(file);
if(a!=10)
goto mq2;
goto mq1;
mq3: fclose(file);
//------------------read amino-acid file file1 == P array
if((file=fopen(argv[1],"rb"))==NULL){
printf("\ncan't open file %s\n",argv[1]);exit(1);}
p=0;
m1p: if(feof(file))
goto m2p;
p++;
P[p]=fgetc(file);
if(G[P[p]]==0)
p--;
goto m1p;
m2p:;
fclose(file);
//------------------read nucleotide file file2 == N array
if((file=fopen(argv[2],"rb"))==NULL){
printf("\ncan't open file %s\n",argv[1]);exit(1);
n=0;
m1n: if(feof(file))
goto m2n;
n++;
N[n]=fgetc(file);
if(N[n]!='a' && N[n]!='c' && N[n]!='g' && N[n]!='t')
n--;
goto m1n;
m2n:;
fclose(file);
//for(i=1;i<=p;i++)printf("%c",P<i>);printf("\n");
//for(i=1;i<=n;i++)printf("%c",N<i>);printf("\n");
//printf("%i include-pairs %i nucleotides %i proteins\n",f,n,p);
//------------1st line------------------ B<i> = result
m=0;
for(i=1;i<=p;i++){
n1=T[N[i*3-2]]*16+T[N[i*3-1]]*4+T[N[i*3]];
n2=T[N[i*3+1]]*16+T[N[i*3+2]]*4+T[N[i*3+3]];
//printf("\ni=%i p=%i n1=%i n2=%i\n",i,p,n1,n2);
if(E[n1][n2]<1 || G[P<i>]==G[P[i+1]] /* || i==n */){
printf("%c",P<i>);
m++;
B[m]=P<i>;
goto m3;
printf("(%c%c)",P<i>,P[i+1]);
i++;
m++;
B[m]='(';
m++;
B[m]=P[i-1];
m++;
B[m]=P<i>;
m++;
B[m]=')';
//printf("(%c)%c",G[A<i>],G[A[i+1]]);i++;
m3:;
printf("\n");
//------------2nd line------------------ C<i> = result
m=0;
for(i=1;i<=p;i++){
n1=T[N[i*3-2]]*16+T[N[i*3-1]]*4+T[N[i*3]];
n2=T[N[i*3+1]]*16+T[N[i*3+2]]*4+T[N[i*3+3]];
if(E[n1][n2]<1 || G[P<i>]==G[P[i+1]] /* || i==n */){
printf("%c",P<i>);
m++;
C[m]=P<i>;
goto m4;
printf("(%c%c)",G[P<i>],G[P[i+1]]);
i++;
m++;
C[m]='(';
m++;
C[m]=G[P[i-1]];
m++;
C[m]=G[P<i>];
m++;
C[m]=')';
//printf("(%c)%c",G[A<i>],G[A[i+1]]);i++;
m4:;
printf("\n");
//for(i=1;i<=m;i++)printf("%c",B<i>);printf("\n");
//------------3rd line------------------ printf only
m=0;
for(i=1;i<=p;i++){
n1=T[N[i*3-2]]*16+T[N[i*3-1]]*4+T[N[i*3]];
n2=T[N[i*3+1]]*16+T[N[i*3+2]]*4+T[N[i*3+3]];
if(E[n1][n2]<1 || G[P<i>]==G[P[i+1]] /* || i==n */){
printf("%c%c%c",N[i*3-2],N[i*3-1],N[i*3]);
goto m33;
printf("(%c%c%c%c%c%c)",N[i*3-2],N[i*3-1],N[i*3],N[i*3+1],N[i*3+2],N[i*3+3]);
i++;
m33:;
printf("\n");
//--------------substrings------------
substrings(20,29);
substrings(30,39);
substrings(40,49);
substrings(50,59);
substrings(60,69);
return 0;
int substrings(int x1,int x2)
printf("\n");
printf("lengths %i - %i : \n",x1,x2);
for(i=1; i<p; i++)
for (j=i+x1; j<i+x2; j++) {
if (C<i>>95 && C[j]>95) { // if lc letter in line2
for(x=i;x<=j;x++)
printf("%c",C[x]);
printf("|");
for(x=i;x<=j;x++)
if(B[x]>44) // if not () in line 1
printf("%c",B[x]);
printf("|");
for(x=i;x<=j;x++)
if(C[x]>95) // if lc letter line2
printf("%c",C[x]);
printf("\n");}
input file1.txt
MKKHTDQPIADVQGSPDTRH
IAIDRVGIKAIRHPVLVADK
DGGSQHTVAQFNMYVNLPHN
FKGTHMSRFVEILNSHEREI
SVESFEEILRSMVSRLESDS
GHIEMTFPYFVNKSAPISGV
KSLLDYEVTFIGEIKHGDQY
GFTMKVIVPVTSLCPCSKKI
SDYGAHNQRSHVTISVHTNS
FVWIEDVIRIAEEQASCELF
GLLKRPDEKYVTEKAYNNPK
FVEDIVRDVAEILNHDDRID
AYVVESEBFESIHNHSAYAL
IERD
input file2.txt
atgaaaaaacatactgatcaacctatcgctgatgtgcagggctcaccggataccagacat
atcgcaattgacagagtcggaatcaaagcgattcgtcacccggttctggtcgccgataag
gatggtggttcccagcataccgtggcgcaatttaatatgtacgtcaatctgccacataat
ttcaaagggacgcatatgtcccgttttgtggagatactaaatagccacgaacgtgaaatt
tcggttgaatcatttgaagaaattttgcgctccatggtcagcaggctggaatcagattcc
ggccatattgaaatgacttttccctacttcgtcaataaatcagcccctatctcaggtgta
aaaagcttgctggattatgaggtaacctttatcggcgaaattaaacatggcgatcaatat
gggtttaccatgaaggtgatcgttcctgttaccagcctgtgcccctgctccaagaaaata
tccgattacggtgcgcataaccagcgttcacacgtcaccatttctgtacacactaacagc
ttcgtctggattgaggacgttatcagaattgcggaagaacaggcctcatgcgaactgttc
ggtctgctgaaacggccggatgaaaaatatgtcacagaaaaggcctataacaatccgaaa
tttgtcgaagatatcgtccgtgatgtcgccgaaatacttaatcatgatgaccggatagat
gcctatgttgttgaatcagaaaactttgaatccatacataatcactctgcatacgcactg
atagagcgcgac
input file3.txt
FA tttgcc
FA ttcgcc
FA tttgct
FA ttcgct
LK ttaaaa
LK ttgaaa
LK ttaaag
LK ttgaag
LS ctgctc
LS ctgctt
LS ctactc
LS ctactt
LT ctcacc
LT ctcact
LT cttacc
LT cttact
LY ctctac
LY ctctat
LY ctttac
LY ctttat
LG ctcggc
LG ctcggt
LG cttggc
LG cttggt
IP attccc
IP attcct
IP atcccc
IP atccct
IP attcca
IP attccg
IP atccca
IP atcccg
ML atgctc
ML atgctt
ML atgctc
ML atgctt
VL gtgctg
VL gtgcta
VL gtactg
VL gtacta
VS gtgtcc
VS gtatct
VS gtgtcc
VS gtatct
VT gtcacc
VT gtcact
VT gttacc
VT gttact
VS gtcagc
VS gtcagt
VS gttagc
VS gttagt
SL tcgctg
SL tcgcta
SL tcactg
SL tcacta
SP tctcca
SP tctccg
SP tcccca
SP tccccg
PV ccggtg
PV ccggta
PV ccagtg
PV ccagta
PG cccggc
PG cccggt
PG cctggc
PG cctggt
TL acgctg
TL acgcta
TL acactg
TL acacta
TP acgccg
TP acgcca
TP acaccg
TP acacca
AL gcttta
AL gctttg
AL gcctta
AL gccttg
AP gcgccg
AP gcgcca
AP gcaccg
AP gcacca
AP gctcca
AP gctccg
AP gcccca
AP gccccg
AN gctaat
AN gctaac
AN gccaat
AN gccaac
AS gccagc
AS gccagt
AS gctagc
AS gctagt
YP tatccg
YP tatcca
YP tacccg
YP taccca
HP catccg
HP catcca
HP cacccg
HP caccca
QR cagcga
QR cagcgg
QR caacga
QR caacgg
DL gatttg
DL gattta
DL gacttg
DL gactta
EN gaaaat
EN gaaaac
EN gagaat
EN gagaac
EK gaaaaa
EK gaaaag
EK gagaaa
EK gagaag
ER gagcga
ER gagcgg
ER gaacga
ER gaacgg
WR tggcga
WR tggcgg
RV cgggtg
RV cgggta
RV cgagtg
RV cgagta
RW cggtgg
RW cgatgg
SG agtgga
SG agtggg
SG agcgga
SG agcggg
GF ggtttt
GF ggtttc
GF ggcttt
GF ggcttc
GL gggctg
GL gggcta
GL ggactg
GL ggacta
GY gggtat
GY gggtac
GY ggatat
GY ggatac
GY ggttat
GY ggttac
GY ggctat
GY ggctac
GK ggaaaa
GK ggaaag
GK gggaaa
GK gggaag
GK ggcaag
GK ggcaaa
GK ggtaag
GK ggtaaa
GW ggctgg
GW ggttgg
GR gggcgg
GR gggcga
GR ggacgg
GR ggacga
GS ggcagc
GS ggcagt
GS ggtagc
GS ggtagt
output fileout.txt
MKKHTDQPIADVQGSPDTRHIAIDRVGIKAIR(HP)VLVADKDGGSQHTVAQFNMYVNLPHNFKGTHMSRFVEILNSHEREISVESFEEILRSM(VS)RLESDSGHIEMTFPYFVNKSAPISGVKSLLDYEVTFIGEIKHGDQYGFTMKVIVP(VT)SLCPCSKKISDYGAHNQRSH(VT)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(EK)YVT(EK)AYNNPKFVEDIVRDVAEILNHDDRIDAYVVES(EF)ESIHNHSAYALIERD
MKKHTDQPIADVQGSPDTRHIAIDRVGIKAIR(dp)VLVADKDGGSQHTVAQFNMYVNLPHNFKGTHMSRFVEILNSHEREISVESFEEILRSM(st)RLESDSGHIEMTFPYFVNKSAPISGVKSLLDYEVTFIGEIKHGDQYGFTMKVIVP(st)SLCPCSKKISDYGAHNQRSH(st)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(dt)YVT(dt)AYNNPKFVEDIVRDVAEILNHDDRIDAYVVES(dp)ESIHNHSAYALIERD
atgaaaaaacatactgatcaacctatcgctgatgtgcagggctcaccggataccagacatatcgcaattgacagagtcggaatcaaagcgattcgt(cacccg)gttctggtcgccgataaggatggtggttcccagcataccgtggcgcaatttaatatgtacgtcaatctgccacataatttcaaagggacgcatatgtcccgttttgtggagatactaaatagccacgaacgtgaaatttcggttgaatcatttgaagaaattttgcgctccatg(gtcagc)aggctggaatcagattccggccatattgaaatgacttttccctacttcgtcaataaatcagcccctatctcaggtgtaaaaagcttgctggattatgaggtaacctttatcggcgaaattaaacatggcgatcaatatgggtttaccatgaaggtgatcgttcct(gttacc)agcctgtgcccctgctccaagaaaatatccgattacggtgcgcataaccagcgttcacac(gtcacc)atttctgtacacactaacagcttcgtctggattgaggacgttatcagaattgcggaagaacaggcctcatgcgaactgttcggtctgctgaaacggccggat(gaaaaa)tatgtcaca(gaaaag)gcctataacaatccgaaatttgtcgaagatatcgtccgtgatgtcgccgaaatacttaatcatgatgaccggatagatgcctatgttgttgaatca(gaaaac)tttgaatccatacataatcactctgcatacgcactgatagagcgc
lengths 20 - 29 :
st)SLCPCSKKISDYGAHNQRSH(s|VTSLCPCSKKISDYGAHNQRSHV|sts
st)SLCPCSKKISDYGAHNQRSH(st|VTSLCPCSKKISDYGAHNQRSHVT|stst
t)SLCPCSKKISDYGAHNQRSH(s|TSLCPCSKKISDYGAHNQRSHV|ts
t)SLCPCSKKISDYGAHNQRSH(st|TSLCPCSKKISDYGAHNQRSHVT|tst
lengths 30 - 39 :
st)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(d|VTISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPDE|std
t)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(d|TISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPDE|td
t)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(dt|TISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPDEK|tdt
dt)AYNNPKFVEDIVRDVAEILNHDDRIDAYVVES(d|EKAYNNPKFVEDIVRDVAEILNHDDRIDAYVVESE|dtd
dt)AYNNPKFVEDIVRDVAEILNHDDRIDAYVVES(dp|EKAYNNPKFVEDIVRDVAEILNHDDRIDAYVVESEF|dtdp
t)AYNNPKFVEDIVRDVAEILNHDDRIDAYVVES(d|KAYNNPKFVEDIVRDVAEILNHDDRIDAYVVESE|td
t)AYNNPKFVEDIVRDVAEILNHDDRIDAYVVES(dp|KAYNNPKFVEDIVRDVAEILNHDDRIDAYVVESEF|tdp
lengths 40 - 49 :
st)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(dt)YVT(d|VTISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPDEKYVTE|stdtd
st)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(dt)YVT(dt|VTISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPDEKYVTEK|stdtdt
t)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(dt)YVT(d|TISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPDEKYVTE|tdtd
t)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(dt)YVT(dt|TISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPDEKYVTEK|tdtdt
dt)YVT(dt)AYNNPKFVEDIVRDVAEILNHDDRIDAYVVES(d|EKYVTEKAYNNPKFVEDIVRDVAEILNHDDRIDAYVVESE|dtdtd
dt)YVT(dt)AYNNPKFVEDIVRDVAEILNHDDRIDAYVVES(dp|EKYVTEKAYNNPKFVEDIVRDVAEILNHDDRIDAYVVESEF|dtdtdp
t)YVT(dt)AYNNPKFVEDIVRDVAEILNHDDRIDAYVVES(d|KYVTEKAYNNPKFVEDIVRDVAEILNHDDRIDAYVVESE|tdtd
t)YVT(dt)AYNNPKFVEDIVRDVAEILNHDDRIDAYVVES(dp|KYVTEKAYNNPKFVEDIVRDVAEILNHDDRIDAYVVESEF|tdtdp
lengths 50 - 59 :
t)RLESDSGHIEMTFPYFVNKSAPISGVKSLLDYEVTFIGEIKHGDQYGFTMKVIVP(s|SRLESDSGHIEMTFPYFVNKSAPISGVKSLLDYEVTFIGEIKHGDQYGFTMKVIVPV|ts
lengths 60 - 69 :
dp)VLVADKDGGSQHTVAQFNMYVNLPHNFKGTHMSRFVEILNSHEREISVESFEEILRSM(s|HPVLVADKDGGSQHTVAQFNMYVNLPHNFKGTHMSRFVEILNSHEREISVESFEEILRSMV|dps
dp)VLVADKDGGSQHTVAQFNMYVNLPHNFKGTHMSRFVEILNSHEREISVESFEEILRSM(st|HPVLVADKDGGSQHTVAQFNMYVNLPHNFKGTHMSRFVEILNSHEREISVESFEEILRSMVS|dpst
p)VLVADKDGGSQHTVAQFNMYVNLPHNFKGTHMSRFVEILNSHEREISVESFEEILRSM(s|PVLVADKDGGSQHTVAQFNMYVNLPHNFKGTHMSRFVEILNSHEREISVESFEEILRSMV|ps
p)VLVADKDGGSQHTVAQFNMYVNLPHNFKGTHMSRFVEILNSHEREISVESFEEILRSM(st|PVLVADKDGGSQHTVAQFNMYVNLPHNFKGTHMSRFVEILNSHEREISVESFEEILRSMVS|pst
st)RLESDSGHIEMTFPYFVNKSAPISGVKSLLDYEVTFIGEIKHGDQYGFTMKVIVP(st|VSRLESDSGHIEMTFPYFVNKSAPISGVKSLLDYEVTFIGEIKHGDQYGFTMKVIVPVT|stst
st)SLCPCSKKISDYGAHNQRSH(st)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(d|VTSLCPCSKKISDYGAHNQRSHVTISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPDE|ststd
st)SLCPCSKKISDYGAHNQRSH(st)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(dt|VTSLCPCSKKISDYGAHNQRSHVTISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPDEK|ststdt
t)SLCPCSKKISDYGAHNQRSH(st)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(d|TSLCPCSKKISDYGAHNQRSHVTISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPDE|tstd
t)SLCPCSKKISDYGAHNQRSH(st)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(dt|TSLCPCSKKISDYGAHNQRSHVTISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPDEK|tstdt
t)SLCPCSKKISDYGAHNQRSH(st)ISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPD(dt)YVT(d|TSLCPCSKKISDYGAHNQRSHVTISVHTNSFVWIEDVIRIAEEQASCELFGLLKRPDEKYVTE|tstdtd
Edited by: David Halitsky on Mar 18, 2008 4:21 AM
Edited by: David Halitsky on Mar 18, 2008 4:22 AM -
Hi All,
i've a string holding the value as given below.
AA,17,2/19/2003,"9,999.00",USD,00,10,318,"193,275.31"
by performing some string operations i want the result string in the format as given below:
AA,17,2/19/2003,"9999.00",USD,00,10,318,"193,275.31"
i.e., i want to remove all the commas(,)that are included in between a pair of " " only.
can anyone provide me a sample code for the sameHi vijay,
A bit complex but works for sure, check the following logic,
REPORT zsritest.
DATA: gs_string TYPE string.
gs_string = 'AA,17,2/19/2003,"9,999.00",USD,00,10,318,"193,275.31"'.
WRITE: / gs_string.
PERFORM string_trim CHANGING gs_string.
* FORM string_trim *
* --> LS_STRING *
FORM string_trim CHANGING ls_string.
DATA: lt_string TYPE string OCCURS 0 WITH HEADER LINE,
lv_tabix TYPE i,
lv_start.
SPLIT gs_string AT '"' INTO TABLE lt_string.
CHECK sy-subrc EQ 0.
CLEAR gs_string.
LOOP AT lt_string.
lv_tabix = sy-tabix MOD 2.
IF lv_tabix EQ 0.
TRANSLATE lt_string USING ', '.
CONDENSE lt_string NO-GAPS.
ENDIF.
IF lv_tabix EQ 0 OR lv_start EQ 'X'.
CONCATENATE gs_string lt_string INTO gs_string SEPARATED BY '"'.
IF lv_start EQ 'X'.
CLEAR lv_start.
ELSE.
lv_start = 'X'.
ENDIF.
ELSE.
CONCATENATE gs_string lt_string INTO gs_string.
ENDIF.
ENDLOOP.
IF lv_start EQ 'X'.
CONCATENATE gs_string '"' INTO gs_string.
ENDIF.
WRITE: / gs_string.
ENDFORM.
Hope this helps..
Sri -
Need help in String operations
HI all,
I need help in String operations.I am getting file path of an image as
c:\test\img\abc.gif"
I need to convert it in to c:/test/img/abc.gif".
Can any one suggest the solution for this.
Thanks,
Durga.[email protected] wrote:
I used String replace method but I am not able to do it because "/" is a special character."/" is not a special character, "\" is a special character, which needs to be escaped by "\" itself. -
ABAP String code for String.IndexOf("str")
Hi,
I'm totally new to abap. How can I determine iif one string is in another?
Thanks,
DougHi Doug,
we have the comparison operator CS (contains string).
IF 'My brother loves it' CS 'other'.
evaluates TRUE.
System variable SY-FDPOS will carry the offset where the string starts, here 5.
Although we have ABAP objects now for some time, we are far away from languages like JAVA where all data objects are classes with predefined methods.
But you are welcome to implement something comparable.
Regards,
Clemens -
Performance tuning for String operation in Field routine
Dear Experts,
I am writing a ABAP routine in field level for capturing an occurence of a string.
The string may occur in anny of the values in itab. The ITAB has around 100 thousand records and the source package 400 thousand records.
My coding goes as
LOOP AT INV_ITAB INTO INV_WA.
IF SOURCE_FIELDS-/BIC/X_ASSIGNM CS INV_WA-XFIELD3(7).+
RESULT = INV_WA-PO_NO.
EXIT.
ELSE.
RESULT = 'NA'.
ENDIF.
ENDIF.
Now the coding takes more than 15 hours and still running. (It is working fine for small number of records) .
I beleive the problem is in the LOOP statement (goes around 400000*100000 times). Is it possible for me to somehow improve this code so as to decrease the load time.
Kindly help on this.
Thanks,
Rajarathnam.SHi,
I think you can use this code in your start routine instead of field level it will speed up your process.As it checks on datapacket level instead of checking records one by one.
I am just putting some logic
LOOP AT INV_ITAB INTO INV_WA.
IF Datapackage-/BIC/X_ASSIGNM CS INV_WA-XFIELD+3(7).
Datapackage-targetfield = INV_WA-PO_NO.
EXIT.
ELSE.
Datapackage-targetfield = 'NA'.
ENDIF.
ENDIF.
Regards,
Ravi -
ABAP String processing using normal methods
I have a string like this:
A:12345;B:34324;C:443232;
Question 1)
How do I extract B:34324 from the above string?
Note: I can only use methods provided in ABAP programming (BC-ABA) such as split, CO, CA,etc
Question 2)
How do I know how many ';' characters the string contains?
Question 3)
How do I know the position of "B:" in the string?
Please help.
Thanks and best regards,Hi,
Question 3)
How do I know the position of "B:" in the string?
Check this
DATA a TYPE string value 'A:12345;B:34324;C:443232'.
DATA c TYPE i.
DATA d TYPE c.
DATA e TYPE i VALUE 0.
DATA f TYPE i VALUE 0.
c = STRLEN( a ).
DO c TIMES.
d = a+e(1).
e = e + 1.
f = f + 1.
IF d EQ 'B'.
EXIT.
ENDIF.
ENDDO.
WRITE f.
Thanks -
We have a probrem; our program crashes due to SIGABRT.
Our program is multithreaded (about 40 thread total),and uses libmtmalloc for more performance.
By stack trace , when handling of '==' operator of STL string ,
free() and abort() is called like this:
(dbx) lwp l@25
Current function is WorkSessionCollection::findBySessionId
207 if (session->getSessionId() == sessionId)
t@null (l@25) stopped in (unknown) at 0xfedbd7fc
0xfedbd7fc: PROCEDURELINKAGE_TABLE_+0x0820 [PLT]: bcc,a,pt %icc,_PROCEDURE_LINKAGE_TABLE_+0x830 [PLT] ! 0xfedbd80c
(dbx) where
[1] 0xfedbd7fc(0x6, 0x0, 0xfeda1d04, 0x42568, 0xfede4280, 0x6), at 0xfedbd7fb
[2] getopt(0x0, 0x1, 0xff39403c, 0xa652c, 0xfede7298, 0x0), at 0xfed3de58
[3] free(0x3bc6e00, 0x3bc7020, 0x0, 0x10, 0x0, 0x10000000), at 0xff380b00
[4] libC_errors::get_msg(0x3bc7020, 0xfffb, 0x0, 0xffffffff, 0xa, 0xfc00), at 0xfeef62e0
[5] std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string(0x294, 0x0, 0x3bc7020, 0x3bc7048, 0x3bc7048, 0xf82fa638), at 0xfdb4cccc
=>[6] WorkSessionCollection::findBySessionId(this = 0xbe4750, msgId = CLASS), line 207 in "WorkSessionCollection.cpp"
[7] BusinessProxy::process(this = 0xc18ff8, message = CLASS), line 159 in "BusinessProxy.cpp"
[8] TcpProtocolControl::handleMessage(this = 0x3eaff28, message = 0x3f16270), line 221 in "ProtocolControl.cpp"
[9] SocketHandler::handle_input(this = 0x3871860, _ARG2 = 200), line 229 in "SocketHandler.cpp"
[10] 0xff2e6c90(0x2aa44b8, 0xf82fbc28, 0x0, 0x0, 0x1, 0x0), at 0xff2e6c8f
[11] 0xff2e6640(0x2aa44b8, 0xf82fbcb0, 0xf82fbd2c, 0x0, 0x0, 0x0), at 0xff2e663f
[12] 0xff2e61ac(0x2aa44b8, 0x0, 0xf82fbd2c, 0x0, 0x0, 0x0), at 0xff2e61ab
[13] 0xff2e5e10(0x2aa44b8, 0x0, 0xfede8bc0, 0xfda95800, 0x1e99410, 0x0), at 0xff2e5e0f
[14] 0xff2af7c0(0x281fda0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0xff2af7bf
[15] event_loop(arg = 0x281fda0), line 40 in "FrontEnd.cpp"
[16] 0xff2d4610(0x1ea82b8, 0x8f0798, 0x0, 0x0, 0x0, 0x0), at 0xff2d460f
[17] 0xff2d44ec(0x1ea82b8, 0x0, 0x0, 0x0, 0x0, 0x1), at 0xff2d44eb
[18] 0xff21c590(0x1ea82b8, 0xf82fc000, 0x0, 0x0, 0x7e3f9c, 0x1), at 0xff21c58f
(dbx) list
207 if (session->getSessionId() == sessionId)
208 break; // for loop
209 session = NULL;
210 }
211
(dbx) print sessionId
dbx: cannot access address 0xfdf68f10
(dbx) print *session
dbx: cannot access address 0xfdf68f10
and here is the compiler environment:
versionMachine hardware: sun4u
OS version: 5.9
Processor type: sparc
Hardware: SUNW,Sun-Blade-1500
The following components are installed on your system:
Sun Studio 11
Sun Studio 11 C Compiler
Sun Studio 11 C++ Compiler
Sun Studio 11 Tools.h++ 7.1
Sun Studio 11 C++ Standard 64-bit Class Library
Sun Studio 11 Garbage Collector
Sun Studio 11 Fortran 95
Sun Studio 11 Debugging Tools (including dbx)
Sun Studio 11 IDE
Sun Studio 11 Debugger GUI
Sun Studio 11 Performance Analyzer (including collect, ...)
Sun Studio 11 X-Designer
Sun Studio 11 VIM editor
Sun Studio 11 XEmacs editor
Sun Studio 11 Native Connector Tool
Sun Studio 11 LockLint
Sun Studio 11 Building Software (including dmake)
Sun Studio 11 Documentation Set
version of "/apps/studio_11/SUNWspro/bin/./../prod/bin/../../bin/cc": Sun C 5.8 Patch 121015-04 2007/01/10
version of "/apps/studio_11/SUNWspro/bin/./../prod/bin/../../bin/CC": Sun C++ 5.8 Patch 121017-10 2007/02/21
version of "/apps/studio_11/SUNWspro/bin/./../prod/bin/../../bin/f90": Sun Fortran 95 8.2 2005/10/13
version of "/apps/studio_11/SUNWspro/bin/./../prod/bin/../../bin/dbx": Sun Dbx Debugger 7.5 2005/10/13
version of "/apps/studio_11/SUNWspro/bin/./../prod/bin/../../bin/analyzer": Sun Performance Analyzer 7.5 2005/10/13
version of "/apps/studio_11/SUNWspro/bin/./../prod/bin/../../bin/dmake": Sun Distributed Make 7.7 2005/10/13
could you please help us?
Thanks in advance.This kind of crash can be due to referencing a string object after its lifetime has ended, or due to heap corruption.
The most common sources of heap corruption are
- using an invalid pointer
- uninitialized
- dangling (points to object that no longer exists)
- incremented or decremented outside object bounds
- points other than to an object start address
- deleting an object more than once
- reading or writing outside object bounds
- failing to guard a shared object in multithreaded code
- race condition in multithreaded code
The program failure usually occurs far away in space and time from the actual error condition.
You might also have run into a bug in the compiler or in system libraries. (You do not have the current Studio 11 patches.)
First, try running under the dbx with Run-Time Checking enabled:
% dbx myprogram
(dbx) check -all
(dbx) run
RTC will report many of the error conditions listed above.
Sun Studio 12 has a thread analyzer, which can help find race conditions in multithreaded code. You could download Studio 12 and try it out. If you do not need to run on Solaris 8, you can upgrade to Studio 12.
Whether you stay with Studio 11 or upgrade to Studio 12, you can get all the current patches here:
http://developers.sun.com/sunstudio/downloads/patches/
At minumum, get the current C++ compiler patch, the Common compiler patch, and the C++ Runtime LIbrary patch.
By following the links to the patches, you can see a list of bugs fixed since the patch levels you currently have. -
Example
<?php
$url = '
http://username:password@hostname/path?arg=value#anchor';
print_r(parse_url($url));
echo parse_url($url, PHP_URL_PATH);
?>
output:
Array
[scheme] => http
[host] => hostname
[user] => username
[pass] => password
[path] => /path
[query] => arg=value
[fragment] => anchor
/path
Question:
For example, I want to do something with the host, like run
some string replace operations on it, but how do I access
it?.oO(ttdevelop)
>Example
> <?php
> $url = '
http://username:password@hostname/path?arg=value#anchor';
>
> print_r(parse_url($url));
>
> echo parse_url($url, PHP_URL_PATH);
> ?>
>
> output:
>
> Array
> (
> [scheme] => http
> [host] => hostname
> [user] => username
> [pass] => password
> [path] => /path
> [query] => arg=value
> [fragment] => anchor
> )
> /path
>
> Question:
> For example, I want to do something with the host, like
run some string
>replace operations on it, but how do I access it?
You should read about how to use variables and arrays or use
the second
parameter of parse_url() to only return the host name as a
string like
you did in the second example (see the manual for details).
Then assign
the return value to a variable and you can do whatever you
want with it.
Variables
http://www.php.net/manual/en/language.variables.php
Arrays
http://www.php.net/manual/en/language.types.array.php
parse_url
http://www.php.net/manual/en/function.parse-url.php
Micha -
What is the ABAP code to find the last three characters of a string?
data: c TYPE string VALUE 'this is string',
c1(3),
len TYPE i.
len = STRLEN( c ).
len = len - 3.
c1 = c+len(3).
WRITE / c1.
try this
Edited by: mayank jain on Jul 27, 2009 1:03 PM
Maybe you are looking for
-
Hello, (LabVIEW 8.0): I have found that the font size of the tree view items can be set at design time from the drop down list on the menu bar. However, is it possible to make each "level" (i.e. parent = a level, child = different level, grandchild
-
MaxDB 7.6 carshes on calling stored procedure with driver 7.6
Hi All, Recently I upgraded MaxDB from v7.5 to v7.6 after several hiccups I am almost done but one strange problem remains. I have a stored procedure which is used for generating Bill Of Material (recursive cursor). The said stored procedure uses som
-
Internal sales employee number range
Dear experts, Under the same client in SAP system, different company codes can NOT have different Internal sales employee number ranges in the standard SAP, right? In other words, only one number range actiavtes for all the company codes as long as t
-
Need advice in setting up a portable external hard drive
Since I travel and am away from home for 4-6 months of the year, I would like to to set up an external drive which I can carry with me and will hopefully contain everything I could possibly need to back up and troubleshoot the iBook while away from h
-
No apps or music after restore
I just issued a new iphone 4S per my 1 year factory warranty. I went to restore it and I have no apps or music, only contacts. Please help someone.