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

Operator NA

Former Member
0 Likes
15,513

Hi,

IF str NA '0123456789'.

Can you show me little examples regarding the operator NA please??

Thanks

4 REPLIES 4
Read only

Former Member
0 Likes
5,757

"Contains Not Any: True if a logical expression with CA is false, that is if operand1 does not contain any characters from operand2. If the result of the comparison is negative, sy-fdpos contains the offset of the first character in operand1 that is also contained in operand2. If the result of the comparison is true, sy-fdpos contains the le of operand1."

In short it is the negation of Contains any: CA.

this statement:

IF str NA '0123456789'.

means that if the string str contains any other character than a numeral, then do somethins.

Regards,

Ravi

Read only

Former Member
0 Likes
5,757

[code]NA (Contains not Any)

if str contains not any numerical

eg:

Data : str(15) value 'ABCDEF#$%'.

IF str NA '0123456789'.

write : / 'OK'.

endif.

Here Str does not contain any 0123456789, so it will go into IF condition[/code]

Read only

Former Member
0 Likes
5,757

This means COntains Not Any:

DATA: string(10) TYPE c value 'bhhjfm23pk'.

IF string NA '0123456789'.
 Write:/ 'No Numeric values'.
ELSE.
 Write:/ 'Numeric found'.
ENDIF.

Output:

Numneric Found.

Reward if u find helpful.

Read only

Former Member
0 Likes
5,757

Hello,

Check this:


data: lv_var(10) value '5445zgqfzgj'
if lv_var na '0123456789'.
write: 'Has Number'.
else.
write: ' No Number'.
endif.

The other u can use the FM <b>Numeric_Check</b>.

Vasanth