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

ALVGRID OPP - проблемы с interal table cl_gui_alv_grid



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



Joined: 20 Apr 2011
Posts: 80
Location: Ukraine

PostPosted: Fri Mar 16, 2012 10:24 am    Post subject: ALVGRID OPP - проблемы с interal table cl_gui_alv_grid Reply with quote

Добрый день!
Подскажите плиз, а как сделать для cl_gui_alv_grid выводить свою внутреннюю таблицу или стандартную но не все колонки,
Code:

    call method grid1->set_table_for_first_display
         exporting i_structure_name = 'SFLIGHT'
                   is_layout        = gs_layout
         changing  it_outtab        = gt_outtab[].
  endif.
  call method cl_gui_control=>set_focus exporting control = grid1.


В више примерах всегда изначально выводиться вся таблица а если мне это не нужно, понятно, что можно задать свой layout а как изначально выводить те колонки которые мне надо? к примеру в селекте загонять во внутреннюю таблицу?
Back to top
View user's profile Send private message
Igor_34_rus
Специалист
Специалист



Joined: 08 Apr 2009
Posts: 75

PostPosted: Fri Mar 16, 2012 10:52 am    Post subject: Re: ALVGRID OPP - проблемы с interal table cl_gui_alv_grid Reply with quote

firacat wrote:
Добрый день!
Подскажите плиз, а как сделать для cl_gui_alv_grid выводить свою внутреннюю таблицу или стандартную но не все колонки,
Code:

    call method grid1->set_table_for_first_display
         exporting i_structure_name = 'SFLIGHT'
                   is_layout        = gs_layout
         changing  it_outtab        = gt_outtab[].
  endif.
  call method cl_gui_control=>set_focus exporting control = grid1.


В више примерах всегда изначально выводиться вся таблица а если мне это не нужно, понятно, что можно задать свой layout а как изначально выводить те колонки которые мне надо? к примеру в селекте загонять во внутреннюю таблицу?



программно обрезать поля через каталог полей (fieldCatalog в set_table_for_first_display http://www.sapnet.ru/viewtopic.php?t=3713 )
Но лучше сделать вечер варианты тогоже (set_table_for_first_display http://www.sapnet.ru/viewtopic.php?t=3137&highlight=isvariant)
Back to top
View user's profile Send private message
firacat
Специалист
Специалист



Joined: 20 Apr 2011
Posts: 80
Location: Ukraine

PostPosted: Fri Mar 16, 2012 11:34 am    Post subject: Reply with quote

Спасибо!!! Very Happy
Back to top
View user's profile Send private message
firacat
Специалист
Специалист



Joined: 20 Apr 2011
Posts: 80
Location: Ukraine

PostPosted: Mon Mar 19, 2012 11:17 am    Post subject: Reply with quote

Под скажите плиз а почему теперь не активно суммирование? ставила inttype D и N для fieldcatalog и флаг do_sum тоже подскажите плиз что не так?

Code:

 FORM alv_field USING
       p_field_name TYPE c
       p_heading TYPE c
       p_hide_zeros TYPE c
       p_hotspot TYPE c
       p_dosum type c
       p_inttype type c.

   CLEAR v_alv_fc.
   DATA: lv_type(1) TYPE c,
         lv_length TYPE i,
         lv_heading_length TYPE i.

* get the type and length of this field
   FIELD-SYMBOLS <field>.
   ASSIGN p_field_name TO <field>.

   DESCRIBE FIELD <field> TYPE lv_type OUTPUT-LENGTH lv_length.
* re-adjust the length to the length of the header, if too short
   lv_heading_length = STRLEN( p_heading ).

IF lv_length < lv_heading_length.
  lv_length = lv_heading_length.
ENDIF.

* NOTE: the field name MUST be upper-case
v_alv_fc-fieldname = p_field_name.
TRANSLATE v_alv_fc-fieldname TO UPPER CASE.

"v_alv_fc-inttype = lv_type.
v_alv_fc-inttype = p_inttype.

v_alv_fc-outputlen = lv_length.
v_alv_fc-coltext = p_heading.
v_alv_fc-seltext = p_heading.
v_alv_fc-hotspot = p_hotspot.

if p_dosum is not initial.
  v_alv_fc-do_sum = 'X'.
endif.

* Determining which fields should show zeros
IF p_hide_zeros = 'X'.
  v_alv_fc-no_zero = 'X'.
  v_alv_fc-lzero = ' '.
ELSE.
  v_alv_fc-no_zero = ' '.
  v_alv_fc-lzero = 'X'.
ENDIF.
* Add the field to the field catalog
APPEND v_alv_fc TO i_alv_fc.

ENDFORM. "alv_field




PERFORM build_alv_fc.
      CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
           EXPORTING
                    IS_VARIANT = GS_variant
                    I_SAVE     = X_SAVE       
                    i_default  = 'X'     
           CHANGING  IT_OUTTAB        = i_alv_data
                     it_fieldcatalog  = i_alv_fc.
Code:
Back to top
View user's profile Send private message
firacat
Специалист
Специалист



Joined: 20 Apr 2011
Posts: 80
Location: Ukraine

PostPosted: Mon Mar 19, 2012 11:20 am    Post subject: Reply with quote

Ниже привожу принтскрин, что кнопка суммирования неактивна


1.jpg
 Description:
 Filesize:  11.72 KB
 Viewed:  8058 Time(s)

1.jpg


Back to top
View user's profile Send private message
firacat
Специалист
Специалист



Joined: 20 Apr 2011
Posts: 80
Location: Ukraine

PostPosted: Mon Mar 19, 2012 11:46 am    Post subject: Reply with quote

Все получилось надо было еще DATATYPE поставить
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.