How to get the length of a field.

Hi all,
I m working on dynamic internal table.There is a need to get the length of a field, filled dynamically.How can we get it.
Thanks in advance.
Regards,
Swati garg

Swati,
DATA: text(8) TYPE c,
      len TYPE i.
DESCRIBE FIELD text LENGTH len IN CHARACTER MODE.
Field LEN contains the value 8.
================================
For ouput length :
  DATA: float TYPE f,
      out TYPE i,
      len TYPE i.
DESCRIBE FIELD float LENGTH len OUTPUT-LENGTH out.
This example results in the field LEN containing the value 8, while the field OUT contains the value 22.
Don't forget to reward if useful.....

Similar Messages

  • How to get the length of a field value, not the length of DB's CHAR(20)

    Hello.
    I'm trying to handle a String from my DataBase and get its length:
    String myName;
    int i;
    PreparedStatement sql = Conn.prepareStatement("SELECT NAME FROM MY_TABLE");
    ResultSet results = sql.executeQuery();
    results.next();
    myName = results.getString("NAME");
    i = myName.length();
    out.println("The value is " + myName + " and the length is " + String.valueOf(i) );
    I get:
    " The value is Tom and the lengh is 20 "
    20 is the length of the field (it's a CHAR (20) ), but I would like to get the length
    of 'Tom'.
    On other hand, I would like to detect if this value is 'Tom' or not, but trying with:
    if (myName.equals("Tom")) {...}
    or
    if (myName == "Tom") {...}
    There is no response.
    Any experience?

    myName = results.getString("NAME");
    if(myName!=null) myName = myName.trim(); //Take out trailing spaces
    i = myName.length();Sudha

  • Get the length of a field in smartform

    How can i get the length of a field (text) in smartform

    Hi,
    use strlen to calculate the length.
    for ex:
    you need to declare a variable of type string:
    data g_conv type string.
    and convert the variable holding the text in ur code
    g_conv = <var holding the txt>.
    then perform STRLEN ( g_conv)
    This will give the correct result.
    hope this will help you

  • How to get the length of apex_item in javascript?

    Hello all
    I am having a tabular report using apex_item, I want to know how can i get the length of the item in javascript? like we do in pl/sql using apex_application.g_f01.count().
    and one more thing, when I go to certain page, tab of that page is getting disabled, what should I do to make tab available always whether I am on that page or on any other page.
    Thanks
    Tauceef

    Hi Oli
    Thanks for replying, In my first question actually I am validating the report values in javascript for that I need the length of the apex_item to run the loop that many times.
    Like we can get the length using apex_application.g_f011.count in pl/sql process how to get the length in the javascript, is there a way for that?
    I got the answer for the second question, this is the one.
    Thanks
    Tauceef

  • How to restrict the length of input field

    Hi,
    How to restrict the length of input field. That is we should not be able to enter more thatn 10 charecters.
    Regards,
    H.V.Swathi

    Hi swathi,
    For this you have to create a simple data type. No need of writing a code.
    Go to Dictionaries -> Local Dictionary -> Data Type - > Simple Type - > Right click and "Create Simple Type".
    Here you should create a Simple type with String as built-in Type. Here you will also see the Length Constraints option.
    Set the value of maximum length and minimum length. In your case set the value of maximum length to 10. At runtime this will not allow the user to enter more than 10 characters.
    Now create an attribute and bind it to this newly created simple type. Bind the value of the input field with this particular attribute.
    Regards
    Manohar

  • How to get the table of value field? and can we expand the technical limits

    Dear
    I have created value field in COPA with KEA6. And now, I need the table which the value fields are saved. Yet, I have tried a lot to find it and get failure? Can any guy help me? Please tell me how to get the table of a value field.
    And another question is that, can we extend the technical limits for the number of value field for ECC6.0?
    We have a note for R.4.x Please see below:
    OSS note 160892
    You can display the length of a data record using Transaction KEA0 ('Maintain Operating Concern'). After you have navigated to the 'Characteristics Screen' or to the 'Value field Screen' choose menu path 'Extras -> Technical Limits'.
    The maximum displayed here under 'Length in bytes on the DB' is the maximum length permitted by the Dictionary. The reserve required for the release upgrade must be subtracted from this value.
    To increase the allowed number of the value fields, increase the value that is assigned to field ikcge-bas_max_cnt (FORM init_ikcge_ke USING fm_subrc, approx. line 165) in Include FKCGNF20. It specifies the number of the possible value fields. The corresponding part of the source code is attached to the note as a correction.
    David Sun
    Regards!

    how to extend the limit of value numbers? please see the original question.

  • How to get the total no.of fields count in TFS

    How to check this:
    You can define no more than 1,024 work item fields in the same team project collection, and you can set no more than 1,024 fields to
    reportable in all team project collections.
    I have created some new fields in my customized process template. How to get the field count to check this validation. Do we have any command for this since witadmin listfields does not give the total count info.
    Thanks
    Divya

    Hi Divya, 
    Thanks for your post.
    Try to get fields count in collection using below code snippet:
    TfsTeamProjectCollection tfs =
    new
    TfsTeamProjectCollection(new
    Uri("collectionURL"));
    tfs.EnsureAuthenticated();
    WorkItemStore workitemstore = tfs.GetService<WorkItemStore>();
    FieldDefinitionCollection fields = workitemstore.FieldDefinitions;
    // get fields count in this collection
    Console.WriteLine(fields.Count);
    //get each field name
    foreach(FieldDefinition
    field in fields)
    Console.WriteLine(field.Name);
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to get the length of a audio file without play it ?

    Now I know a method to get the length of a audio file by play it:
    1 Create a Player, and add a ControllerListener
    2.Start the Player
    3.In the ControllerListener's controllerUpdate method, use getMediaTime() by receiving a EndOfMediaEvent
    However I think this method is not convenience, if I don't want to play it how I can get the length of the audio file?
    Is anyone can help me?Really thanks a lot !

    I got the answer here:
    http://forum.java.sun.com/thread.jspa?threadID=5149132&tstart=15
    I tried getDuration() before, but it always return a same time, I think maybe I didn't realize the player.

  • How to get the class name and field name dynamically

    Hi
    I have a class (ex: Contract) the fields (ex : a,b,c) .i need to get the class name and field name dynamically
    ex
    if( validation file for the field Contract.a){
    return contract.a;
    }else if(validation file for the field Contract.b){
    return contract.b;
    how to pass the field name and object dynamically
    Please help me .............
    Thanks in Advance..
    Edited by: 849614 on Aug 11, 2011 6:49 AM

    YoungWinston wrote:
    maheshguruswamy wrote:
    Agreed, but IMO, i still feel its best if there is no tie in between consumer class level details and the database it talks to. A service layer is needed in between them.Sounds like you've done a bit of this before. Me, I've either been a modeller/DBA, doling out data, or a nuts and bolts programmer (and actually more toolmaker than apps, but did a bit of that too).
    Do you know of a good book about the "middle ground" (ie, these service layers)? I understand it empirically, but haven't had a lot of exposure to it.
    Winston
    Edited by: YoungWinston on Aug 11, 2011 10:34 PM
    PS: Apologies. Edited my previous post, presumably while you were composing your reply, when I finally realized what '.filed' meant.Most of my work is in web development, never been a DBA :) . The biggest 'concern' in my shop is 'separation of concerns'. The UI group reports up to a different IT head, the DB group reports up to a different IT head and so on. The looser the coupling between these systems, the lesser the project costs (Integration, QA etc) are. Martin Fowler's books contain good information about separation of concerns in an enterprise environment. The two books which i recommend are
    [url http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420]Enterprise Application Architecture and
    [url http://www.amazon.com/Enterprise-Integration-Patterns-Designing-Deploying/dp/0321200683/ref=pd_sim_b_1]Enterprise Integration Patterns

  • How to check the length of a field symbol value

    hi all,
    i have a problem with string function, i have assined  table fields to  a field symbol in a loop i want check the length of the assigned fields symbol value  in every loop . i have written like ,,,,,len = strlen( <fs>). then i am getting the length of the field label what i ahve assigned to fiels symbol not the field value lenght ,
    please advise me on this,
    thanks,
    sre

    I think you're on the right track.  This should work:
    data: len type i.
    data: begin of itab OCCURS 1,
            a type string value '1',
            b type string value '12',
            c type string value '123',
          end of itab.
    FIELD-SYMBOLS: <fs> type ANY.
    do 3 times.
      assign component sy-index of STRUCTURE itab to <fs>.
      len = strlen( <fs> ).
    enddo.

  • How to get the length in bytes of a string

    My string has both latin (1 byte) and chinese (2 bytes).
    My program is in unicode system.
    How to measure the length in bytes of the string?
    the xlen function does not work.

    Hello,
    parameters : p_str type string.
    data : len type i.
    len = strlen( p_str ).
    write : / len.
    With Regards,
    BVS
    Hi BSV, your code return the number of characters not bytes.
    Remember chinese character in US are encoded with 2 bytes.
    And my string contain both latin and chinese characters.
    thanks

  • How to get the name of a field without specifying it as a string (somehow v

    Is it possible to get the name of a field (or method) somehow via the class in which it is declared?
    The reason why I ask is, that quite often the name of a field is important, because the name is the anchor for further processing, like for example when using reflection (e.g. Class.getfield(“NameOfTheField”)).
    Assume you have class FooSimple with the field “String firstName”.
    Now you would do something like this:
    Class<FooSimple> cls = FooSimple.class;
    Field f = cls.getField("firstName");
    The problem is, that the string “firstName” is kind of “hard coded”. When the name of the field in class FooSimple changes (e.g. to “theFirstName”), the invocation will not work anymore when you forget to change the string too.
    I think it would be very helpful to have access to the name of the field directly via the class by doing something like this.
    Class<FooSimple> cls = FooSimple.class;
    Field f = cls.getField(FooSimple.firstName.fieldName);
    The Java Compiler would then resolve “FooSimple.firstName.fieldName” to the string “firstName”. When later the name of the field is changed, the IDE would change the name everywhere where it is used. So if the name of the field would be changed to “theFirstName” the IDE would also change the statement to
    Class<FooSimple> cls = FooSimple.class;
    Field f = cls.getField(FooSimple.theFirstName.fieldName);
    A technique like this would be in my opinion much more safety and more generic.
    Any ideas?
    Best Regards.

    Well, I think the discussion is going in a wrong direction because the original issue was not to discuss if it is worth coding some helper classes or a framework or that like. Let me bring it back to my original point.
    Basically you can reduce my original question to this:
    Currently it is possible to use the reflection API on a class level without specifying the name of the class with a string constant.
    My issue is, that I think it would be a nice extension for Java, if the same would be possible for field variables of a Java class. Currently the only way you can do this is by specifying the field variable with a string constant.
    Let me bring some motivations which brought me to this issue.
    Assume you have an entity bean which represents a DB table and you use Java Persistence (either JPA or something like Hibernate). Then you would have a class looking like this (very simple sample to make this reply shorter).
    @Entity
    @Table(name = "PERSON")
    public class Person implements Serializable {
         @Column(name = "NAME")
         private String name;
    // … constructor, getter, setter, etc. not listed here
    }The whole issue of the design of JPA is, that such entity beans represent the mapping between the object model and the DB model, the mapping is expressed with annotations.
    Okay, now let’s assume you write a query in Query Language, e.g.
    String sql = “select p from Person p where name = :name”;“name” is the name of the field variable, “:name” is the parameter you later set with “Query.setParameter” method.
    What is not so nice is the fact, that you use the name of the class and the name of the field variables “hardcoded” to construct the query. Now you could think that basically this information is part of your entity class. First you start with the name of the class (i.e. the table name) to decouple this “hardcoding”.
    You could write instead:
    String sql = “select p from “ + Person.class.getSimpleName() + “ p where name = :name”;This is really nice, because whenever you change the name of your Person class, this change happens automatically for the sql statement as well.
    I think the next thoughts are obvious, now, since you have decoupled the “hardcoded” part of the name of the class, you would like to do the same for the names of the field variables. But now you are stuck, there is no way to do this using a similar technique like for the name of the class. Either you stay with the query as it is now, or, to make it a little bit better, you code string constants for the field variables and use them. This issue brought me to the point that I think it would be nice to have the possibility to get the name of a field variable in a similar way as you can get it for the name of the class.
    Conceptually it is just to go one level deeper, i.e.
    first level is to get the name of a class
    second level is to get the name of the field variable of a class.
    Another sample would be, if you want to code something by using reflection. You have perfectly access to the reflection API starting at the class level like Person.class.allTheNiceReflectionMethods. There is no need to specify the class first with a string constant first, you directly start with the class, you can even be generic and just work on the Class.class level and still have access to all these nice methods to get out the information you need.
    But if you need to start with a very specific field variable (like in the sample above), you must go by using a string constant like Person.class.getDeclaredField(“name”).
    So basically I think that there exist already millions of lines of Java code where a field variable is specified for further processing, especially in combination with the reflection functionality and everywhere the field variables are specified by these string constants in double quotes. I would assume, that everyone has the same problem, once changing the name of the field variable means to take care that also the content of the string which specifies the name of the field variable is changed.
    I am wondering why one of the replies commented, why the name of a field variable is changed, it sounds to me that this is something which basically never happens. I don’t know, I think that this happens actually quite often and thanks to all these nice IDEs and their “rename” feature this is usually no problem. From time to time names of classes change, name of field change, yes, they are often even completely rewritten, new field variables come in some are deleted, whatever it is. The way I currently can access the name of a class makes the code safer, because when I consequently go with Class.class.getSimpleName I always know, that when I rename the class all these statements are changed too If I delete such a class, I at least get a compile error.
    My very simple issues is, that I think it would be nice to have the same comfort not only on a class level but also on the level of field variables, nothing more, nothing less.
    To be honest, I have not browsed the forum yet if such an issue was already raised by other people (I will do this now), but somehow it is hard to imagine, that I am the first one.
    Best regards.

  • Getting the length of a field in a database.

    I have a field in a database that has a char length of 20, is there anyway to get that length from the database.

    I probally didn't explain myself properley. The field might not have anything in it. The field would only except a length of 20, some have 10 others 5.
    I have a GUI repersenting a table in the database. When the user is inputting into this field I want to stop them from entering more than 20 Characters. I need to know how many characters the field will accept.
    I'm trying to stop my client from calling me up and saying that there something rong with the program because when he enters data, it only saves half of it.

  • Urgent: How to get the Value of Search Field

    Hello All,
    I want to get the value of <b>'Search Fiel</b>d' in my HTML file.
    Please help with this.
    Regards
    Vaib

    Hi Vaibav,
    It should be under the Script tag.
    You can refer this link for details.
    http://help.sap.com/saphelp_nw04/helpdata/en/d0/55074155bcf26fe10000000a1550b0/frameset.htm
    Please reward points if my suggestion helped you.
    Thanks and regards
    Deepa

  • How to get the keys for a field in the dropdown list?

    The dropdown list of payment terms on an account is unfortunately very big, containing al lot of different values, in our system and therefore very confusing for the user working with Web UI version 5.2 to pick the right one. The keys (code like e.i Z077 or ZO23) are not stated in the list available for user. Is there any way in the system to flag if the different fields should show boths the keys(codes) and the description of the values in the field as Payment terms, etc.
    In the ERP SAP Gui it is possible to activate if you want the keys should be shown in all drop down list.
    If this is not possible for all the fields at one time, what can be a solution to have the keys in the drop down lists, any suggestion will be very valuable for us.
    Kindly regards
    Camilla

    HI Joost
    No it is not that simple, that is not a solution for us. The fields are maintained i our backend system and replicated to CRM, and these fields descriptions are also printed at Order confirmations and invoices, and we do not want the keys that do not give any meaning  to be visible to customers.
    BR
    Camilla

Maybe you are looking for

  • Attach file via RFC on an object in SAP R/3 4.6c

    Hi experts, I have to attach a file via a RFC into a Business Object of PM module; could be an Order (IW32) or a Note (IW22). I had tried the sample codes I saw in here, but none of them proved to be useful - some were not in use for me because of th

  • DisAppointed news  Sun Solaris  forum ????????? True or False

    hello Friends , I read some disappointed news on this forum that sun would not continue support for intel edition i donot know it is true of false Any tell me what is exact matter on following email :- [email protected] or reply this letter

  • Eclipe - Oracle Application Server 10.1.3.1

    Hi everyone, I've been trying to start the Oracle OC4J Standalone Server v10.1.3.1 from Eclipse Europa for a while but unfortunately i'm getting the following errors : * Error initializing server: Unable to start HTTP-Server. default-web-site configu

  • Object Type HLPF

    Hi All What is Object Type HLPF in SAP.....? Thanks In Advance, Chetan

  • Batch release of production orders

    Dear PP Gurus, Is there any program / functional module which i can execute in background to release production orders. I would like to release the production order automatically in background (I do not want to perform custmization setting which rela