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 grid



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


Age: 37
Joined: 12 Mar 2010
Posts: 25

PostPosted: Mon May 23, 2011 1:49 pm    Post subject: Выбор значений для поля в динамическом alv grid Reply with quote

Добрый день.
Есть динамически формируемый редактируемый alv grid. Для некоторых полей нужно сделать возможность выбора значений из списка.
Делаю это так:
Code:
form main_attr_set_grid_drdn using attr_id type z_head-attr_id
                             changing ct_fcat type lvc_t_fcat.

  TYPES: begin of z_attr_type,
            atnam like cabn-atnam,
            atwtb like cawnt-atwtb,
            atwrt like cawn-atwrt,
         end of z_attr_type.

  field-symbols: <ls_outtab> type any,
                 <ls_fcat>   type lvc_s_fcat,
                 <fs>.

  data: lt_drdn type lvc_t_drop,                            "#EC NEEDED
        ls_drdn type lvc_s_drop,                            "#EC NEEDED
        lt_dral type lvc_t_dral,                            "#EC NEEDED
        ls_dral type lvc_s_dral,                            "#EC NEEDED
        l_count type i.

  define mac_get_drdn.
    ls_drdn-handle  = 1.
    ls_drdn-value   = &1.
    append ls_drdn to lt_drdn.

    add 1 to l_count.
    ls_dral-handle    = 1.
    ls_dral-value     = &1.
    write l_count to ls_dral-int_value left-justified.
    append ls_dral to lt_dral.
  end-of-definition.


  loop at t_attr_val.
      mac_get_drdn t_attr_val-atwrt.
  endloop.

  call method g_grid->set_drop_down_table
    exporting
      it_drop_down_alias = lt_dral.

  read table ct_fcat assigning <ls_fcat>
             with key fieldname = attr_id.

  if sy-subrc eq 0.
    <ls_fcat>-drdn_field = 'HANDLE_DRDN'.
    <ls_fcat>-drdn_alias = 'X'.
  endif.

  loop at <dyn_table> assigning <ls_outtab>.
    ASSIGN COMPONENT 'HANDLE_DRDN' OF STRUCTURE <ls_outtab> TO <fs>.
*    <ls_outtab>-handle_drdn = 1.
    <fs> = 1.
  endloop.

endform.


Проблема в том, что значения в списке не отображаются. Кнопка для выбора списка в ячейке создается, но значения выбрать нельзя. Табличка lt_dral на выходе непустая.
Если делать тоже самое для alv grid, в котором все поля руками создаю, то список значений отображается нормально.
С чем это может быть связано?
Back to top
View user's profile Send private message
evggen
Участник
Участник


Age: 37
Joined: 12 Mar 2010
Posts: 25

PostPosted: Mon May 23, 2011 3:15 pm    Post subject: Reply with quote

Разобрался
Back to top
View user's profile Send private message
evggen
Участник
Участник


Age: 37
Joined: 12 Mar 2010
Posts: 25

PostPosted: Mon May 23, 2011 4:54 pm    Post subject: Reply with quote

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

Филд каталог заполняю так:
Code:
FORM CreateFieldNames USING f_name TYPE zozm_wf_obl_attr-attr_id
                            f_text TYPE zozm_wf_obl_attr-attr_name.

  ls_fcat-fieldname = f_name.
  ls_fcat-seltext = f_text.
  ls_fcat-coltext = f_text.
  ls_fcat-outputlen = 100.
  ls_fcat-no_zero = 'X'.
  ls_fcat-lowercase = 'X'.
  ls_fcat-checktable = '!'.
*  ls_fcat-no_out = 'X'.
  append ls_fcat to gt_fieldcat2.
ENDFORM.
Back to top
View user's profile Send private message
evggen
Участник
Участник


Age: 37
Joined: 12 Mar 2010
Posts: 25

PostPosted: Tue May 24, 2011 9:11 am    Post subject: Reply with quote

Разобрался,
не нужно было указывать
Code:
<ls_fcat>-drdn_alias = 'X'.
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.