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

Группировка в ALV



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



Joined: 25 Mar 2008
Posts: 32

PostPosted: Tue Apr 29, 2008 4:58 pm    Post subject: Группировка в ALV Reply with quote

Не подскажете, как сделать группировку в REUSE_ALV_LIST_DISPLAY. Что-то не получается Sad
Back to top
View user's profile Send private message
vga
Мастер
Мастер


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

PostPosted: Tue Apr 29, 2008 5:34 pm    Post subject: Reply with quote

Инна, то что группировка в листе работает, можете убедиться например на отчета BCALV_TEST_LIST
Сначала ставите курсор на колонке Airfare и жмете кнопку Total (Ctrl+F6)
затем встаете на колонке Plane Type и жмете Subtotals (Ctrl+ Shift + F6)

или вас интересует как то же самое, но сделать программно?



alv_list_group1.gif
 Description:
Total
 Filesize:  18.05 KB
 Viewed:  11959 Time(s)

alv_list_group1.gif



alv_list_group2.gif
 Description:
subtotal
 Filesize:  20.53 KB
 Viewed:  11958 Time(s)

alv_list_group2.gif


Back to top
View user's profile Send private message Blog Visit poster's website
inna
Участник
Участник



Joined: 25 Mar 2008
Posts: 32

PostPosted: Tue Apr 29, 2008 5:53 pm    Post subject: Reply with quote

Мне надо, чтоб список выводился с предварительными названиями групп, которые формируются на основании части одного из полей fieldcat.
Спасибо за сочувствие Smile
Back to top
View user's profile Send private message
vga
Мастер
Мастер


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

PostPosted: Tue Apr 29, 2008 6:24 pm    Post subject: Reply with quote

inna wrote:
Мне надо, чтоб список выводился с предварительными названиями групп,


не уверен, что правильно вас понял.

Code:
  data: ls_layo   type slis_layout_alv,

  cs_layo-totals_before_items    = 'X'.

  call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
      is_layout                      = ls_layo


inna wrote:
которые формируются на основании части одного из полей fieldcat.


Наверно придется создавать новое поле в fieldcatalog для групировки и заполнять его частью другого поля.
Back to top
View user's profile Send private message Blog Visit poster's website
inna
Участник
Участник



Joined: 25 Mar 2008
Posts: 32

PostPosted: Wed Apr 30, 2008 11:46 am    Post subject: Reply with quote

А где указывать по какому полю группировка?
Извините, если это глупый вопрос Embarassed я ещё чайник Smile
Back to top
View user's profile Send private message
Armann
Модератор
Модератор



Joined: 01 Jan 2008
Posts: 422
Location: Moscow

PostPosted: Wed Apr 30, 2008 12:08 pm    Post subject: Reply with quote

Как вариант: сделать все необходимые подсуммирования и группировки, сохранить в ALV-варианте и формировать ALV-list сразу с этим вариантом. Вариант описывается параметром IS_VARIANT
Back to top
View user's profile Send private message Blog
Alex80
Старший специалист
Старший специалист


Age: 43
Joined: 24 Jan 2008
Posts: 129

PostPosted: Wed Apr 30, 2008 12:21 pm    Post subject: Re: Группировка в ALV Reply with quote

inna wrote:
Не подскажете, как сделать группировку в REUSE_ALV_LIST_DISPLAY. Что-то не получается Sad
Code:
TYPE-POOLS slis.
DATA:
  gt_bseg TYPE TABLE OF bseg,
  gt_fieldcatalog TYPE slis_t_fieldcat_alv,
  gs_fieldcatalog TYPE LINE OF slis_t_fieldcat_alv,
  gt_sort TYPE slis_t_sortinfo_alv,
  gs_sort TYPE LINE OF slis_t_sortinfo_alv.

SELECT * FROM bseg INTO TABLE gt_bseg
  UP TO 100 ROWS.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    i_structure_name       = 'BSEG'
  CHANGING
    ct_fieldcat            = gt_fieldcatalog
  EXCEPTIONS
    inconsistent_interface = 1
    program_error          = 2
    OTHERS                 = 3.

gs_sort-spos = 1.
gs_sort-fieldname = 'BUKRS'.
gs_sort-up = 'X'.
gs_sort-subtot = 'X'.
APPEND gs_sort TO gt_sort.

gs_sort-spos = 2.
gs_sort-fieldname = 'GJAHR'.
gs_sort-up = 'X'.
gs_sort-subtot = 'X'.
APPEND gs_sort TO gt_sort.

gs_sort-spos = 3.
gs_sort-fieldname = 'BELNR'.
gs_sort-up = 'X'.
gs_sort-subtot = 'X'.
APPEND gs_sort TO gt_sort.

gs_fieldcatalog-do_sum = 'X'.

MODIFY gt_fieldcatalog FROM gs_fieldcatalog TRANSPORTING do_sum
  WHERE fieldname = 'DMBTR'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
    it_fieldcat   = gt_fieldcatalog
    it_sort       = gt_sort
  TABLES
    t_outtab      = gt_bseg
  EXCEPTIONS
    program_error = 1
    OTHERS        = 2.
Back to top
View user's profile Send private message
inna
Участник
Участник



Joined: 25 Mar 2008
Posts: 32

PostPosted: Wed Apr 30, 2008 12:23 pm    Post subject: Reply with quote

Вообще-то я поставила group = 'UL' и всё сгруппировалось по сортируемому полю только строка subtotal не выводится почему-то Sad
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.