Strans - Optional Transform templates
Hi Gurus!
I am new to transformations and I am having an issue that's revealing to be to mutch for me.
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"
xmlns:ddic="http://www.sap.com/abapxml/types/dictionary"
xmlns:def="http://www.sap.com/abapxml/types/defined" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">
<tt:root name="DOCUMENT" type="ddic:Z3FI_SEPA"/>
<tt:template>
<DOCUMENT>
Line 5 has an attribute with a literal value. This attribute is there because a version of XML file that I am trying to deserialize has this atribute in his <DOCUMENT> element:
<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CstmrCdtTrfInitn>
Now I need to deserialize another document that is almost the same (with some additional non obligatory fields) but wiht atribute xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.003.02".
Is there a way to remove/discard/ignore this attribute?
Thank you guys!
Best regards,
Carlos
Hi Carlos,
maybe you can move the xmlns attribute to the DOCUMENT tag and use
tt:cond frq="?" to conditionally use one of them, like:
<tt:template>
<tt:group>
<tt.cond frq="?">
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">......
</tt.cond>
<tt.cond frq="?">
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.02">......
</tt.cond>
</tt:group>
</tt:template>
I'm almost sure it won't work because it's a different attribute and not a different tag, but you might try it.
Other thing that should work is a tt:lax="on" but it surely won't.
Anyway I can't try and confirm it now, but you might.
regards,
Edgar
Similar Messages
-
Default options in templates?
Is it possible to make defaults in a template?
I normally change the page width to 900px using the inspector but it is a pain having to do this for every page.
Is it possible to set defaults so that every time I add a new page my settings are included?
Cheers, JackNo. Send a feature request to http://www.apple.com/feedback/iweb.html. You can, however, create a second site, add a one of each page layout and set each to the defaults you want. Then when a new page is needed duplicate the layout type you want, drag up to the working site, and change the theme as needed. The width and length will remain as set previously.
OT -
Xml header in transformation strans
Hello,
I would like to create an xml file with the following header information:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<tem:mygesttem>
<tem:mytem>
So, I have created the following piece of code in transaction STRANS:
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ROOT"/>
<tt:template>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<tem:mygestem>
<tem:mytem>
However, as soon as I launch it with CALL TRANSFORMATION in my ABAP program the xml file is different from I would expect:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<tem:mygestem xmlns="http://tempuri.org/">
<tem:mytem>
Could anyone tell me why the header is different from expected?
Thank you,
OscarAny ideas? please.
-
VS2012 - Build - Transform text templates
We have a relatively large solution file (25 projects). If I build any one of these projects, the final build step is "Transforming templates for all project items". Does anyone know where the setting is to toggle this functionality in visual studio
2012.
I thought it was my 'power commands' plugin which was doing this, but I've turned it off but doing so hasn't stopped the functionality.
It causes all the builds to hang for 5 - 6 seconds at the end, and for something that isn't really needed for each and every build its getting a bit annoying.
I removed a bunch of add-ins from my VS but no luck.
These were:
VS Power Commands
VS productivity tools
Tangible T4 Editor (free)
I've since started VS with all add-ons disabled, but it still does it.
Strange thing is, in one branch it doesn't do it and in others it does, even after a full merge. I tried deleting the .suo file but it made no difference.
It even runs if I start a build, and then cancel it.
Any insights are appreciated.Hi marlon_tucker,
I doubt that the output informaiton would be related to the T4 text templates, could you get the .tt files in your project?
Reference:
https://msdn.microsoft.com/en-us/library/bb126478.aspx
https://msdn.microsoft.com/en-us/library/ee844259.aspx
If you want to disable it when you build it, maybe you could think about changing the property of this .tt file.
http://stackoverflow.com/questions/13594860/how-to-disable-t4-template-auto-run-in-visual-studio-2012
Best Regards,
Jack
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Mediator. "Transform using" option.
Hello.
My mediator use option : Transform using : my.xsl file. Mediator transform xmlA to xmlB fine. I have question : How I can change output encoding (xmlB) ? In xsl file I set :
<xsl:output method="xml" version="1.0" encoding="windows-1251" indent="yes" />
but output xml has UTF-8. Why it doesn't work ?You can use one of the below options:
<xsl:output
method="xml|html|text|name"
version="string"
encoding="string"
omit-xml-declaration="yes|no"
standalone="yes|no"
doctype-public="string"
doctype-system="string"
cdata-section-elements="namelist"
indent="yes|no"
media-type="string"/>
Ref: http://www.w3schools.com/xsl/el_output.asp
-AR -
Simple Transformation from Adobe Form XML document to Dictionary structures
I have an XML document that I am receiving via email (the XML document is generated from an Adobe Interactive form). I would like to write a simple transformation that will map that XML document to a structure and internal table in my ABAP program. I am new to Simple Transformations and I am having trouble working out how to write a simple transformation for this type of XML document. I would prefer to write a custom transformation rather than using the identity transformation (ID). I would appreciate any help you can provide.
Please refer to the below for an example of the XML file.
This maps directly to 2 dictionary structures that exist within our system containing all of the same components. PIM_REQUEST_HDR has a corresponding SAP dictionary structure Y_REQUEST_HDR and PIM_REQUEST_ITEMS has a corresponding SAP dictionary structure Y_REQUEST_ITEMS.
Can anyone help with some instructions or examples of how to create the simple transformation?
Thanks for your help! We are using ECC 6.0
Sample XML to be transformed:
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<SFPSY>
<DATE>2007-07-03</DATE>
<TIME>07:25:21</TIME>
<USERNAME>TLCITY</USERNAME>
<SUBRC>0</SUBRC>
</SFPSY>
<PIM_REQUEST_HDR>
<MANDT />
<REQ_NUM />
<REQ_DESC>blah blah blah</REQ_DESC>
<PROC_AREA>CTC</PROC_AREA>
<REQUESTED>2007-07-03</REQUESTED>
<REQUIRED>2007-07-03</REQUIRED>
<REQUESTOR>TLCITY</REQUESTOR>
<MOD_TYPE>SAP Note manual changes</MOD_TYPE>
<SAPNOTE_NUM>59549656</SAPNOTE_NUM>
<SAPMSG_NUM>0000000000</SAPMSG_NUM>
<TECH_SCRIPT />
<REASON />
<DEV_ENV>ECC6</DEV_ENV>
<INSTALL_NO>2861655161</INSTALL_NO>
<BASIS_REL>700</BASIS_REL>
<REG_STATUS />
<REJ_REASON />
<APP_DATE />
<REJ_DATE />
<APPROVER />
<REGISTRATOR />
<REG_DATE />
</PIM_REQUEST_HDR>
<PIM_REQUEST_ITEMS>
<DATA>
<MANDT />
<REQ_NUM />
<PGMID>R3TR</PGMID>
<OBJECT>PROG</OBJECT>
<OBJ_NAME>RSDIJOIJSDOIF</OBJ_NAME>
<ACCESSKEY />
</DATA>
<DATA>
<MANDT />
<REQ_NUM />
<PGMID>R3TR</PGMID>
<OBJECT>PROG</OBJECT>
<OBJ_NAME>RRRSDIJOIJS03</OBJ_NAME>
<ACCESSKEY />
</DATA>
</PIM_REQUEST_ITEMS>
</data>I have solved this one with the help of another collegue.
To simplify, we changed the XML to be as follows:
[code]
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<PIM_REQUEST>
<REQ_HDR>
<MANDT />
<REQ_NUM />
<REQ_DESC>Key required for pricing routines</REQ_DESC>
<PROC_AREA>SD</PROC_AREA>
<REQUESTED>2007-07-30</REQUESTED>
<REQUIRED>2007-08-02</REQUIRED>
<REQUESTOR>TLCITY</REQUESTOR>
<MOD_TYPE>SAP Note: Manual Changes</MOD_TYPE>
<SAPNOTE_NUM>0000000000</SAPNOTE_NUM>
<SAPMSG_NUM>0000000000</SAPMSG_NUM>
<TECH_SCRIPT>TS-2498 Pricing Routines</TECH_SCRIPT>
<REASON>New pricing routines required</REASON>
<DEV_ENV>ECC6</DEV_ENV>
<INSTALL_NO>029</INSTALL_NO>
<BASIS_REL>700</BASIS_REL>
<REG_STATUS />
<REJ_REASON />
<APP_DATE />
<REJ_DATE />
<APPROVER />
<REGISTRATOR />
<REG_DATE />
</REQ_HDR>
<KEY_DETAILS>
<DATA>
<MANDT />
<REQ_NUM />
<PGMID>R3TR</PGMID>
<OBJECT>PROG</OBJECT>
<OBJ_NAME>RVGHT902</OBJ_NAME>
<ACCESSKEY />
</DATA>
<DATA>
<MANDT />
<REQ_NUM />
<PGMID>R3TR</PGMID>
<OBJECT>PROG</OBJECT>
<OBJ_NAME>RVGHT901</OBJ_NAME>
<ACCESSKEY />
</DATA>
</KEY_DETAILS>
</PIM_REQUEST>
</data>
[/code]
This maps directly to 1 dictionary structure that exists within our system containing all of the same components. PIM_REQUEST has a corresponding SAP dictionary structure Y_REQUEST_HDR which is a deep structure and has within it a structure REQ_HDR and a table KEY_DETAILS.
The corresponding simple transformation we have then used is as follws:
[code]
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="root"/>
<tt:template>
<data>
<PIM_REQUEST>
<tt:copy ref="root"/>
</PIM_REQUEST>
</data>
</tt:template>
</tt:transform>
[/code]
Alternatively the following 2 options also work:
Option 2:
[code]
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="root"/>
<tt:template>
<data>
<PIM_REQUEST>
<REQ_HDR>
<tt:copy ref="root.REQ_HDR"/>
</REQ_HDR>
<KEY_DETAILS>
<tt:loop name="KEY_DETAILS" ref="root.KEY_DETAILS">
<DATA>
<tt:copy ref="$KEY_DETAILS"/>
</DATA>
</tt:loop>
</KEY_DETAILS>
</PIM_REQUEST>
</data>
</tt:template>
</tt:transform>
[/code]
Option 3:
[code]
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="root"/>
<tt:template>
<data>
<PIM_REQUEST>
<REQ_HDR>
<MANDT tt:value-ref="root.REQ_HDR.MANDT"/>
<REQ_NUM tt:value-ref="root.REQ_HDR.REQ_NUM"/>
<REQ_DESC tt:value-ref="root.REQ_HDR.REQ_DESC"/>
<PROC_AREA tt:value-ref="root.REQ_HDR.PROC_AREA"/>
<REQUESTED tt:value-ref="root.REQ_HDR.REQUESTED"/>
<REQUIRED tt:value-ref="root.REQ_HDR.REQUIRED"/>
<REQUESTOR tt:value-ref="root.REQ_HDR.REQUESTOR"/>
<MOD_TYPE tt:value-ref="root.REQ_HDR.MOD_TYPE"/>
<SAPNOTE_NUM tt:value-ref="root.REQ_HDR.SAPNOTE_NUM"/>
<SAPMSG_NUM tt:value-ref="root.REQ_HDR.SAPMSG_NUM"/>
<TECH_SCRIPT tt:value-ref="root.REQ_HDR.TECH_SCRIPT"/>
<REASON tt:value-ref="root.REQ_HDR.REASON"/>
<DEV_ENV tt:value-ref="root.REQ_HDR.DEV_ENV"/>
<INSTALL_NO tt:value-ref="root.REQ_HDR.INSTALL_NO"/>
<BASIS_REL tt:value-ref="root.REQ_HDR.BASIS_REL"/>
<REG_STATUS tt:value-ref="root.REQ_HDR.REG_STATUS"/>
<REJ_REASON tt:value-ref="root.REQ_HDR.REJ_REASON"/>
<APP_DATE tt:value-ref="root.REQ_HDR.APP_DATE"/>
<REJ_DATE tt:value-ref="root.REQ_HDR.REJ_DATE"/>
<APPROVER tt:value-ref="root.REQ_HDR.APPROVER"/>
<REGISTRATOR tt:value-ref="root.REQ_HDR.REGISTRATOR"/>
<REG_DATE tt:value-ref="root.REQ_HDR.REG_DATE"/>
</REQ_HDR>
<KEY_DETAILS>
<tt:loop ref="root.KEY_DETAILS" name="KEY_DETAILS">
<DATA>
<MANDT tt:value-ref="$KEY_DETAILS.MANDT"/>
<REQ_NUM tt:value-ref="$KEY_DETAILS.REQ_NUM"/>
<PGMID tt:value-ref="$KEY_DETAILS.PGMID"/>
<OBJECT tt:value-ref="$KEY_DETAILS.OBJECT"/>
<OBJ_NAME tt:value-ref="$KEY_DETAILS.OBJ_NAME"/>
<ACCESSKEY tt:value-ref="$KEY_DETAILS.ACCESSKEY"/>
</DATA>
</tt:loop>
</KEY_DETAILS>
</PIM_REQUEST>
</data>
</tt:template>
</tt:transform>
[/code] -
In the below XML code how to make the <CUSTOMERDETAILS> node as Optional node.
If suppose in the input XML file if <CUSTOMERDETAILS> node is not available,I want to make the node as optional one.
As of now system is getting dump, becuase node data <CUSTOMERDETAILS> is not availbale in the XML file.
uFEFF<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates" xmlns:ddic="http://www.sap.com/abapxml/types/dictionary" xmlns:def="http://www.sap.com/abapxml/types/defined">
<tt:root name="IT_TRANSACTION" type="ddic:ZTABTRANSACTION"/>
<tt:template>
<IT_TRANSACTION>
<tt:loop ref=".IT_TRANSACTION" name="a">
<item>
<RETAILSTOREID tt:value-ref="RETAILSTOREID"/>
<BUSINESSDAYDATE tt:value-ref="BUSINESSDAYDATE"/>
<TRANSTYPECODE tt:value-ref="TRANSTYPECODE"/>
<WORKSTATIONID tt:value-ref="WORKSTATIONID"/>
<TRANSNUMBER tt:value-ref="TRANSNUMBER"/>
<BEGINTIMESTAMP tt:value-ref="BEGINTIMESTAMP"/>
<ENDTIMESTAMP tt:value-ref="ENDTIMESTAMP"/>
<OPERATORQUAL tt:value-ref="OPERATORQUAL"/>
<OPERATORID tt:value-ref="OPERATORID"/>
<CUSTOMERDETAILS>
<tt:loop ref="$a.CUSTOMERDETAILS">
<item>
<CUSTOMERINFOTYPE tt:value-ref="CUSTOMERINFOTYPE"/>
<DATAELEMENTID tt:value-ref="DATAELEMENTID"/>
<DATAELEMENTVALUE tt:value-ref="DATAELEMENTVALUE"/>
</item>
</tt:loop>
</CUSTOMERDETAILS>
<RETAILLINEITEM>
<tt:loop ref="$a.RETAILLINEITEM" name="b">
<item>
<RETAILNUMBER tt:value-ref="RETAILNUMBER"/>
<RETAILTYPECODE tt:value-ref="RETAILTYPECODE"/>
<ITEMIDQUALIFIER tt:value-ref="ITEMIDQUALIFIER"/>
<ITEMID tt:value-ref="ITEMID"/>
<RETAILQUANTITY tt:value-ref="RETAILQUANTITY"/>
<SALESAMOUNT tt:value-ref="SALESAMOUNT"/>
<ENTRYMETHODCODE tt:value-ref="ENTRYMETHODCODE"/>
<EXTENSIONS>
<tt:loop ref="$b.EXTENSIONS">
<item>
<FIELDGROUP tt:value-ref="FIELDGROUP"/>
<FIELDNAME tt:value-ref="FIELDNAME"/>
<FIELDVALUE tt:value-ref="FIELDVALUE"/>
</item>
</tt:loop>
</EXTENSIONS>
</item>
</tt:loop>
</RETAILLINEITEM>
<TAX>
<tt:loop ref="$a.TAX">
<item>
<TAXNUMBER tt:value-ref="TAXNUMBER"/>
<TAXTYPECODE tt:value-ref="TAXTYPECODE"/>
<TAXAMOUNT tt:value-ref="TAXAMOUNT"/>
</item>
</tt:loop>
</TAX>
<EXTENSIONS>
<tt:loop ref="$a.EXTENSIONS">
<item>
<FIELDGROUP tt:value-ref="FIELDGROUP"/>
<FIELDNAME tt:value-ref="FIELDNAME"/>
<FIELDVALUE tt:value-ref="FIELDVALUE"/>
</item>
</tt:loop>
</EXTENSIONS>
</item>
</tt:loop>
</IT_TRANSACTION>
</tt:template>
</tt:transform>
Edited by: Thomas Zloch on Nov 24, 2010 12:38 PM - please use code tags also for XML structuresYou might be able to solve this using conditional transformations, please see SAP online help for simple transformations:
http://help.sap.com/saphelp_nw04/helpdata/en/0c/402040abf2c442e10000000a1550b0/frameset.htm
Please let us know the result.
Thomas -
Hi experts,
Can any one tell what is call transformation used for and all also the use of 'id' given in the syntax below.
CALL TRANSFORMATION id
SOURCE (Internal table)
RESULT (XML string )
Thanks®ards,
Karthik.Form SAP Help:
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 u2192 More u2192 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 )
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:
<tt:transform template="temp"
xmlns:tt="http://www.sap.com/transformation-templates"
version="0.1">
<tt:root name="PARA"/>
<tt:template name="temp">
<X>
<X1>
<tt:value ref="PARA.COL1" />
<X2>
<tt:value ref="PARA.COL2" />
<X3>
<X1>
<tt:value ref="PARA.STRUC2.COL1" />
<X2>
<tt:value ref="PARA.STRUC2.COL2" />
</X>
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):
<X>
<X1>ABCDEFGHIJ
<X2>111
<X3>
<X1>2004-01-26
<X2>08:40:00
</X>
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. -
Simple Transformation to deserialize an XML file into ABAP data structures?
I'm attempting to write my first simple transformation to deserialize
an XML file into ABAP data structures and I have a few questions.
My simple transformation contains code like the following
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"
xmlns:pp="http://www.sap.com/abapxml/types/defined" >
<tt:type name="REPORT" line-type="?">
<tt:node name="COMPANY_ID" type="C" length="10" />
<tt:node name="JOB_ID" type="C" length="20" />
<tt:node name="TYPE_CSV" type="C" length="1" />
<tt:node name="TYPE_XLS" type="C" length="1" />
<tt:node name="TYPE_PDF" type="C" length="1" />
<tt:node name="IS_NEW" type="C" length="1" />
</tt:type>
<tt:root name="ROOT2" type="pp:REPORT" />
<QueryResponse>
<tt:loop ref="ROOT2" name="line">
<QueryResponseRow>
<CompanyID>
<tt:value ref="$line.COMPANY_ID" />
</CompanyID>
<JobID>
<tt:value ref="$line.JOB_ID" />
</JobID>
<ExportTypes>
<tt:loop>
<ExportType>
I don't know what to do here (see item 3, below)
</ExportType>
</tt:loop>
</ExportTypes>
<IsNew>
<tt:value ref="$line.IS_NEW"
map="val(' ') = xml('false'), val('X') = xml('true')" />
</IsNew>
</QueryResponseRow>
</tt:loop>
</QueryResponse>
</tt:loop>
1. In a DTD, an element can be designated as occurring zero or one
time, zero or more times, or one or more times. How do I write the
simple transformation to accommodate these possibilities?
2. In trying to accommodate the "zero or more times" case, I am trying
to use the <tt:loop> instruction. It occurs several layers deep in the
XML hierarchy, but at the top level of the ABAP table. The internal
table has a structure defined in the ABAP program, not in the data
dictionary. In the simple transformation, I used <tt:type> and
<tt:node> to define the structure of the internal table and then
tried to use <tt:loop ref="ROOT2" name="line"> around the subtree that
can occur zero or more times. But every variation I try seems to get
different errors. Can anyone supply a working example of this?
3. Among the fields in the internal table, I've defined three
one-character fields named TYPE_CSV, TYPE_XLS, and TYPE_PDF. In the
XML file, I expect zero to three elements of the form
<ExportType exporttype='csv' />
<ExportType exporttype='xls' />
<ExportType exporttype='pdf' />
I want to set field TYPE_CSV = 'X' if I find an ExportType element
with its exporttype attribute set to 'csv'. I want to set field
TYPE_XLS = 'X' if I find an ExportType element with its exporttype
attribute set to 'xls'. I want to set field TYPE_PDF = 'X' if I find
an ExportType element with its exporttype attribute set to 'pdf'. How
can I do that?
4. For an element that has a value like
<ErrorCode>123</ErrorCode>
in the simple transformation, the sequence
<ErrorCode> <tt:value ref="ROOT1.CODE" /> </ErrorCode>
seems to work just fine.
I have other situations where the XML reads
<IsNew value='true' />
I wanted to write
<IsNew>
<tt:value ref="$line.IS_NEW"
map="val(' ') = xml('false'), val('X') = xml('true')" />
</IsNew>
but I'm afraid that the <tt:value> fails to deal with the fact that in
the XML file the value is being passed as the value of an attribute
(named "value"), rather than the value of the element itself. How do
you handle this?Try this code below:
data l_xml_table2 type table of xml_line with header line.
W_filename - This is a Path.
if w_filename(02) = '
open dataset w_filename for output in binary mode.
if sy-subrc = 0.
l_xml_table2[] = l_xml_table[].
loop at l_xml_table2.
transfer l_xml_table2 to w_filename.
endloop.
endif.
close dataset w_filename.
else.
call method cl_gui_frontend_services=>gui_download
exporting
bin_filesize = l_xml_size
filename = w_filename
filetype = 'BIN'
changing
data_tab = l_xml_table
exceptions
others = 24.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. -
Images in RTF template giving errors
Hi,
I am using "XML Publisher Template Builder for Word" ver 5.6 Build 45.
My requirement says that i need to put all data values in a Rectangular BOX. I made the template and tested the same by using Priview option of Template Buider, and it looks Good.
Now as soon as i am trying to upload the same template it gives me NPE, i am pasting the same here....
## Detail 0 ##
java.lang.NullPointerException
at oracle.apps.xdo.XDOException.getMessage(XDOException.java:128)
at java.lang.Throwable.getLocalizedMessage(Throwable.java:266)
at java.lang.Throwable.toString(Throwable.java:343)
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:862)
at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(OAException.java:985)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:210)
Now after this when i closed the instance and reopen it, i found the template is already added even after that exception.
Now i when i am trying to run report it is compliting with error and in log life, error is shown as below...
[9/21/06 2:45:46 PM] [UNEXPECTED] [186597:RT3517534] java.sql.SQLException: No c
orresponding LOB data found :SELECT L.FILE_DATA FILE_DATA, DBMS_LOB.GETLENGTH(L.
FILE_DATA) FILE_LENGTH, L.LANGUAGE LANGUAGE, L.TERRITORY TERRITORY, B.DEFAULT_LA
NGUAGE DEFAULT_LANGUAGE, B.DEFAULT_TERRITORY DEFAULT_TERRITORY,B.TEMPLATE_TYPE_C
ODE TEMPLATE_TYPE_CODE, B.USE_ALIAS_TABLE USE_ALIAS_TABLE, B.START_DATE START_DA
TE, B.END_DATE END_DATE, B.TEMPLATE_STATUS TEMPLATE_STATUS, B.USE_ALIAS_TABLE US
E_ALIAS_TABLE FROM XDO_LOBS L, XDO_TEMPLATES_B B WHERE L.LOB_TYPE = :1 AND L.APP
LICATION_SHORT_NAME= :2 AND L.LOB_CODE = :3 AND L.APPLICATION_SHORT_NAME = B.APP
LICATION_SHORT_NAME AND L.LOB_CODE = B.TEMPLATE_CODE AND ( (L.LANGUAGE = :4 AND
L.TERRITORY = :5 ) OR (L.LANGUAGE = :6 AND L.TERRITORY = :7) OR (L.LANGUAGE=
B.DEFAULT_LANGUAGE AND L.TERRITORY= B.DEFAULT_TERRITORY ) )
As there is no row returing in this query i thing there are some prasing issues with RTF templated with images as the same report works fine without images.
Please tell me if you have any pointer how to resove the issue.Hi Tim,
We have logged SR 5803815.992, and uploaded the RTF template and a sample XML data file.
We are currently on 11.5.10 CU2 and 11i.XDO.H
Please let us know if you need any other information.
Thanks -
Unable To Find Data Entry Form Template
Is this option still available? User Interface Attributes under the Region Definition only gives the following options:
No Template
Blue Title
Gray Title
Open Gray TitleHi ,
Please make sure that you are doing the extractor check in Update mode 'Full' .If the setup tables are filled then this should pick the data for the 2 newly added fields .
check and update accordingly later .
Thanks
Kamal Mehta -
Using Simple Transformations with Objects tt:copy .. results in Exception
Question:
How can I serialize an ABAP-Object-Instanz with my own simple transformation?
In the sap-documentation I found the following solution for the serialisation of any data-objects.
"z_steffens_simple_transf":
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ROOT"/>
<tt:template>
<root>
<tt:copy ref="ROOT"/>
</root>
</tt:template>
</tt:transform>
Following the example I wrote this report:
report zspahr_test_simple_transf.
class serializable definition.
public section.
interfaces if_serializable_object.
data attr type string value 'Attribute'.
endclass.
method main_serializable.
data: oref type ref to serializable,
xmlstr type xstring.
create object oref.
call transformation id
source root = oref
result xml xmlstr.
call function 'DISPLAY_XML_STRING'
exporting
xml_string = xmlstr.
call transformation z_steffens_simple_object
source root = oref
result xml xmlstr.
call function 'DISPLAY_XML_STRING'
exporting
xml_string = xmlstr.
endmethod. "main_
start-of-selection.
demo=>main_serializable( ).
Executing this report leads to an exception "CX_SY_REF_NOT_SUPPORTED".
The "standard" transformation "ID" ist working an translates my object-instance into an asXML representation:
<?xml version="1.0" encoding="utf-8" ?>
- <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
- <asx:values>
<ROOT href="#o3" />
</asx:values>
- <asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary">
- <prg:SERIALIZABLE xmlns:prg="http://www.sap.com/abapxml/classes/program/ZSPAHR_TEST_SIMPLE_TRANSF" id="o3">
- <local.SERIALIZABLE>
<ATTR>Attribute</ATTR>
</local.SERIALIZABLE>
</prg:SERIALIZABLE>
</asx:heap>
</asx:abap>
How can I do this with my own Simple Transformation "ZSPAHR_TEST_SIMPLE_TRANSF" ?
I want to serialize my object using my own xml-structure, not the asXML-structure !
Regards
SteffenHi,
try like this,i think it may help you.
ABAP:
CALL TRANSFORMATION ztrans_test
SOURCE
root = partab
RESULT XML lv_xstring.
Trnsformation:
<tt:root name="ROOT" type="?"/>
<tt:template>
<VALUES>
<VALUE_SOURCE>
<tt:value ref=".ROOT"/>
</VALUE_SOURCE>
<VALUE_PARAM>
<tt:value ref="NAME"/>
<tt:value ref="VALUE"/>
</VALUE_PARAM>
</VALUES>
Thanks,
Rajesh. -
Copy ldapv3 directory server templates from one mac to another
Hi,
I've spent considerable time tuning the "search & mappings" settings to work with a linux based openldap server - based on the rfc 2307 (unix) settings. I have selected the option "save template", however I can see no option which would allow me to import the template either back onto the current imac (in the event of a rebuild) or as I wish to do - copy the settings onto another imac.
Can someone explain where I need to copy the plist file to, inorder to make this availavable on another machine.
Thanks./Library/Application Support/Directory Access
Just make sure you save the template first, and it will be in that folder. -
How to escape special characters in Simple Transformation
Hi Experts,
I have got a problem to get a well formed xml document from the below simple transformation. The content of maktx contains
special characters like & <, which are not allowed in a well formed XML-Document. But the result of the Simple Transformation
contains this charcters even after the transformation as you can the in the result below. Has anyone a hint how to escape the
characters included in the maktx.
The transformation for maktx, should be something like
Before: Material & < TEST
After: Material & < TEST
Report wihich calls the simple transformation
types:
BEGIN OF t_mat,
matnr type matnr,
maktx type maktx,
end of t_mat.
Data:
mat type t_mat,
xml_stream type xstring.
START-OF-SELECTION.
mat-matnr = '4711'.
mat-maktx = 'Material & < Test'.
CALL TRANSFORMATION ztest_st2
SOURCE mat = mat
RESULT XML xml_stream.
CALL FUNCTION 'DISPLAY_XML_STRING'
EXPORTING xml_string = xml_stream.
Simple Transformation
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="MAT"/>
<tt:template>
<Leistungsschild>
<CHARACT> MATNR </CHARACT>
<CHARACT_DESCR> Materialnummer </CHARACT_DESCR>
<VALUE tt:value-ref="MAT.MATNR"/>
<CHARACT> MAKTX </CHARACT>
<CHARACT_DESCR> Materialkurztext </CHARACT_DESCR>
<VALUE tt:value-ref="MAT.MAKTX" />
</Leistungsschild>
</tt:template>
</tt:transform>
RESULT
<?xml version="1.0" encoding="utf-8" ?>
<Leistungsschild>
<CHARACT>MATNR</CHARACT>
<CHARACT_DESCR>Materialnummer</CHARACT_DESCR>
<VALUE>4711</VALUE>
<CHARACT>MAKTX</CHARACT>
<CHARACT_DESCR>Materialkurztext</CHARACT_DESCR>
<VALUE>Material & < Test</VALUE> </Leistungsschild>Hi Sandra,
First of all thaks for your quick answer to my problem.
I see what you mean and get the same result, if I am using data-type string instead of xstring. But the recommendation in the XML-Books of SAP is to use XSTRING to save memory and circumflex problems between Codepages, when writing the XML-Stream to a filesystem.
As you can see in the code abvoe I am using a SAP-FM to display the XML-Stream and this FM works only with XSTRING´s,
that is one reason why I don´t understand that it displays it in the wrong way.
Even the Debugger shows me for the XSTRING the wrong result. Does all that mean that the escaping will not be applyed if you are working with XSTING´s?? -
Simple Transformation ST, upload xml file to internal table
Hi.
I want to upload some parts of an xml file into an sap internal table, especially the part "trackingnumber" which can occur several times.
the xml looks like this:
<?xml version="1.0" encoding="windows-1252"?>
<OpenShipments xmlns="x-schema:OpenShipments.xdr">
<OpenShipment ProcessStatus="Processed">
<ShipTo>
</ShipTo>
<ShipFrom>
</ShipFrom>
<ShipmentInformation>
</ShipmentInformation>
<Package>
</Package>
<InternationalDocumentation>
</InternationalDocumentation>
<Goods>
</Goods>
<ProcessMessage>
<TrackingNumbers>
<TrackingNumber>1Z1234563330702444</TrackingNumber>
<TrackingNumber>1Z1234566644402555</TrackingNumber>
</TrackingNumbers>
</ProcessMessage>
</OpenShipment>
</OpenShipments>
The ST looks like this:
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ROOT"/>
<tt:template>
<OpenShipments xmlns="x-schema:OpenShipments.xdr">
<OpenShipment>
<ShipTo>
<tt:skip/>
</ShipTo>
<ShipFrom>
<tt:skip/>
</ShipFrom>
<ShipmentInformation>
<tt:skip/>
</ShipmentInformation>
<tt:group>
<tt:cond frq="*">
<Package>
<tt:skip/>
</Package>
</tt:cond>
</tt:group>
<InternationalDocumentation>
<tt:skip/>
</InternationalDocumentation>
<tt:group>
<tt:cond frq="*">
<Goods>
<tt:skip/>
</Goods>
</tt:cond>
</tt:group>
<ProcessMessage>
<ShipmentRates>
<tt:skip/>
</ShipmentRates>
<TrackingNumbers>
<tt:group>
<tt:cond frq="*">
<TrackingNumber>
<tt:loop ref="ROOT">
<tt:value ref="ROOT" />
</tt:loop>
</TrackingNumber>
</tt:cond>
</tt:group>
</TrackingNumbers>
<ImportID>
<tt:skip/>
</ImportID>
<Reference1>
<tt:skip/>
</Reference1>
<Reference2>
<tt:skip/>
</Reference2>
</ProcessMessage>
</OpenShipment>
</OpenShipments>
</tt:template>
</tt:transform>
The ABAP Code looks like this:
REPORT z_xml_to_abap_test.
TYPES: t_xmllin_src(4096) TYPE x,
t_xmltab_src TYPE STANDARD TABLE OF t_xmllin_src.
DATA: xmlstr_src TYPE xstring,
xmltab_src TYPE t_xmltab_src,
result1(254) TYPE c,
BEGIN OF ROOT,
TrackingNumber(254) type c,
END OF ROOT.
FIELD-SYMBOLS: <xmlline> LIKE LINE OF xmltab_src.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'e:\20100601_132212.Out'
filetype = 'BIN'
has_field_separator = ''
header_length = 0
read_by_line = 'X'
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = xmltab_src
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
LOOP AT xmltab_src ASSIGNING <xmlline>.
CONCATENATE xmlstr_src <xmlline> INTO xmlstr_src IN BYTE MODE.
ENDLOOP.
CALL TRANSFORMATION z_ups_xml_upload
SOURCE XML xmlstr_src
RESULT ROOT = ROOT.
When i run the program i got the following error message:
"The goal was to access variable "ROOT". However, this access was not possible.
Anybody has an idea, why this happens, this is my first ST and have no clue at the moment why this happens?Hi.
I want to upload some parts of an xml file into an sap internal table, especially the part "trackingnumber" which can occur several times.
the xml looks like this:
<?xml version="1.0" encoding="windows-1252"?>
<OpenShipments xmlns="x-schema:OpenShipments.xdr">
<OpenShipment ProcessStatus="Processed">
<ShipTo>
</ShipTo>
<ShipFrom>
</ShipFrom>
<ShipmentInformation>
</ShipmentInformation>
<Package>
</Package>
<InternationalDocumentation>
</InternationalDocumentation>
<Goods>
</Goods>
<ProcessMessage>
<TrackingNumbers>
<TrackingNumber>1Z1234563330702444</TrackingNumber>
<TrackingNumber>1Z1234566644402555</TrackingNumber>
</TrackingNumbers>
</ProcessMessage>
</OpenShipment>
</OpenShipments>
The ST looks like this:
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ROOT"/>
<tt:template>
<OpenShipments xmlns="x-schema:OpenShipments.xdr">
<OpenShipment>
<ShipTo>
<tt:skip/>
</ShipTo>
<ShipFrom>
<tt:skip/>
</ShipFrom>
<ShipmentInformation>
<tt:skip/>
</ShipmentInformation>
<tt:group>
<tt:cond frq="*">
<Package>
<tt:skip/>
</Package>
</tt:cond>
</tt:group>
<InternationalDocumentation>
<tt:skip/>
</InternationalDocumentation>
<tt:group>
<tt:cond frq="*">
<Goods>
<tt:skip/>
</Goods>
</tt:cond>
</tt:group>
<ProcessMessage>
<ShipmentRates>
<tt:skip/>
</ShipmentRates>
<TrackingNumbers>
<tt:group>
<tt:cond frq="*">
<TrackingNumber>
<tt:loop ref="ROOT">
<tt:value ref="ROOT" />
</tt:loop>
</TrackingNumber>
</tt:cond>
</tt:group>
</TrackingNumbers>
<ImportID>
<tt:skip/>
</ImportID>
<Reference1>
<tt:skip/>
</Reference1>
<Reference2>
<tt:skip/>
</Reference2>
</ProcessMessage>
</OpenShipment>
</OpenShipments>
</tt:template>
</tt:transform>
The ABAP Code looks like this:
REPORT z_xml_to_abap_test.
TYPES: t_xmllin_src(4096) TYPE x,
t_xmltab_src TYPE STANDARD TABLE OF t_xmllin_src.
DATA: xmlstr_src TYPE xstring,
xmltab_src TYPE t_xmltab_src,
result1(254) TYPE c,
BEGIN OF ROOT,
TrackingNumber(254) type c,
END OF ROOT.
FIELD-SYMBOLS: <xmlline> LIKE LINE OF xmltab_src.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'e:\20100601_132212.Out'
filetype = 'BIN'
has_field_separator = ''
header_length = 0
read_by_line = 'X'
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = xmltab_src
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
LOOP AT xmltab_src ASSIGNING <xmlline>.
CONCATENATE xmlstr_src <xmlline> INTO xmlstr_src IN BYTE MODE.
ENDLOOP.
CALL TRANSFORMATION z_ups_xml_upload
SOURCE XML xmlstr_src
RESULT ROOT = ROOT.
When i run the program i got the following error message:
"The goal was to access variable "ROOT". However, this access was not possible.
Anybody has an idea, why this happens, this is my first ST and have no clue at the moment why this happens?
Maybe you are looking for
-
Image not showing in XML Publisher [works on windows, not unix]
I have an xml publisher RTF template that references an image from a URL passed in from the xml data file. The report definition references the image as follows: <fo:external-graphic> <xsl:attribute name="src"> <xsl:value-of select="//fld_FILE_PATH_N
-
Hi All I have a scenario where, XI has to read a file and process it. File format is like this: One Header Record with 3 fields Multiple data records with around 20 fields One footer record with 3 fields Now, while reading data from the file, how wil
-
Speed Up Photoshop (and Everything) With SSD
'Tis the season to spend money. FYI, today on Amazon.com you can get a ridiculously fast 256GB OCZ Vertex 4 SSD drive for only $159.99, which is an unprecedented low price for a drive of this capacity. http://www.amazon.com/OCZ-Technology-2-5-Inch-In
-
I m doing ABAP traninig nd need to install full SAP ABAP on my pc. Can any non-BASIS like me, install full SAP Abap. if not then what r the minimum technical requirments I need to know. plz can someone provide me the step to install full SAP ABAP. t
-
SOA Suite 11g - Connection Pools constantly getting suspended...
Hi, I have composites, bpel processes using database adapters. *I keep getting "+Pool mds-owsm is Suspended, cannot allocate resources to applications+" and " Pool SOALocalTxDataSource is Suspended, cannot allocate resources to applications.." in so