Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *&---------------------------------------------------------------------*
- *& Report YECC_BC_TAB_01
- *&
- *&---------------------------------------------------------------------*
- *& Загрузка и выгрузка данных - по Z-таблицам
- *&
- *&---------------------------------------------------------------------*
- *& [TODO] Добавить чёткую обработку ошибок при импорте данных в таблицу
- *& [TODO] Добавить возможности неполной очистки при импорте данных в таблицу
- *& [TODO] Добавить возможности неполной выгрузки данных в файл
- report yecc_bc_tab_01.
- type-pools: truxs, abap.
- parameters: p_tab type tabname16 obligatory memory id dtb.
- parameters: p_file type string obligatory default 'c:\TEMP\*.TXT'.
- parameters: rg_op1 radiobutton group opx default 'X'. "SAP -> File
- parameters: rg_op2 radiobutton group opx. "File -> SAP
- parameters: p_del as checkbox.
- start-of-selection.
- field-symbols: <f_table> type standard table.
- field-symbols: <f_structure> type any.
- data dref_ type ref to data.
- create data dref_ type standard table of (p_tab).
- assign dref_->* to <f_table>.
- data dref__ type ref to data.
- create data dref__ type (p_tab).
- assign dref__->* to <f_structure>.
- replace all occurrences of '*' in p_file with p_tab.
- data: gd_codepage type abap_encoding.
- gd_codepage = '1504'.
- case 'X'.
- when rg_op1. "SAP->FILE
- * check p_tab(4) = 'ZTMP'.
- * check sy-uname(1) = 'I'.
- select * from (p_tab) into table <f_table>.
- call function 'GUI_DOWNLOAD'
- exporting
- filename = p_file
- filetype = 'ASC'
- write_field_separator = 'X'
- codepage = gd_codepage
- tables
- data_tab = <f_table>.
- message 'Данные выгружены в файл'(001) type 'S'.
- when rg_op2. "FILE-SAP
- check p_tab(4) = 'ZTMP'.
- * check sy-uname(1) = 'I'.
- * check sy-mandt = '100' or sy-mandt = '200'.
- call function 'GUI_UPLOAD'
- exporting
- filetype = 'ASC'
- has_field_separator = 'X'
- filename = p_file
- codepage = gd_codepage
- tables
- data_tab = <f_table>.
- if p_del = 'X'.
- delete from (p_tab).
- endif.
- loop at <f_table> assigning <f_structure>.
- insert into (p_tab) values <f_structure>.
- endloop.
- message 'Данные загружены в таблицу'(002) type 'S'.
- endcase.
- end-of-selection.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement