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

How to check the number of digits entered into a itab-field.

Howdy,

I've got a program where i retrieve some data from the database and then I need to check if field BKPF-XBLNR has exactly 15 digits in it.

I've got no idea on how I would do this...

Can anyone help?

Thanking you kindly!

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Feb 10, 2005 at 01:42 PM

    Use the following code.

    
        data: len type i.
    
        len = strlen( BKPF-XBLNR ).
    
    

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

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

    XBLNR is a character field. If you want to make sure all 15 positions have a digit and not some other character then use:

    IF BKPF-XBLNR CO '0123456789'.
    * OKAY, all 15 positions have digits
    ELSE.
    * NOT OKAY, at least one of the 15 is not a digit
    ENDIF.

    If you do not care what the characters are, then Rich has given you the solution but be aware that you could have embedded blanks, for example:

    'ABCDEF    GHIJK'

    is length 15.

    Message was edited by: Charles Folwell

    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.