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

simple qa-- if condition

Former Member
0 Likes
752

i want to say:

if ZXXX not i (1,2,3)

x=y

endif.

what the write statment.

5 REPLIES 5
Read only

athavanraja
Active Contributor
0 Likes
692

check out this code sample.

data: ZXXX(1) .
ranges: s_number for ZXXX .
s_number-sign   = 'I'.
s_number-option = 'EQ'.
s_number-low    = '1'.
APPEND s_number .
clear s_number .

s_number-sign   = 'I'.
s_number-option = 'EQ'.
s_number-low    = '2'.
APPEND s_number .
clear s_number .

s_number-sign   = 'I'.
s_number-option = 'EQ'.
s_number-low    = '3'.
APPEND s_number .
clear s_number .

ZXXX = '4' .

if ZXXX not in s_number.
write:/ ZXXX .
endif.

Regards

Raja

Read only

Former Member
0 Likes
692

Hi Rani,

Check this simple one :

if ZXXX <> 1 and ZXXX <> 2 and ZXXX <> 3.

x = y.

endif.

Read only

Former Member
0 Likes
692

Hi

You can use several way, I think depends on how many values you need to have in your ranges:

- 1) Perhaps easier way is to use a simple IF condition with AND option:

IF ZXXX <> 1 AND ZXXX <> 2 AND ZXXX <> 3.

ENDIF.

- 2) You can use a range in this way:

DATA: wa(1) TYPE n VALUE '4'.

RANGES r_range FOR wa.

DO 3 TIMES.

MOVE sy-index TO r_range-low.

r_range(3) = 'IEQ'.

APPEND r_range.

ENDDO.

IF NOT wa IN r_range.

WRITE wa.

ENDIF.

or in this way:

DO 3 TIMES.

MOVE sy-index TO r_range-low.

r_range(3) = 'EEQ'.

APPEND r_range.

ENDDO.

IF wa IN r_range.

WRITE: / wa.

ENDIF.

Max

Read only

athavanraja
Active Contributor
0 Likes
692

Hi rani umbro ,

Is your question answered? reward the helpful answers and mark the thread as answerd.

Regards

Raja

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
692

Hi,

if zxxx ne 1 and zxxx ne 2 and zxxx ne 3.

x = y."Here I assumed x and y are varaibles

endif.

KIndly reward points by clikcing the star on the left of reply,if it helps.Otherwise,get back for clarifications.