SAPфорум.RU https://sapboard.ru/forum/ |
|
Как выгрузить готовый документ из SAP Document Builder https://sapboard.ru/forum/viewtopic.php?f=75&t=87500 |
Страница 1 из 1 |
Автор: | metha [ Пн, июл 21 2014, 09:02 ] |
Заголовок сообщения: | Как выгрузить готовый документ из SAP Document Builder |
Если кто-то использует такую мощную штуку на SAP Document Builder то этот код поможет для выгрузки готового докумета из этого модуля. Код-"болванка" при желании можно его дорастить до нужного и с требуемой оптимизацией; Code: :rtfm: report z_download_docx.
parameters: p_docid like /ipro/tdocmnt-docmnt_id. parameters: p_cntnt like /ipro/tdocmnt-content. parameters: p_outdf like /ipro/toutdef-otype. * implicit constant definition for context node content types: begin of element_content, content type /ipro/tcontent-content, content_object type ref to /ipro/if_content, content_lbl type string, end of element_content, elements_content type standard table of element_content with default key. data: lt_content type elements_content, lt_contents type /ipro/tt_contents, lo_content type ref to /ipro/if_content, ls_sel_content like line of lt_content, lr_docb_factory type ref to /ipro/if_docb_factory, lr_model type ref to /ipro/if_model, lx_notfound type ref to /ipro/cx_serializer_failed_at, lo_output type ref to /ipro/if_output. data: piv_name type string. move p_cntnt to piv_name. call function '/IPRO/CONTENT_FACTORY' exporting piv_name = piv_name importing pet_contents = lt_contents. read table lt_contents into lo_content index 1. lr_docb_factory = lo_content->get_docb_factory( ). check lr_docb_factory is not initial. lr_model = lr_docb_factory->lookup( piv_docmnt_id = p_docid piv_version = 1 ). if lr_model is initial. try. lr_model ?= lr_docb_factory->open( piv_docmnt_id = p_docid piv_docmnt_version = 1 ). catch /ipro/cx_serializer_failed_at into lx_notfound. exit. catch /ipro/cx_action_noauth /ipro/cx_action_illegal. exit. endtry. endif. if lr_model is bound. lo_output ?= lr_model. endif. data: ls_doc type /ipro/s_output. if lo_output is bound. try. lo_output->enable( p_outdf ). ls_doc = lo_output->generate( p_outdf ). catch /ipro/cx_output_otype_invalid. catch /ipro/cx_output_gen_failed. endtry. endif. data: lv_file_len type i, out_tab type standard table of tbl1024. call function 'SCMS_XSTRING_TO_BINARY' exporting buffer = ls_doc-data * APPEND_TO_TABLE = ' ' importing output_length = lv_file_len tables binary_tab = out_tab. call function 'GUI_DOWNLOAD' exporting bin_filesize = lv_file_len filename = 'd:\1.docx.' filetype = 'BIN' tables data_tab = out_tab exceptions others = 22. if sy-subrc <> 0. * Implement suitable error handling here endif. |
Автор: | Hart [ Пн, дек 08 2014, 09:22 ] |
Заголовок сообщения: | Re: Как выгрузить готовый документ из SAP Document Builder |
Коллеги, добрый день! Какой компонент/addon надо установить, чтобы появился SAP Document Builder? Можно ли им пользоваться без активации Procurement for Public sector? |
Страница 1 из 1 | Часовой пояс: UTC + 3 часа |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |