Skip to Content
author's profile photo Former Member
Former Member

how to count number of characters in a string?

Hi

I need to display values in a script. but the alignment getting distrubed if it is less than 20 charaters, for exmple material descirption is only displaying 20 characters in script. if it is less than 20 charcters the alignment getting changed.

please help me ...urgent..

thanks in advance...

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 02, 2007 at 04:06 PM

    hi Sapein,

    use FM

    STRING_LENGTH

    to calculate the length .

    you can even use this logic

    LENGTH = STRLEN( STRING ).

    regards,

    Santosh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 02, 2007 at 04:06 PM

    Hi,

    You can count the no of characters using STRLEN(field name).

    regards,

    madhu

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 02, 2007 at 04:10 PM

    why not set the output in ALV. not much extra work and looks better than write statement and never have to worry about alignment problems anymore

    otherwise look at help on function FIND match LENGTH len

    Message was edited by:

    A. de Smidt

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 02, 2007 at 04:16 PM

    solution to this problem in script is not to count the characters but to align them based on positions .

    1.

    Use the tab positions for that paragraph format to display the values in a finite format .

    In this u need to give the position start and position end length and use the same in the script as

    p ,,&itab-f1&

    say my value has to print from position 125mm to 155 mm

    i take one tab position for this paragraph format P and maintain the same in the output.

    here ,, is the tab position .

    See whether it is one character or 20 character it has to behave the same way it should not be misaligned .

    check the tab position for that paragraph format in Tabs ..

    regards,

    vijay.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.