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

Два расширения файла в cl_gui_frontend_services=>file_ope



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
XXX_:)
Аналитик
Аналитик


Age: 40
Joined: 01 Feb 2008
Posts: 387
Location: Воронеж

PostPosted: Mon Feb 01, 2010 3:54 pm    Post subject: Два расширения файла в cl_gui_frontend_services=>file_ope Reply with quote

нужно открыть диалог открытия файла для EXCEL-файлов. Два вида расширений XLS XLSX. Вот не удается задать нужным образом параметры cl_gui_frontend_services=>file_open_dialog. Можно конечно отобразить все файлы в директории и затем проверять, что указал пользователь, но хочется изящности, поэтому прошу подсказать если кто знает.
_________________
Hормальные люди делают вещи намного более безумные чем всё, что делают сумасшедшие (c) С.Лем
Back to top
View user's profile Send private message Blog
vga
Мастер
Мастер


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

PostPosted: Mon Feb 01, 2010 5:32 pm    Post subject: Reply with quote

Типа так:

Code:
FILE_FILTER = 'All Files (*.*)|*.*|Excel Files (*.xls)|*.xls|Word files(*.doc)|*.doc'


Code:
* Initialisierung
CONCATENATE 'Alle-Dateien(*.*)|*.*|'
'Word-Dateien(*.doc)|*.doc|'
'Bild-Dateien(*.gif)|*.gif|'
'Bild-Dateien(*.jpg)|*.jpg|'
'Mail-Dateien(*.msg)|*.msg|'
'PDF-Dateien(*.pdf)|*.pdf|'
'Bild-Dateien(*.tif)|*.tif|'
'Text-Dateien(*.txt)|*.txt|'
'Excel-Dateien(*.xls)|*.xls'
INTO filter.

* Datei abfragen
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Datei auswдhlen'
file_filter = filter
initial_directory = 'C:\'
CHANGING
file_table = i_file[]
rc = rcode
EXCEPTIONS
OTHERS = 1.
Back to top
View user's profile Send private message Blog Visit poster's website
John Doe
Модератор
Модератор


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

PostPosted: Mon Feb 01, 2010 5:39 pm    Post subject: Reply with quote

Code:
DATA: file_table TYPE filetable,
      rc TYPE i.

CALL METHOD cl_gui_frontend_services=>file_open_dialog
  EXPORTING
    default_extension = 'XLS'
    file_filter       = cl_gui_frontend_services=>filetype_excel
  CHANGING
    file_table        = file_table
    rc                = rc.

Вот только эксель.
Back to top
View user's profile Send private message Blog
XXX_:)
Аналитик
Аналитик


Age: 40
Joined: 01 Feb 2008
Posts: 387
Location: Воронеж

PostPosted: Mon Feb 01, 2010 6:39 pm    Post subject: Reply with quote

Сделал по совету VGA
Code:
 CONCATENATE 'EXCEL(*.xls)|*.xls|' 'EXCEL(*.xlsx)|*.xlsx' INTO l_file_filter.

  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title            = 'Укажите EXCEL файл'
       file_filter             = l_file_filter
    CHANGING
      file_table              = lt_file_table
      rc                      = rc_dummy
    EXCEPTIONS


Если написать cl_gui_frontend_services=>filetype_excel в фильтре, то не возможно выбрать файлы EXCEL 2008 *.xlsx
Всем спасибо.

_________________
Hормальные люди делают вещи намного более безумные чем всё, что делают сумасшедшие (c) С.Лем
Back to top
View user's profile Send private message Blog
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.