Skip to Content

Length of value of c field in internal table

Hi experts,

how do I find out the lenght of the value which is an CHARACTER field in an internal table.

I get a .XLS file from the customer. To check where the real entries starts I need to know the length of one field in the internal table.

How do I do this?

I tried it with DESCRIBE, but it doesn't work because the c field is interpreted hexadecimal.

Example:

all fields in my table are c(30), the value in one column is max. 3 letters. I want to find out the row where the entry in this field is 3 letters long.

Edited by: Heiko Kany on Sep 3, 2008 8:49 AM

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Sep 03, 2008 at 07:05 AM

    Hi Heiko,

    You can find the length using the STRLEN function as given below;

    DATA : ipstr TYPE string. 
    DATA : len TYPE i VALUE 0. 
    
    ipstr = 'Sample String'.
    
    len = STRLEN( ipstr )

    After execution len will contain 13.

    Regards

    Karthik D

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2008 at 07:14 AM

    Hi Heiko,

    Use the following:

    DATA : v_char(30) TYPE c.

    DATA : v_len TYPE i.

    clear v_len.

    v_len = STRLEN( v_str )

    Hope this will help.

    Regards,

    Nitin.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 03, 2008 at 07:18 AM

    The internal function strlen is given already, but it might be agood idea to use strings instead of char-variables.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 03, 2008 at 07:42 AM

    strlen is it.

    type string is not possible, because a SAP function delivers the character columns.

    Add comment
    10|10000 characters needed characters exceeded