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

Identifying the length of populated field

Hello,

I'm sure there is a simple answer to my question, but I don't it..

I have a character field in my selection screen which is 7 characters long. When the user runs the report, he/she enters some value in the field; the value entered could be 7 characters or could be empty, or any number of characters in between.

As part of my report I want to calculate how many characters the user has entered. For example:

If he/she entered 'RD3' I want to do some special functions since only three characters are available;

If the user entered 'WD3TW' then I would perform some other functions, since five characters are available to me.

I've tried the "contains pattern" (CP) string function, but with no luck. The DESCRIBE always results in 7, since the that's the field's length.

Does anyone know of a way to calculate how much of a field is populated?

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2006 at 09:46 PM

    Hi,

    use the STRLEN function to get the length..

    DATA: V_CHAR(7) VALUE '1234'.

    DATA: V_INT TYPE INT4.

    V_INT = STRLEN( V_CHAR ).

    WRITE: / V_INT.

    Thanks,

    Naren

    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.