Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Check input value

Former Member
0 Likes
828

Hello,

trying to check an PARAMETERS input value like this:

AT SELECTION-SCREEN ON connid.

IF connid < 0 OR connid > 1000.

MESSAGE e001(zabap_cri) WITH '0' '1000'.

ENDIF.

how to check if the input is a number and no character?

thx

chris

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
797

Hello,

DO like this.


AT SELECTION-SCREEN ON connid.
IF connid LT 0 OR 
    connid > 1000.
MESSAGE e001(zabap_cri) WITH '0' '1000'.
ENDIF.


" To check numer or charater use

IF CONNID CO '01234566789'
Write 'CONNID IS NUMBER'.
ELSE.
Write 'CONNID IS NOT A NUMBER'.
endif
 
Also use NUMERIC_CHECK FM

Vasanth

7 REPLIES 7
Read only

Former Member
0 Likes
797

Hi

Check this.

ABAP Keyword ducumentation under logical expression.

Check keyword 'CO' and 'NA'

Check the keyword 'NA'

You will have to go the other way..

check that the value does not contain any character...

Regards,

Suruchi Mahajan

Read only

Former Member
0 Likes
797

Hi

if connid ca sy-abcde.

message e000(zz) with 'Enter only numeric value'.

endif.

Regards

Navneet

Read only

0 Likes
797

Thanks to all. It works.

@Navneet:

Is the field sy-abcde especially use for this kind of check?

thx

chris

Read only

0 Likes
797

sy-abcde stores all the alphabets, ABCDE..........Z

if you use this it will not check if there are any special characters entered , so better use

IF CONNID CO '0123456789'.

<b>You need to reward points and close thread for helpful answers</b>

Message was edited by:

Chandrasekhar Jagarlamudi

Read only

Former Member
0 Likes
798

Hello,

DO like this.


AT SELECTION-SCREEN ON connid.
IF connid LT 0 OR 
    connid > 1000.
MESSAGE e001(zabap_cri) WITH '0' '1000'.
ENDIF.


" To check numer or charater use

IF CONNID CO '01234566789'
Write 'CONNID IS NUMBER'.
ELSE.
Write 'CONNID IS NOT A NUMBER'.
endif
 
Also use NUMERIC_CHECK FM

Vasanth

Read only

Former Member
0 Likes
797
if connid CO '0123456789'.
 *number.
else.
 * it is not a number
enid.
Read only

Former Member
0 Likes
797

hi

as you have referred to spfli-connid, you no need to validate as its domain is NUMC (4), which will accept only numbers

if helpful, reward

Sathish. R

Message was edited by:

Sathish