Текущее время: Вс, июл 20 2025, 06:52

Часовой пояс: UTC + 3 часа


Правила форума


ВНИМАНИЕ!

Вопросы по SAP Query и Quick View - сюда



Начать новую тему Ответить на тему  [ Сообщений: 2 ] 
Автор Сообщение
 Заголовок сообщения: Траблы с объявлением динамических таблиц данных...  Тема решена
СообщениеДобавлено: Вт, фев 14 2006, 12:08 
Гость
Собственно - сабж. Проблема даже в том, что я скорей не понимаю что делаю даже.

Задача, получить от пользователя путь до файла на лок. харде, имя таблицы данных для экспорта.
Соответственно:
- создать динамическую таблицу данных
- вызывать фм, которому отдать эту самую переменную и имя файла.


Code:
FORM Z_EXCEL_GET USING F_FILENAME F_TABLENAME.
data: begin of fieldtab occurs 0.
      include structure dfies.
data end of fieldtab.

data:
  fieldcat type lvc_t_fcat with header line,
  lr_table type ref to data,
  text_f.

field-symbols: <tab>   type table,
               <wa> type standard table,
               <fipos> type any.

call function 'GET_FIELDTAB'
         exporting
              tabname  = F_TABLENAME
              withtext = 'X'
         tables
              fieldtab = fieldtab.

loop at fieldtab.
    move-corresponding fieldtab to fieldcat.
    append fieldcat.
endloop.

call method cl_alv_table_create=>create_dynamic_table
                exporting it_fieldcatalog = fieldcat[]
                importing ep_table = lr_table.

assign lr_table->* to <tab>.
assign text_f to <fipos>.

* Не понятно как работать с <wa>
loop at <tab> ASSIGNING <wa>.
  message i208(00) with <wa>-caption.
endloop.

call function 'Z_EXCEL_UPLOAD_TO_INT_TABLE'
exporting
  P_FILENAME = F_FILENAME
tables
  P_TAB = <tab>.

INSERT (F_FILENAME) FROM TABLE <tab>.

message i208(00) with 'Импорт завершен!'.

ENDFORM.



Направьте на путь истинный. :)

Регардсы.


Пометить тему как нерешенную
Вернуться к началу
  
 
 Заголовок сообщения:
СообщениеДобавлено: Вт, фев 14 2006, 13:33 
Гость
<tab> - это собсна табличка, которую ты создал и заполнил,
<record> - строка <tab>
<cell> - ячейка строки

получаем имя файла от юзера:
Code:
  call method cl_gui_frontend_services=>file_open_dialog
    exporting
      window_title      = title
      file_filter       = filter           " Эксель (*.XLS)|*.XLS
      initial_directory = 'C:\'
      multiselection    = space
    changing
      file_table        = ft
      rc                = rc
      user_action       = action.
  if action eq 0.
    read table ft into f_path index 1.
  endif.

---------------------------------------------------------------------------
например, вывод в делимитированный текстовик (CSV):
Code:
  if p_tabch eq 'X'.             " tabulator
    p_delim = cl_abap_char_utilities=>horizontal_tab.
  endif.
  describe field <tab> into fld_des.
  loop at fld_des-types into t_types where idx_name gt 0.
    ncomp = ncomp + 1.
    read table fld_des-names into t_names-name
                             index t_types-idx_name.
    condense t_names-name no-gaps.
    if is_out-sline is initial.
      is_out-sline = t_names-name.
    else.
      concatenate is_out-sline t_names-name
             into is_out-sline separated by p_delim.
    endif.
  endloop.
  concatenate is_out-sline cl_abap_char_utilities=>cr_lf into is_out-sline.
  loop at <tab> assigning <record>.
    do ncomp times.
      assign component sy-index of structure <record> to <cell>.
      write <cell> to tline.
      condense tline.
      replace all occurrences of p_delim in tline with '*'.
      if sy-index eq 1.
        concatenate is_out-sline tline
               into is_out-sline.
      else.
        concatenate is_out-sline tline
               into is_out-sline separated by p_delim.
      endif.
    enddo.
    concatenate is_out-sline cl_abap_char_utilities=>cr_lf into is_out-sline.
  endloop.
  append is_out to it_out.
  call function 'GUI_DOWNLOAD'
    exporting
      filename                = f_path
      filetype                = 'ASC'
      write_lf                = space
      confirm_overwrite       = 'X'
    tables
      data_tab                = it_out.

в общем, что-то вроде того =)


Пометить тему как нерешенную
Вернуться к началу
  
 
Показать сообщения за:  Поле сортировки  
Начать новую тему Ответить на тему  [ Сообщений: 2 ] 

Часовой пояс: UTC + 3 часа


Кто сейчас на конференции

Сейчас этот форум просматривают: Yandex [Bot]


Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете добавлять вложения

Найти:
Перейти:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Русская поддержка phpBB