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

Where condition 'Int' in 'Char' format field

Hi,

I have field with 'Char' format, but i used to input an integer value. Are possible if I use that value to filter data?

Example:

IF FIELD > 70.

FIELD2 = 'More than 70'.

Thank you.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 18, 2016 at 04:25 AM

    You can.. Just move your char data to a int variable.

    Sample:

    DATA: v_char TYPE char10,

    v_int TYPE i.

    v_char = 71.

    MOVE v_char TO v_int.

    IF v_int > 70.

    WRITE: 'More than 70'.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 18, 2016 at 05:48 AM

    Hi. Check abap help for comparison between different types. It will help you to understand your problem - Comparisons Between Different Data Types - ABAP Programming (BC-ABA) - SAP Library

    Char and int will be compared as numbers.

    So if you have data i1 type i value 123 and data c1(10) value ' 123' and data c2(10) value '00000123', i1 will be equal to c1 and c2.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 18, 2016 at 06:58 AM

    Hi,

    You can use single quote for character like IF FIELD > '70' for comparison.

    Thanks.

    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.