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,
Doug

Hi 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

Similar Messages

  • Remote infrared codes for the Sony STR-DE675 receiver

    Where can I find the remote infrared codes for the Sony STR-DE675 receiver? They are not in the Owner's Manual, nor on the Sony.com website. Thanks.GBP

    If you were getting sound and no picture when you had the Wii hooked up to your surround sound receiver, your TV was probably on the wrong input.  You would have needed to use the source or input button on your TV's remote and changed the input to the component 1 choice, since that is the port you stated you plugged the Wii into on the TV.
    Your cable remote may not be programmed to work with the blu-ray player.  However, I think you're misunderstanding the function of the buttons at the top of your remote labeled TV, Sat/Cab, VCR, etc.  Your cable remote doesn't work like a Harmony remote.  Pushing those buttons at the top of your cable remote are not like pushing the Watch TV or Watch DVD functions on a Harmony (meaning pushing them doesn't change the TV's input automatically).  All those buttons at the top of the remote are for that you're describing are to tell the remote which components to control.  For example, you are watching cable TV and just used the remote to change the channel but now you want to adjust the volume.  You would have to hit the "TV" button on the cable remote to switch the remote from controlling the cable box to controlling the TV.  Otherwise, you'd hit the volume controls over and over and nothing would happen b/c the remote would still think it was controlling the cable box.  Only a Harmony remote (or similar universal remote) can change the TV's input with the click of a function button.
    And to explain why one must change the TV's input when switching components, I always compare the process to the way a tube TV used to work for those that are new to the flat screen TVs.  Think of the way your old TV probably worked - you had to have the TV on channel 3 for your VCR, 4 for cable, etc.  The input changing is practically the same thing with just a few more steps, if that helps to make things any clearer.  LOL
    Nothing I post is an official statment of Best Buy or Geek Squad, it is only a helpful opinion!

  • Function Module to get ABAP source code for a specific version

    Hi all
    Is there a function module that I can use to get the source code of another function module at a specific version?
    For example, can I call a function module passing in "FM_NAME" and "FM_VERSION" and have it return the lines of code associated with that object?
    Thanks in advance.
    Stuart

    Thanks guys
    That's incredibly helpful! I have one more question that I just thought of last night...
    Is there a way to hook into the code activation process? I want to be able to take a snapshot of the ABAP source code at each point when it is activated for use in another system, but need to be able to intercept this event and get the source code at that point in time.
    Any ideas?
    Thanks!

  • ABAP Routine code for the below logic

    Hello BW Experts ,
    I need to write a complex ABAP routine in BW .
    Following is the detail explaination .
    Can anyone tell me the ABAP code for the below logic?
    It would be a greate help as I am unable to do this
    since last two days.
    WBS Elements are maintained at  IOS and  Warranty levels in R/3 side.
    The IOS WBS is a top level of WBS element and below that the Warranty WBS level.
    The IOS and Warranty WBS elements can be differentiated by means of priority field.
    When priority = i   , WBS Element is known as  IOS Level WBS Element and
    When  priority = Y the WBS element is known as Warranty WBS element.
    The Equipment Number is maintained compulsorily at IOS Level WBS elements only.
    It is not maintained at  Warranty WBS Element.
    But the Cost is maintained at Warranty WBS Elements.
    In BW I need all Warranty WBS ( priority = Y) along with their cost figures and Equipment Numbers.
    But as the Equipment Number is not maintained compulsorily at Warranty WBS level we have asked to
    Copy it from  IOS WBS ( priority = i ) and assign it to Warranty WBS level ( priority = Y ).
    So I have included the Equipment Number in the ODS and in update rules I need to write the routine for it as
    per the above logic.
    The Equipment Number is coming from Master data of  WBS Element.
    The WBS element master data we are loading in BW .
    Also the same WBS Element transaction data is coming from the transaction data data source in BW.
    Following fields / infoobjects and the table names in BW :
    1. Equipment Number : /BIC/ZEQUIPMNT  and table name /BIC/MZWBS_ELEM.
    2. WBS Element       : ZWBS_ELEM  is coming from transaction data data source as well as master data.
                                     In ODS update rules it is coming from  transaction data data source Comm_structure-ZWBS_ELEM.
                                     Also we are loading separetly the master data for ZWBS_ELEM.
                                     The  ZEQUIPMNT is an attribute of ZWBS_ELEM.
    3. Priority                :  PRIORITY     and table name /BIC/MZWBS_ELEM.
                                      The info object name for Priority is 0Priority but in master data table /BIC/MZWBS_ELEM
                                      the field name is    PRIORITY.
                                     When PRIORITY = ' i ' then    ZWBS_ELEM is at IOS Level
                                     When PRIORITY = ' y ' then  ZWBS_ELEM is at Warranty Level.
    4. ODS name :  /BIC/AZCOST00 and same is table name active data table .
    So please tell me the routine Code .
    Best Regards ,
    Amol.

    Hi Dinaker,
    Did you find any solution for this issue. I too have a similar requirement of pulling all the service orders for a specific Purchase Order in the BW report.
    Thanks,
    SAPBWI

  • Search a String Vector for String

    I can't figure out why this won't work. It is supposed to search the id vector for stringValue. It does not return any compilation errors, it just simply won't match stringValue with the id.get(i) method.
            for ( int i = 0; i < id.size(); i++ )
              if ( stringValue == id.get(i) )
                JOptionPane.showMessageDialog( null, "Item already exist.", "Error", JOptionPane.ERROR_MESSAGE );
                stringValue = null;
            }

    "==" tests for object equality (i.e., that two variables contain the exact same object)
    "equals()" tests for object equivalence (i.e., that two objects have the same value, whether or not they are the same object)
    For strings, it's possible to have two different strings to contain the same sequence of characters. In this case, "==" returns false, while "equals()" returns true.

  • ABAP Sample code for HR_MAINTAIN_MASTERDATA

    Hi folks,
    I want to delimit a record in the HR master Table wi the help of Function Module HR_MAINTAIN_MASTERDATA, but its not updating HR master table correctly so please send me some sample code for that function module.
    usefull points will rewarded.
    Reg,
    Hariharan

    hi
    good
    check with this code
    Call update function module:
          CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'
            EXPORTING
              PERNR           = SS300_0001T-PERNR
              ACTIO           = OPERATION
              BEGDA           = VALIDITYBEGIN
              ENDDA           = '99991231'
              SUBTY           = SPACE
              NO_ENQUEUE      = SPACE
            IMPORTING
              RETURN1         = RETURN
            TABLES
              PROPOSED_VALUES = VALUES
            MODIFIED_KEYS   =
            EXCEPTIONS
              OTHERS          = 1.
          IF RETURN IS INITIAL.
            CONCATENATE SS300_0002-VORNA SS300_0002-NACHN
              INTO ENAME SEPARATED BY SPACE.
            CONDENSE ENAME.
            MESSAGE S006 WITH ENAME SPACE.
          ELSE.
            MESSAGE ID     RETURN-ID
                    TYPE   'S'
                    NUMBER RETURN-NUMBER
                    WITH   RETURN-MESSAGE_V1 RETURN-MESSAGE_V2
                           RETURN-MESSAGE_V3 RETURN-MESSAGE_V4.
          ENDIF.
    http://help.sap.com/saphelp_nw04/helpdata/en/f1/0ce464dc8b11d2803800c04f99fbf0/content.htm
    reward point if helpful.
    thanks
    mrutyun^

  • Help. Need code for string verification

    I am trying to create a swing program that will verify a string then move a directory from a CD to the users hard drive. I have tried many different combinations of code with no success. I simply need a window with a text pane and a button that when clicked copies the content of the windows clipboard into the text pane, then compares it to a predefined string, then moves a directory from a CD to the harddrive.
    It seems very simple but I am new to java, with alot of c++ experiance, and I cant seem to get it to work. If someone could help me out here it would be much apprecaited. Thank you and sorry if I am not using the correct terminology, I tried to be as clear as possible.

    Here is the code: I just decided to make it command line instead of a GUI; I had too many problems.
    The code runs fine but for some reason i get this error when you get to the part about copying the file:
    123456789
    Verification complete copying files.
    Exception in thread "main" java.io.FileNotFoundException: C:\copy (Access is denied)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileReader.<init>(FileReader.java:55)
    at CompString.main(CompString.java:20)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 5 seconds)
    Here is the code:
    import java.io.*;
    import java.io.File;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    public class CompString{
    public static void main(String[] args) throws IOException{
    System.out.println("Please go to http://mytatwear.com/verify.html and follow the instructions");
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Please enter number provided on the website");
    String str1 = bf.readLine();
    String str2 = "123456789";
    if (str1.equals(str2)){
    System.out.println("Verification complete copying files.");
    File inputFile = new File("C:\\copy");
    File outputFile = new File("C:\\tearwear");
    FileReader in = new FileReader(inputFile);
    FileWriter out = new FileWriter(outputFile);
    int c;
    while ((c = in.read()) != -1)
    out.write(c);
    in.close();
    out.close();
    else{
    System.out.println("The number is not valid");
    I had tried to change the permissions on the folder so it is not "Read only" but whenever my program access's it it is for some reason read only.
    Any help apprecaited

  • How do i write UTF convertor in ABAP  sample code for ABAP please

    How do i write UTF convertor in ABAP
    Regards,
    Jagrut BharatKumar Shkla

    you want to convert a string to utf format?
    try this code
    app_type = 'text/xml; charset=utf-8'.
    call function 'SCMS_STRING_TO_XSTRING'
      exporting
        text     = xml_string
        mimetype = app_type
      importing
        buffer   = xl_content.
    concatenate  cl_abap_char_utilities=>byte_order_mark_utf8
                 xl_content
                 into xl_content in byte mode.

  • ABAP Query Code for Count Function

    Hi,
    I have an ABAP Query and just created a new field which requires ABAP Code to do the following :-
    The report is for Purchase Orders and Purchase Requisitions. 2 Purchase Orders may have the same requisition, so what I want to do is count the number of the same requisitions in the report
    e.g.
    PO                Req             Count
    45000001     10015              2
    45000020     10015              2
    Can some one please provide with the full code? Points will be awarded
    Thanks

    Hi,
    No errors in the below code but it is bringing a value 0 even though there are duplicates in the table which is suggesting to me that the code is not working.
    Any help would be appreciated. Thanks
    DATA : BEGIN OF itab OCCURS 0,
            aufnr LIKE ekkn-aufnr,
           END OF itab.
    DATA : count(2) TYPE p.
    DATA : no_of_records(3) TYPE p.
    Clear no_of_records.
    select aufnr from ekkn into itab.
    endselect.
    SORT itab BY aufnr.
    LOOP AT itab.
      ADD 1 TO count.
      AT END OF aufnr.
        IF count GE 2.
          ADD count TO no_of_records.
        ENDIF.
        CLEAR count.
      ENDAT.
    ENDLOOP.
    *WRITE :/ 'Good Bye'.
    DUPLICATES = NO_of_records.

  • String[] args fights String... args

    Hi,
    I thought this error message was a joke at first, but it's for real:
    Arrayz.java:15: cannot declare both in(java.lang.String,java.lang.String[]) and in(java.lang.String,java.lang.String...) in krc.utilz.ArrayzPlease, would anyone care to offer an opinion as to WHY the compiler does not differentiate between String[] args and String... args. Obviously String... args is implemented internally as String[] args, but that really shouldn't effect the interface... and if they are internally equivalent then wny not allow a syntax that effectively declares both in one... It's just that I would have thought it was possible (and desirable) for the compiler & JVM to do the required parameter matching for both definitions... in my mind the calling parameter list of (String, String, String) is distinct from (String, String[]) ... Or does java (like C/C++) internally not differentiate between the types reference-to-String and reference-to-array-of-Strings and reference-to-array-of-array-of-Strings ????
    I'm just a tad miffed about this... I mean, it's easy to work around in at least a dozen simple ways, it's just that the compiler didn't do what I expected it to do, so it should just pull it's socks up, and, well, you know, Work!
    Here's the code... complete with compiler error.
    package krc.utilz.stringz;
    public class Arrayz
        * returns true if the given value is in the args list, else false.
        * @param value - the value to seek
        * @param args... - variable number of String arguments to look in
      public static boolean in(String value, String... args) {
        for(String a : args) if(value.equals(a)) return true;
        return false;
      //Arrayz.java:15: cannot declare both in(java.lang.String,java.lang.String[]) and in(java.lang.String,java.lang.String...) in krc.utilz.Arrayz
      public static boolean in(String value, String[] array) {
        for(String s : array) if(value.equals(s)) return true;
        return false;
    }Thanx all. Keith.

    I didn't know that. Cool!
    package forums;
    class VarArgsTester
      public static String join(String FS, String... args) {
        if (args==null) return null;
        if (args.length==0) return "";
        StringBuffer sb = new StringBuffer(args[0]);
        for (int i=1; i<args.length; i++) {
          sb.append(FS+args);
    return sb.toString();
    public static void main(String[] args) {
    System.out.println(join(" ", "Your", "momma", "wears", "army", "boots"));
    String[] words = {"But", "she", "looks", "very", "nice", "in", "them"};
    System.out.println(join(" ", words));
    I was expecting a compiler error from the line[
    pre]System.out.println(join(" ", words));
    Thanks ~Puce.

  • Program for string comparision in ABAP

    Hi,
    I require a program in abap for string comparision

    Comparing Strings
    Similarly to the special statements for processing strings, there are special comparisons that you can apply to strings with types C, D, N, and T. You can use the following operators:
    <operator>
    Meaning
    CO
    Contains Only
    CN
    Contains Not only
    CA
    Contains Any
    NA
    contains Not Any
    CS
    Contains String
    NS
    contains No String
    CP
    Contains Pattern
    NP
    contains No Pattern
    There are no conversions with these comparisons. Instead, the system compares the characters of the string. The operators have the following functions:
    CO (Contains Only)
    The logical expression
    <f1> CO <f2>
    is true if <f1> contains only characters from <f2>. The comparison is case-sensitive. Trailing blanks are included. If the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the offset of the first character of <f1> that does not occur in <f2> .
    CN (Contains Not only)
    The logical expression
    <f1> CN <f2>
    is true if <f1> does also contains characters other than those in <f2>. The comparison is case-sensitive. Trailing blanks are included. If the comparison is true, the system field SY-FDPOS contains the offset of the first character of <f1> that does not also occur in <f2>. If it is false, SY-FDPOS contains the length of <f1>.
    CA (Contains Any)
    The logical expression
    <f1> CA <f2>
    is true if <f1> contains at least one character from <f2>. The comparison is case-sensitive. If the comparison is true, the system field SY-FDPOS contains the offset of the first character of <f1> that also occurs in <f2> . If it is false, SY-FDPOS contains the length of <f1>.
    NA (contains Not Any)
    The logical expression
    <f1> NA <f2>
    is true if <f1> does not contain any character from <f2>. The comparison is case-sensitive. If the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the offset of the first character of <f1> that occurs in <f2> .
    CS (Contains String)
    The logical expression
    <f1> CS <f2>
    is true if <f1> contains the string <f2>. Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the offset of <f2> in <f1> . If it is false, SY-FDPOS contains the length of <f1>.
    NS (contains No String)
    The logical expression
    <f1> NS <f2>
    is true if <f1> does not contain the string <f2>. Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the offset of <f2> in <f1> .
    CP (Contains Pattern)
    The logical expression
    <f1> CP <f2>
    is true if <f1> contains the pattern <f2>. If <f2> is of type C, you can use the following wildcards in <f2>:
    for any character string *
    for any single character +
    Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the offset of <f2> in <f1> . If it is false, SY-FDPOS contains the length of <f1>.
    If you want to perform a comparison on a particular character in <f2>, place the escape character # in front of it. You can use the escape character # to specify
    characters in upper and lower case
    the wildcard character "" (enter # )
    the wildcard character "" (enter # )
    the escape symbol itself (enter ## )
    blanks at the end of a string (enter #___ )
    NP (contains No Pattern)
    The logical expression
    <f1> NP <f2>
    is true if <f1> does not contain the pattern <f2>. In <f2>, you can use the same wildcards and escape character as for the operator CP.
    Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the offset of <f2> in <f1> .
    DATA: F1(5) TYPE C VALUE <f1>,
          F2(5) TYPE C VALUE <f2>.
    IF F1 <operator> F2.
       WRITE: / 'Comparison true, SY-FDPOS=', SY-FDPOS.
    ELSE.
       WRITE: / 'Comparison false, SY-FDPOS=', SY-FDPOS.
    ENDIF.
    The following table shows the results of executing this program, depending on which operators and values of F1 and F2.
    <f1>
    <operator>
    <f2>
    Result
    SY-FDPOS
    'BD '
    CO
    'ABCD '
    true
    5
    'BD '
    CO
    'ABCDE'
    false
    2
    'ABC12'
    CN
    'ABCD '
    true
    3
    'ABABC'
    CN
    'ABCD '
    false
    5
    'ABcde'
    CA
    'Bd '
    true
    1
    'ABcde'
    CA
    'bD '
    false
    5
    'ABAB '
    NA
    'AB '
    false
    0
    'ababa'
    NA
    'AB '
    true
    5
    'ABcde'
    CS
    'bC '
    true
    1
    'ABcde'
    CS
    'ce '
    false
    5
    'ABcde'
    NS
    'bC '
    false
    1
    'ABcde'
    NS
    'ce '
    true
    5
    'ABcde'
    CP
    'b'
    true
    1
    'ABcde'
    CP
    '#b'
    false
    5
    'ABcde'
    NP
    'b'
    false
    1
    'ABcde'
    NP
    '#b'
    true
    5
    goto sap library if intsalled in ur system and check the above one....

  • SQL Command code for multiple value string parameter

    Hi,
    I'm using crystal 2008 and there is a check box for multiple value  SQL Command  I need some help in writing the SQL Command code  for oracle (or sql server) for a multiple value STRING  parameter.
    Thanks in advance,
    Marilyn

    I could be wrong here, but I do not believe you can pass a multiple valued parameter to an SQL Command data source.  How I have gotten around this in the past is to put the "real" report into a subreport.  In the main report, create a formula field (basic syntax):
    formula = join({?parameter}, "|")
    Then, use this to pass the selected values to the subreport's parameter (call it {?sr-parm}).  The SQL Command in the subreport can then use that (MS SQL):
    select *
    from table
    where charindex(table.field, '{?sr-parm}') > 0
    HTH,
    Carl

  • Ios 6 orientation doesn't work and boot time increases. How to solve these issues for dummy? I don't understand code and strings suggested by others.

    I just upgraded from ios 5 to ios 6 on my ipad2. Now orientation doesn't work properly. Boot time increase, it takes longer time to boot. Is there any configuration to solve these issues? I can't understand the explanation with code and strings found on google to solve the orientation issue. Any easy configuration for dummy ?

    It supports well for ios 5. I couldn't remember (5.x.x) exactly but I always keeps update for ios5 and the abnormality starts when I upgraded to ios 6.

  • Tools for extracting strings from java code for internationalization

    For legacy code with lots and lots of strings what method is typically used to extract strings for internationalization?
    Am I right in thinking you couldnt simply grep for strings, it could get pretty complitcated, especially with escape characters, escaped quotes etc.,
    -SK

    When dealing with legacy code, it is nice to have an application that queries you as it extracts the strings. You have a choice whether to accept the string as a localizable entity or not.
    There are several tools that do this...including some IDEs like JBuilder. Although it isn't a fully supported or robust tool, Sun has a utility for extracting strings in Java source files:
    http://java.sun.com/products/jilkit/.
    Regards,
    John O'Conner

  • Format Codes for the Time Format String

    Hello guys...
    I have 1 simple question.How to write a code in time format string.for example...%H%M%S for HH:MMS.So I want to add fractional seconds in this code...refer to the labview help,the code for fractional seconds is <%<digit>u>.But I'm little bit confuse just now.Should I put like this : %H%M%S%digitu. Or any other else?...thank u

    Just convert it to a date/time record and use "unbundle by name" to pick all the parts you want.
    (You only need to show the outputs you need)
    Message Edited by altenbach on 09-10-2007 12:01 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    GetTimeComponents.png ‏3 KB

Maybe you are looking for

  • Audio lag from Canon XHA1 speaker during log and capture

    Hey All, I'm working with a Canon XHA1. I'm logging and capturing video shot in HDV (1920 by 1080) @ 60i, . I can see the video on screen but the audio playing back from the camera is about half a second behind what I'm seeing on screen. My video mon

  • Can't sync music on 3rd gen ipod touch

    I recently recieved a new laptop running windows 8.1 and at least three quarters of my music downloads will not sync to my ipod. I keep getting anywhere from file cannot be converted to unknown error has occurred. Yes some of these were downloaded fr

  • Gl Balance carry forward

    Dear SIr, In 2006 my GL balance was not transferred to 2007 , while making balance sheet for year 2008 there was a difference in opening balance. When looked to the matter found that the closing balance for 2006 was not transferred to 2007. So how ca

  • XSQL-007: Database connection refused

    I am running Demos on JavaWebServer, IE 5.0, Oracle Lite database. When I am trying to access http://Computer:port/xsql/demo/helloworld.xsql it is giving me this error, any thoughts... XSQL-007: Cannot acquire a database connection to process page. C

  • Submit SharePoint app to Office app store, this app need to add file to hosted web style library

    I want to submit SharePoint app to Office app store, I road the "Validation policies for the apps submitted to the Office Store : "http://msdn.microsoft.com/en-us/library/office/jj220035(v=office.15)  and the  Point 5.9 mention:  "Your app for ShareP