Simple Transformation的使用
来源:互联网 发布:淘宝宝贝关联怎么弄 编辑:程序博客网 时间:2024/06/07 09:19
事务代码:STRANS
用途:使用STRANS目的是为了将数据写入XML中,发送给接收方,接收方通过解析,重新生成带有数据的EXCEL
分类:STRANS有两种,分别是Simple Transformation 和XSLT Program。这里我们就介绍一下前者。
调用:在程序中调用Simple Transformation,可使用关键字CALL TRANSFORMATION,具体示例如下:
CALL TRANSFORMATION (STRANS名)
SOURCE table = it_tab
head = v_head
RESULT XML v_filestr.
其中IT_TAB是存放需要写入数据的内表,V_HEAD是存放固定文本信息(如EXCEL标题、列名等),定义一个结构即可,V_FILESTR是用于存放生成的XML。
TABLE、HEAD参数是可以自定义的,在TRANSFORMATION里面定义,示例如下:
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="table"/>
<tt:root name="head"/>
<tt:template>
</tt:template>
</tt:transform>
如何在TRANSFORMATION里面调用传进来的值呢,具体语法如下:
HEAD结构:<tt:value ref="head.field1"/>
TABLE内表:循环写入内表数据
<tt:loop ref=".table">
<Row ss:AutoFitHeight="0" ss:Height="55.5">
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="ARBPL"/></Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="KTEXT"/></Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="BEGDA"/></Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="ENDDA"/></Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="WETEXT"/></Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="FZTEXT"/></Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="YTTEXT"/></Data></Cell>
</Row>
</tt:loop>
XML常用参数介绍:
<PageSetup>
<!--设置横向打印,默认竖向打印-->
<Layout x:Orientation="Landscape"/>
<Header x:Margin="0.31496062992125984"/>
<Footer x:Margin="0.31496062992125984"/>
<!--页边距-->
<PageMargins x:Bottom="0.74803149606299213" x:Left="0.47244094488188981"
x:Right="0.47244094488188981" x:Top="0.74803149606299213"/>
</PageSetup>
<NamedRange ss:Name="Print_Titles" ss:RefersTo="=Sheet1!R2"/>
</Names>
完整代码如下:
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="table"/>
<tt:root name="head"/>
<tt:template>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Center"/>
<Borders/>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s62">
<Alignment ss:Vertical="Center" ss:WrapText="1"/>
</Style>
<Style ss:ID="s64">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Borders/>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="20" ss:Color="#000000"/>
</Style>
<Style ss:ID="s65">
<Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
</Style>
<Style ss:ID="s68">
<Alignment ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
</Style>
<Style ss:ID="s69">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="11" ss:Color="#000000"
ss:Bold="1"/>
<Interior ss:Color="#8DB4E3" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s70">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
</Style>
</Styles>
<Worksheet ss:Name="工作中心">
<Table x:FullColumns="1" x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="39.9375">
<Column ss:StyleID="s62" ss:AutoFitWidth="0" ss:Width="120"/>
<Column ss:StyleID="s62" ss:AutoFitWidth="0" ss:Width="230"/>
<Column ss:StyleID="s62" ss:AutoFitWidth="0" ss:Width="80"/>
<Column ss:StyleID="s62" ss:AutoFitWidth="0" ss:Width="80"/>
<Column ss:StyleID="s62" ss:AutoFitWidth="0" ss:Width="85"/>
<Column ss:StyleID="s62" ss:AutoFitWidth="0" ss:Width="110"/>
<Column ss:StyleID="s62" ss:AutoFitWidth="0" ss:Width="130"/>
<Row ss:AutoFitHeight="0">
<Cell ss:MergeAcross="6" ss:StyleID="s64"><Data ss:Type="String"><tt:value ref="head.field0"/></Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s65"><Data ss:Type="String"><tt:value ref="head.field20"/></Data></Cell>
<Cell ss:MergeAcross="2" ss:StyleID="s65">
<Data ss:Type="String"><tt:value ref="head.field22"/></Data></Cell>
<Cell ss:StyleID="s68"><Data ss:Type="String"><tt:value ref="head.field21"/></Data></Cell>
<Cell ss:MergeAcross="1" ss:StyleID="s65"><Data ss:Type="String"><tt:value ref="head.field23"/></Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s69"><Data ss:Type="String"><tt:value ref="head.field2"/></Data></Cell>
<Cell ss:StyleID="s69"><Data ss:Type="String"><tt:value ref="head.field3"/></Data></Cell>
<Cell ss:StyleID="s69"><Data ss:Type="String"><tt:value ref="head.field4"/></Data></Cell>
<Cell ss:StyleID="s69"><Data ss:Type="String"><tt:value ref="head.field5"/></Data></Cell>
<Cell ss:StyleID="s69"><Data ss:Type="String"><tt:value ref="head.field6"/></Data></Cell>
<Cell ss:StyleID="s69"><Data ss:Type="String"><tt:value ref="head.field7"/></Data></Cell>
<Cell ss:StyleID="s69"><Data ss:Type="String"><tt:value ref="head.field8"/></Data></Cell>
</Row>
<tt:loop ref=".table">
<Row ss:AutoFitHeight="0" ss:Height="55.5">
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="ARBPL"/></Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="KTEXT"/></Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="BEGDA"/></Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="ENDDA"/></Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="WETEXT"/></Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="FZTEXT"/></Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String"><tt:value ref="YTTEXT"/></Data></Cell>
</Row>
</tt:loop>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Layout x:Orientation="Landscape" x:CenterHorizontal="1"/>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<Unsynced/>
<Print>
<ValidPrinterInfo/>
<PaperSizeIndex>9</PaperSizeIndex>
<Scale>90</Scale>
<HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution>
</Print>
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>6</ActiveRow>
<ActiveCol>2</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>
</tt:template>
</tt:transform>
- Simple Transformation的使用
- 关于ArcSDE Transformation函数的使用
- Simple Java Mail的使用
- 使用Web.Config Transformation配置灵活的配置文件
- 使用Web.Config Transformation配置灵活的配置文件
- Spark:使用Java实现所有的Transformation操作
- Spark之的Transformation
- spark常用的transformation
- 常用的Transformation
- Transformation
- Simple Html Dom Parser的使用
- 使用Simple-Spring-Memcached的demo示例
- leapmotion simple control 插件的使用
- Simple-Spring-Memcached(SSM) 的简单使用
- Spark的action和transformation
- spark的transformation与action
- Affine Transformation中Rotate Transformation的等价变换
- 开源库Fab-Transformation简单使用解析
- php上传中文文件文件名乱码问题
- 浅谈HASH算法与CSDN密码泄漏事件
- 鸡兔同笼 java代码
- 使用fragmenttabhost实现tab菜单布局(去掉分割线及其布局)
- iOS MD5加密
- Simple Transformation的使用
- 我的兴趣爱好
- ruby on rails 项目中用到的mongo的查询方法
- AutoLayout——由切图引发的UITableViewCell自定义高度布局的失败!
- android带进度条的button
- Android笔记使用SharedPreferences进行数据存储
- 微信公众号开发之uwsgi拒绝post请求
- Contest1319 - 期末习题汇总(二) 计算机基础---进制转换相关
- MySQL数据类型说明