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

READ TABLE проблема



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
z01
Специалист
Специалист



Joined: 18 Jan 2008
Posts: 59

PostPosted: Sat Jun 07, 2008 2:01 pm    Post subject: READ TABLE проблема Reply with quote

Внутренняя таблица описана
DATA lt_bukrs TYPE TABLE OF BUKRS WITH HEADER LINE.

Не могу сообразить, как построить конструкцию для поиска нужной строки?

READ TABLE lt_bukrs WHERE lt_bukrs = '1234'.
или
LOOP AT lt_bukrs WHERE lt_bukrs = '1234'.
ENDLOOP.
выдают синтаксическю ошибку.
Back to top
View user's profile Send private message
luka_rus
Участник
Участник



Joined: 21 Jan 2008
Posts: 35

PostPosted: Sat Jun 07, 2008 2:50 pm    Post subject: Reply with quote

Code:

TYPES:
      BEGIN OF t_bukrs,
        bukrs TYPE bukrs,
      END OF t_bukrs.


DATA lt_bukrs TYPE TABLE OF t_bukrs WITH HEADER LINE.

READ TABLE lt_bukrs WITH KEY bukrs = '1234'.

LOOP AT lt_bukrs WHERE bukrs = '1234'.
ENDLOOP.
Back to top
View user's profile Send private message
Armann
Модератор
Модератор



Joined: 01 Jan 2008
Posts: 422
Location: Moscow

PostPosted: Sat Jun 07, 2008 3:23 pm    Post subject: Reply with quote

Для таких случаев есть специальное поле - table_line
Code:

DATA lt_bukrs TYPE TABLE OF BUKRS WITH HEADER LINE.

read table lt_bukrs with key table_line = '1234'.
Back to top
View user's profile Send private message Blog
vga
Мастер
Мастер


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

PostPosted: Sat Jun 07, 2008 4:40 pm    Post subject: Reply with quote

Или так, но это хуже.

Code:
LOOP AT lt_bukrs.
  CHECK lt_bukrs = '1234'.
  EXIT.
ENDLOOP.
Back to top
View user's profile Send private message Blog Visit poster's website
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.