SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Замена OR



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
stefan
Участник
Участник



Joined: 14 Feb 2008
Posts: 19

PostPosted: Mon Mar 31, 2008 12:14 pm    Post subject: Замена OR Reply with quote

Привет!
Можно оптимизировать такое условие проверки периодов?

IF p_period = '004'
or p_period = '005'
or p_period = '006'
or p_period = '010'
or p_period = '011'
or p_period = '012'
or p_period = '013'.
....
ENDIF.
Back to top
View user's profile Send private message
vga
Мастер
Мастер


Age: 95
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Mon Mar 31, 2008 1:14 pm    Post subject: Reply with quote

Использовать RANGES.
Back to top
View user's profile Send private message Blog Visit poster's website
stefan
Участник
Участник



Joined: 14 Feb 2008
Posts: 19

PostPosted: Mon Mar 31, 2008 1:34 pm    Post subject: Reply with quote

Почему такой синтаксис выдает ошибку?

Code:
DATA: p_period(3).

IF p_period IN ( '004' , '005' , '006' , '010' , '011' , '012' , '013' ).
 WRITE: 'Period found'.
ENDIF
Back to top
View user's profile Send private message
luka_rus
Участник
Участник



Joined: 21 Jan 2008
Posts: 35

PostPosted: Tue Apr 01, 2008 6:10 am    Post subject: Reply with quote

stefan wrote:
Почему такой синтаксис выдает ошибку?

Code:
DATA: p_period(3).

IF p_period IN ( '004' , '005' , '006' , '010' , '011' , '012' , '013' ).
 WRITE: 'Period found'.
ENDIF


Вроде бы такие условия возможны только при селектах. Используй RANGES.
Back to top
View user's profile Send private message
RoadRunner
Участник
Участник



Joined: 24 Mar 2008
Posts: 11

PostPosted: Thu Apr 17, 2008 4:12 pm    Post subject: Reply with quote

Самый простой вариант без RANGES:
Code:
IF p_period BETWEEN '004' AND '006' OR p_period BETWEEN '010' AND '013'.
Back to top
View user's profile Send private message
Брат Мигель
Участник
Участник



Joined: 04 Dec 2007
Posts: 20

PostPosted: Thu Apr 17, 2008 9:24 pm    Post subject: Reply with quote

vga wrote:
Использовать RANGES.

Поддерживаю. Раз разберись, потом часто будешь использовать.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.