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

Перемещение строк внутренней таблицы



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



Joined: 27 Sep 2007
Posts: 61

PostPosted: Tue Jan 19, 2010 5:16 pm    Post subject: Перемещение строк внутренней таблицы Reply with quote

Встала задача из-за большого расхода памяти оптимизировать ряд операций с внутренней таблицей, чтобы меньше использовалось внутренней памяти и было не в ущерб производительности.

Пока на ум приходят только построчные операции, добавить одну строку во вторую таблицу, удалить одну строку из первой таблицы.

1) Переместить содержимое одной таблицы в другую.
itab1[] = itab2[] не подходит, поскольку таблицы большие и не хватит памяти для одновременного размещения в памяти двух таблиц.

2) Переместить 1000 строк из первой таблицы в конец второй. Из первой строки нужно удалить.


Спасибо за советы.
Back to top
View user's profile Send private message
vga
Мастер
Мастер


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

PostPosted: Tue Jan 19, 2010 6:29 pm    Post subject: Reply with quote

Можно перемещать порциями, а не по одной записи.

Code:
  CONSTANTS: lc_max_items TYPE i VALUE 50000.
  DATA: l_lines TYPE i,
        l_count TYPE i,
        ltab1 TYPE TABLE OF ZTABLE,
        ltab2 TYPE TABLE OF ZTABLE.

        WHILE NOT ltab1[] IS INITIAL.
          DESCRIBE TABLE ltab1 LINES l_count.
          IF l_count > lc_max_items.
            l_count = lc_max_items.
          ENDIF.
          APPEND LINES OF ltab1 FROM 1 TO l_count TO ltab2.
          DELETE ltab1 FROM 1 TO l_count.
        ENDWHILE.
Back to top
View user's profile Send private message Blog Visit poster's website
YuriT
Участник
Участник



Joined: 03 Nov 2008
Posts: 35

PostPosted: Wed Jan 20, 2010 12:41 pm    Post subject: Reply with quote

1) APPEND LINES OF itab1 [FROM n1] [TO n2] TO itab2
2) DELETE itab1 [FROM n1] [TO n2]

Собственно, как и посказано выше.
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.