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
Leshik
Участник
Участник



Joined: 14 Nov 2007
Posts: 8

PostPosted: Wed Dec 05, 2007 10:02 am    Post subject: Проблема с подсчетом % в итоговой колонке ALV Reply with quote

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

Например:
Кол1 Кол2 Кол3
a b ( a / b ) * 100
----------------------------------
Итого A Итого B Итого %

итоговое значение в % показывается неправильно, оно выводится как сумма всех значений по Кол 3, а нужно
как (Итого A / Итого B) *100.

Анибоди хелп ми?
Back to top
View user's profile Send private message
Lord
Профессионал
Профессионал



Joined: 10 Sep 2007
Posts: 168

PostPosted: Wed Dec 05, 2007 2:58 pm    Post subject: Reply with quote

Попробуйте использовать событие BEFORE_LINE_OUTPUT для модификации строки.

Code:
DATA:
  l_events LIKE LINE OF lt_events.

  l_events-name = 'BEFORE_LINE_OUTPUT'.
  l_events-form = 'ALV_BEFORE_LINE_OUTPUT'.
  APPEND l_events TO lt_events.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    ...
      IT_EVENTS = lt_events
    ...

FORM alv_before_line_output USING p_lineinfo TYPE slis_lineinfo.

  DO 1 TIMES.
*  CHECK p_lineinfo-subtot NE space. "for subtotal
    CHECK p_lineinfo-endsum NE space. "for sum
    CHECK t_outtab-b <> 0.
    t_outtab-c = ( t_outtab-a / t_outtab-b ) * 100.
    MODIFY t_outtab INDEX p_lineinfo-sumindex.
  ENDDO.
ENDFORM.
Back to top
View user's profile Send private message
John Doe
Модератор
Модератор


Age: 45
Joined: 05 Nov 2007
Posts: 725
Location: КраснАдар

PostPosted: Wed Dec 05, 2007 3:27 pm    Post subject: Reply with quote

Lord wrote:
Попробуйте использовать событие BEFORE_LINE_OUTPUT для модификации строки.


Мне кажется, что данное событие отрабатывает только для REUSE_ALV_LIST_DISPLAY... По крайней мере, у меня не останавливается в этом событии.
Back to top
View user's profile Send private message Blog
Lord
Профессионал
Профессионал



Joined: 10 Sep 2007
Posts: 168

PostPosted: Wed Dec 05, 2007 4:25 pm    Post subject: Reply with quote

Да, проверил на тестовой программе BCALV_TEST_FULLSCREEN_EVENTS
тоже не отработало. Похоже это событие процессится только на сервере приложений, а не на frontend. Наверно, как-то завязано на события листа AT LINE-SELECTION.

Тогда попробуйте напрямую модифицировать subtotals, как в примере:
http://www.sapnet.ru/viewtopic.php?t=420

Или использовать событие SUBTOTAL_TEXT в ALV Grid
http://sapboard.ru/forums/viewtopic.php?t=4234
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.