Posted: Tue Jun 10, 2008 7:11 am Post subject: call transformation
Добрый день всем ! Вот такая проблема. Мне нужно с использованием шаблона xslt выгрузить данные из сапа. Программа состоит из двух частей : 1- ая выгрузка в xml файл - происходит без проблем. Код следующий.
.....
data:
lt_xml type string
rbkpfRes type table of ZKZ_FI_STS_FI_TAX_RR
......
CALL TRANSFORMATION id
SOURCE ROOT = rbkpfRes[]
RESULT XML lt_xml.
Я могу сохранить (для проверки) данный файл - и все ок.
А вот второй этап отрабатывает с ошибкой. На втором этапе я сначала создаю xslt шаблон (прикреплен ниже). Который если его отдельно тестирую - также хорошо отрабатывает ( там цепляю сформированный на предыдущем шаге xml ) - в результате получаю html файл.
Но вот когда я это делаю из программы путем
CALL TRANSFORMATION Z_STS_TRANS
SOURCE XML = lt_xml
RESULT XML restab.
То в результате получаю только шапку - данные из xml не цепляются.
Когда проходишь это дело дебаггером - то видно - что в загруженном xml открывающие и закрывающие скобы заменяются на > и <.
Може кто в курсе данной проблемы ?
Подскажите пожалуйста.
Age: 165 Joined: 04 Oct 2007 Posts: 1218 Location: Санкт-Петербург
Posted: Wed Jun 11, 2008 11:49 am Post subject:
К сожалению система старая, лично не проверить.
На sdn.sap.com John Doe приводил пример, может Вам попробовать проверить его работоспособность, и если работает - разбираться со структурой XSLT файла.
Form SAP Help:
Quote:
Simple Transformations
Simple Transformations (ST) is an SAP programming language for describing transformations between ABAP data and XML formats. ST is restricted to the two modes of serialization (ABAP to XML) and deserialization (XML to ABAP) of ABAP data, which are most important for data integration. Transformations from ABAP to ABAP and XML to XML, like in the more general XSLT are not possible in ST.
In comparison with XSLT, the main advantages of ST programs are as follows:
ST programs are declarative and thus easier to read
ST programs only have serial access to the XML data and are therefore very efficient even with large data volumes
ST programs describe serialization and deserialization simultaneously - that is, ABAP data serialized in XML with ST can also be deserialized with the same ST program.
Simple transformations that can be called using CALL TRANSFORMATION must be in the repository. ST programs can be edited using the Transformation Editor. This is called up either with transaction STRANS or by choosing Edit Object → More → Transformation followed by Simple Transformation in the ABAP Workbench object navigator
More information on Simple Transformations is available in the Knowledge Warehouse.
Example (from help also )
Quote:
Simple Transformation Example
Serialization of a nested structure. In the following ABAP program section, a nested structure struc1 is serialized to xml_string with the Simple Transformation st_trafo and deserialized with the same transformation.
DATA: BEGIN OF struc1,
col1 TYPE c LENGTH 10 VALUE 'ABCDEFGHIJ',
col2 TYPE i VALUE 111,
BEGIN OF struc2,
col1 TYPE d VALUE '20040126',
col2 TYPE t VALUE '084000',
END OF struc2,
END OF struc1.
DATA: xml_string TYPE string,
result LIKE struc1.
TRY.
CALL TRANSFORMATION st_trafo
SOURCE para = struc1
RESULT XML xml_string.
...
CALL TRANSFORMATION st_trafo
SOURCE XML xml_string
RESULT para = result.
CATCH cx_st_error.
...
ENDTRY.
The Simple Transformation st_trafo has the following form:
The transformation consists of a Template temp that defines the structure of the XML document and establishes relationships between value nodes and components of the structure. The result of the transformation is as follows (line breaks and indentations were inserted for clarification purposes):
The conversion of elementary data types is the same as for asXML. The reverse transformation generates the same content in the structure result as in struc1.
Good luck.
PS: John Doe - прости, ссылку на твой пост на sdn не сохранил, только текст.
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.