How to find Length of String

Hi
how to find length of a string.. i have a requirement that user cannot add more than 9 digits in a string.. i am new to WD Abap..
Regards,
Puneet

Hi,
You can use STRLEN command for your requirement.
First read your input field using code wizard.
Then using STRLEN command you can find the length of the Input field.
For Example :
Here input is your input field.
data :    length type i.
length = strlen(input).
If length < 9.
raise error msg.
endif.
Edited by: Viji on Mar 26, 2008 11:30 AM

Similar Messages

  • How to find length of string after encryption using DBMS_CRYPTO package

    Hi,
    I am planning do data encryption using DBMS_CRYPTO package. I want to find how much will be string length after encryption.
    e.g When I try to encrypt string of length between 1-15 characters it gives me encrypted string of 32 characters. When I try with 16 charcters encrypted string is of 64 characters.
    Is ther any formula to calculate length of encrypted string?
    Thanks
    Pravin

    The length change is dependent upon the algorithm you are using which can be a combination of cipher block, padding, and chaining.
    The best solution is determine the method you are going to use and apply it to the l ongest possible strings you are going to proces, then add some safety margin. There iis no penalty for defining your column as VARCHAR2(4000).

  • How to find the CONNECTION STRING

    how to find the connection string through SQL Statement?
    salahuddin/salahuddin@CONNECTION_STRING
    Below is all about my sql version:
    DEFINE SQLPLUSRELEASE = "800060000" (CHAR)
    DEFINE _EDITOR         = "Notepad" (CHAR)
    DEFINE OVERSION = "Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options" (CHAR)
    DEFINE ORELEASE = "1002000100" (CHAR)

    In windows XP plateform your can find from the ServicesHow can you do that using SQL statement? Plus connect strings are not available in Services. In post 9i SQL*Plus we can do it in SQL statement like this
    SELECT '&&_CONNECT_IDENTIFIER'
    FROM dual;
    Note: This will work only in SQL*Plus.

  • How to find the last string value in dynamic object?

    Hi All,
    I am trying to find the last string value in dyanamic objects,Any one have solution for this.
    Ex:
    my data :12347-ebjdone-525-ecgfjf-25236-defdafgdeg
    And i want to show the output is :defdafgdeg
    Any ideas:
    Thanks
    Srini

    For oracle try using oracle function.
    e.g.
    SELECT  reverse(substr(reverse('12347-ebjdone-525-ecgfjf-25236-defdafgdeg'),1,instr(reverse('12347-ebjdone-525-ecgfjf-25236-defdafgdeg'),'-','1'))) from dual
    Object definition might look like:
    reverse(substr(reverse({ObjectName}),1,instr(reverse({ObjectsName}),'-','1')))
    Regards,
    Kuldeep
    Edited by: Kuldeep Chitrakar on Feb 12, 2010 8:12 AM

  • How to find length of a string in JSF using EL expressions.

    I am doing it as below for finding string length
    <c:set var="test" value="#{myPageBean.myMethod.length()}" />
    While evaluating the above expression,it will call getMyMethod() which will return a String. On that it will call length().
    But it this throwing parsing error,
    Is it different in JSF?..Pls help.

    BabuKhan wrote:
    I have imported the taglib in th below 3 ways and tried
    1. <anyxmlelement xmlns:fn="http://java.sun.com/jsp/jstl/functions" />
    2. <anyxmlelement xmlns:fn="http://java.sun.com/jstl/functions" />
    3. <anyxmlelement xmlns:fn="http://java.sun.com/jsf/functions" />
    Literally? Do you understand the meaning of "anyxmlelement" ?

  • How to find length of integer elements using message mapping

    Hi all,
             How can I find the number of digits in an element using message mapping
    XIer

    Satish,
               Cause I have to write the code for 100 elements, I have decided to have a AUDF with two inputs;
    1) for the element
    2) for the length of the data type (I am passing length using Constant message mapping func).
    Now when I change my UDF and try running it I get the following error:
    <b><i>Start of test
    Source code has syntax error:  /usr/sap/B06/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map0999e66045cf11dcc83b4ebcfc11da82/source/com/sap/xi/tf/_MM_Recordcount1_.java:160: operator >= cannot be applied to int,java.lang.String if(Element_Name.length()>=Element_Length) ^ /usr/sap/B06/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map0999e66045cf11dcc83b4ebcfc11da82/source/com/sap/xi/tf/_MM_Recordcount1_.java:166: operator <= cannot be applied to int,java.lang.String for(int i=Element_Name.length();i<=Element_Length;i++) ^ 2 errors</i></b>
    The code I have used is:
    public String Include_Space(String Element_Name,String Element_Length,Container container)
    {StringBuffer sb= new StringBuffer();
    if(Element_Name.length()>=Element_Length)
    return""Element_Name"";
    else
    for(int i=Element_Name.length();i<=Element_Length;i++)
    if(i==Element_Name.length())
    sb.append(Element_Name);
    else
    sb.append(" ");
    return ""sb.toString()"";
    Pls advice, where I am going wrong...
    XIer
    Message was edited by:
            XIer

  • How to find length(in Bytes) of an Inputstream

    Hi ,
    I have a dynamic InputStream which is coming from a HTTPRequest .
    My requirement is to read the data in stream more than once . If i read the data using read(), it will read the entire data and for the subsequent reading it is not allowing .
    So, is there any way to read a stream more than once .
    Is it possible to get the length(in Bytes) of an InputStream

    rajeshreddyk wrote:
    My requirement is to read the data in stream more than once . If i read the data using read(), it will read the entire data and for the subsequent reading it is not allowing .
    So, is there any way to read a stream more than once .Store the data somewhere on your end, then re-read as often as you fancy.
    PushbackInputStream may offer the desired functionality, IF you know the message size in advance (which you should, if it's HTTP). I'm not quite certain it should be used for very large streams, though.
    Alternatively (and probably better), write all your data once to a BAOS, and re-read from it (using a BAIS).
    Is it possible to get the length(in Bytes) of an InputStreamNo, not as such.
    However, a specific protocol may stipulate that the message size should be written to the stream (as data), and thus the recieving end would know how much data there is to read.
    In HTTP, this is handled with the Content-Length header parameter.

  • How to find length of a composition in 'time' not 'bars'?

    I'm sure this must be obvious, but when composing in Garageband 2.0 for iOS, how can I tell how long my composition is in actual time? All I can see is bar numbers, rather than the option to switch to viewing in minutes and seconds. If I need to compose a piece that is (say) 1 minute in length (eg to match a video being made in iMovie), how can I tell this while composing? I know it's easy in Garageband for Mac, and I often switch back and forth between bars and time, but on iOS I must be blind I don't want to have to guess....
    Thanks for your help!
    Carol

    Thank you, léonie. I was afraid it might be something like this. I'm working with some younger students in a school, and want to make it easy for them, without all the calculations  I thought someone else might have had the same problem, but I can't see any other questions along this line. Hence, I assumed I was missing something simple!
    We'll see what else eventuates!

  • How to find a specific string in Entire database?

    Well i know this question is posted numerous times here but i m complete noob understanding the solution given on the net.
    Let me introduce the entire scenario .
    We have an application, which keeps on sending emails from an X employees account.
    We are using Oracle 11g as database .But the problem is we don't know which table to search for the value.
    All we have is Database credentials and x employee's name.
    Is there any way we can find out which table contains the name so that we can change it accordingly.
    I m using plsql developer to connect to the database.
    One solution that we got from internet goes as below.
    Ref:
    [http://www.club-oracle.com/articles/oracle-find-all-tables-with-column-value-154/ |http://www.club-oracle.com/articles/oracle-find-all-tables-with-column-value-154/ ]
    As per the solution i had to create a procedure as below .
    create or replace
    procedure find_string( p_str in varchar2 )
    authid current_user
    as
    l_query long;
    l_case long;
    l_runquery boolean;
    l_tname varchar2(30);
    l_cname varchar2(30);
    type rc is ref cursor;
    l_cursor rc;
    begin
    dbms_application_info.set_client_info( '%' || upper(p_str) || '%' );
    for x in (select * from user_tables )
    loop
    l_query := 'select distinct ''' || x.table_name || ''', $$
    from ' || x.table_name || '
    where ( 1=0 ';
    l_runquery := FALSE;
    l_case := NULL;
    for y in ( select *
    from user_tab_columns
    where table_name = x.table_name
    and data_type in ( 'VARCHAR2', 'CHAR' )
    loop
    l_runquery := TRUE;
    l_query := l_query || ' or upper(' || y.column_name ||
    ') like userenv(''client_info'') ';
    l_case := l_case || '||'' ''|| case when upper(' || y.column_name ||
    ') like userenv(''client_info'') then ''' ||
    y.column_name || ''' else NULL end';
    end loop;
    if ( l_runquery )
    then
    l_query := replace( l_query, '$$', substr(l_case,8) ) || ')';
    begin
    open l_cursor for l_query;
    loop
    fetch l_cursor into l_tname, l_cname;
    exit when l_cursor%notfound;
    dbms_output.put_line
    ( 'Found in ' || l_tname || '.' || l_cname );
    end loop;
    close l_cursor;
    end;
    end if;
    end loop;
    end;
    Well i have copied the code to sql window in plsql and executed .But whenever i compile the procedure it says there is an error .
    Not sure what kind of error hidden in the procedure.
    If any 1 has any better idea please share.
    Edited by: Milind on Apr 12, 2012 8:45 PM

    Girish Sharma wrote:
    Milind,
    I am not sure what / which error about your talking, but there is no error/issue at my end when I ran your procedure code :
    1.I just pasted the code in sqlplus window, it showed me Procedure created. message.
    2.I just checked with show errors command, it showed me No errors.
    3.I just tried to run it with :
    SQL> SET SERVEROUTPUT ON;
    SQL> exec find_string('SCOTT');
    Found in EMP.ENAMENo issue error.
    But whenever i compile the procedure it says there is an error .
    SQL> alter procedure find_string compile;
    Procedure altered.
    SQL> exec find_string('SCOTT');
    PL/SQL procedure successfully completed.
    SQL> set serveroutput on;
    SQL> exec find_string('SCOTT');
    Found in EMP.ENAME
    PL/SQL procedure successfully completed.
    SQL>So, there is no error at my end 11.2.0.1 windows box.
    Regards
    Girish Sharma
    Edited by: Girish Sharma on Apr 13, 2012 11:20 AMThanks it worked for me.

  • How to check length of string attribute(from viewobject) on jspx ?

    Hi,
    JDEV : 11.1.1.4
    I am using carousel component inside that i am using Descrip attribute to show the content on carousel item,
    Now i want to display a more link , whenever the length of Descrip is greater than 150 characters.
    Currently from backing bean i am setting the chklength property based on length to true or false but the problem is i need to set a partial target
    and because of that my carousel component i getting refreshed every time.. is there any way to check the length in jspx page itself inside the vissible property
    this is my code
    <af:outputText value="#{item.bindings.Descrip.inputValue}"
                                                             id="ot49"/>
                                               <af:commandImageLink text="more.." id="moreid" shortDesc="click to see more.."
                                                                     visible="#{pageFlowScope.chklength}">
                                                <af:showPopupBehavior popupId="::p1"/>
                                                </af:commandImageLink>              thanks
    Gopinath

    i have added taglib like this,
    xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    but its showing error on below expression
    visible="${fn:length(item.bindings.Descrip.inputValue) > 150}"
    error : BooleanSimnpleTypeConvertor:"${fn:length(item.bindings.Descrip.inputValue) > 150}" cannot be converted to this type

  • How to find length of a character variable in sap script

    Hi,
    I have stored a line of text in one variable. If the text exceeds more than 50 characters, the remaining characters will be printed in next line.
    For this i have given code as :
    <I>&S_BOL_SUMMARY-TXT(50)&</>
    <I>&S_BOL_SUMMARY-TXT+50&</>
    The problem is i have to print the second line only when the text exceeds more than 50 characters. So how can i give the condition for that?
    Ezhil

    Hi,
    Try the following,
    data: len type i.
    len = strlen (S_BOL_SUMMARY-TXT ).
    if len > 50.
    &S_BOL_SUMMARY-TXT(50)&
    &S_BOL_SUMMARY-TXT+50&
    else.
    &S_BOL_SUMMARY-TXT(50)&
    endif.

  • Determine length of string without function module

    hai experts,
    i need to know how to determine length of string without function module strlen'
    regards,
    karthik

    Please SEARCH in SCN before posting.

  • How to find the number of occurence of a string

    String str="The AR tech seeks experienced candidates in java,jsp. The candidates should have atleast 1 year of experience in the specified skills.";
    here i need to find the number of occurence of the string "experience".
    how to find it out?

    String str="The AR tech seeks experienced candidates in java,jsp. The candidates should have atleast 1 year of experience in the specified skills.";
    String findStr = "experience";
    int count = 0;
    int index = 0;
    while(index != -1) {
    index = str.indexOf(findStr, (count == 0 ? 0 : index + findStr.length()));
    if(index != -1) {
    count++;

  • How to find number of characters in a character string

    Hi,
      Can anyone please tell me about how to find the number of characters in a character string type variable.
    Reagards,
    Siva

    hi,
    Use STRLEN for Calculating String Length..
    Assign it to integer variable for Further Use.Suppse u need to find string length for "hai".. this piece of code will help u
    data:  var type string value 'hai',
             len type i.
    len = strlen(var).
    write len.

  • How to find out how many space character in setence (string var) ?

    Dear all Master,
    I need Your help please.
    Topic:
    Script Editor.
    My System:
    -CUCM 7.0
    -UCCX 7.0 premium
    -Nuance recognizer 9.0
    Question:
    ABC = string var.
    ABC = "this is sample"
    2 space character in ABC string var.
    How to find out how many space character in ABC var ?
    Regards,
    Susanto

    Hi
    Create a int variable called whatever you want, then insert a SET step.
    Set the variable to the new int you created, and then paste this into the 'value' field:
    String[] myarray = teststring.split(" ");
    return myarray.length -1 ;
    Basically it splits the string into chunks each time it hits the " " character.
    This results in an array of the resulting chunks (i.e. words), which is one more than the number of spaces. -1 from that, and you have your int variable set to the number of spaces.
    Regards
    Aaron
    Please rate helpful posts...

Maybe you are looking for

  • Internet Access from Inside to Outside ASA 5510 ver 9.1

    Hi everyone, I need help setting up an ASA 5510 to allow all traffic going from the inside to outside so I can get internet access through it. I have worked on this for days and I have finally got traffic moving between my router and my ASA, but that

  • Deleted iPhoto 5, do not have backup iphoto disk, where to go from here?

    I deleted iphoto 5 on my ibook G4 because it kept crashing and wasn't responding properly. I cannot find the iphoto disk to re-install it, and have tried installing 6, yet since it reads that I do not have any sort of iphoto app on my computer I cann

  • How to get notes on iPad 2 to sync with iMac.

    My Notes ("yellow-ruled tablet icon) sync via iCloud with my iPhone, but I can't find it on my iMac?  Where is this app located on the iMac?  Thank for help!

  • Not able to see useSecurity property in the Managed BPEL Domain page

    Hi, I have installed Oracle BPEL PM 10.1.2.0.2 (Developer version) but i am not able to see the useSecurity property in the page. Are there any settings required before i can see the same. Thanks, -Ulrich.

  • Cirrus fallback to RTMP

    We've deployed an application that uses Cirrus, but have found that a number of people are having issues connecting (I believe it's to do with their routers blocking the UDP packets). Is there a way we can get the application working for the users wi