Call Transformation Problem
Hi All,
Our SAP system is recently upgraded to ECC 6.0 from 4.7. I am getting a runtime error while executing a program. I debugged the code and came to know that the runtime error is because of the following statement.
CALL TRANSFORMATION (`Z_XSLT_QUERY_RESULT`)
SOURCE XML w_xml_out
RESULT outtab = <outtab>.
Please see below for more info on the runtime error.
Runtime Errors TRANSFORMATION_NOT_FOUND
Except. CX_INVALID_TRANSFORMATION
Date and Time 07/17/2007 10:32:11
Short text
No load could be found for transformation "Z_XSLT_QUERY_RESULT".
What happened?
A load was searched for transformation "Z_XSLT_QUERY_RESULT". This action
failed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_INVALID_TRANSFORMATION', was not
caught in
procedure "PROCESS_FM" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
A load was searched for transformation "Z_XSLT_QUERY_RESULT". This action was
unsuccessful
. Either the transformation does not exist or it contains syntax errors.
I checked executing the same program in 4.7 and it works fine.
Any info on this is appreciated.
Thanks,
Naga
Hi,
If the transformation is named Z_XSLT_QUERY_RESULT, the call transformation must be called as CALL TRANSFORMATION Z_XSLT_QUERY_RESULT (No parentheses or quotes are needed). If it is a dynamic transformation call, the it must be called as CALL TRANSFORMATION (Z_XSLT_QUERY_RESULT) (No quotes). You can use one of these contructions according to the type of the transformation call.
Regards,
Sükrü
Similar Messages
-
Problem with CALL TRANSFORMATION xml - abap
Hello!
I got the following problems using call transformation to read a xml-file to local abap datatype!
Simple xml file for testing:
<BMECAT>
<HEADER>
asdf
</HEADER>
</BMECAT>
XSLT file:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:template match="/">
<xsl:value-of select="./BMECAT/HEADER"/>
</xsl:template>
</xsl:transform>
The xslt transformation works with xslt-tester!
My Source:
DATA: xmlupl TYPE string,
outputx TYPE XSTRING,
lv_string TYPE string.
* in xmlupl my xml import is stored
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = xmlupl " variable type string
IMPORTING
buffer = outputx. " variable type xstring
TRY .
CALL TRANSFORMATION path_to_xslt_file
SOURCE XML outputx
RESULT HEADER = lv_string.
CATCH cx_xslt_exception INTO xslt_error.
data: xslt_message type string .
xslt_message = xslt_error->get_text( ).
ENDTRY.
After debugging in xslt_message is stored the following text:
"The element abap was expected for the XML-ABAP transformation"
Can anyone help me with this problem?
Regards,
Danielhi
good
try this code
Just look at this piece of code, I think it should help you.
DATA : ITAB TYPE TABLE OF SPFLI,
L_XML TYPE REF TO CL_XML_DOCUMENT.
SELECT * FROM SPFLI INTO TABLE ITAB.
CREATE THE XML OBJECT
CREATE OBJECT L_XML.
CONVERT THE DATA TO XML
CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB[] ).
DATA IS CONVERTED TO XML; DISPLAY THE XML-DOCUMENT
CALL METHOD L_XML->DISPLAY.
thanks
mrutyun^ -
Problems with creating XML file via Call Transformation
Hi,
When creating a XML file via Call transformation an extra character '#'is placed at the beginning of the file.
This problems occurs since the upgrade to ECC6.0 and the Unicode conversion.
When opening the XML file the following error message appears:
Invalid at the top level of the document. Error processing resource 'file ....
Has anybody an idea why this extra character is placed at the beginning of the file. Has it something to do with the unicode conversion and how can we solve the problem?
thanks for your help
kind regards,
Maarten van IJzendoornHello Marteen,
Can you please share the solution to this issue and let me know.
Our Issue:
1) We are executing a report which generates an XML file on FTP.
2) The FTP file is always in Error when executed thorugh JAPANESE login but not thorugh EN login.
3) The XML files generated have always an extra character in the end ( which can be space,#,$%^&, etc.) when this extra character is removed from XML file with opening it in NOTEPAD then XML works OK in JA login as well.
4) In the PROGRAM everything has been checked with respect to OPEN dataset statement , XML ports UNICODE etc.
5) THIS issue has been reported only after upgrading to ECC 6.0 from 4.6C.( in older version it works fine).
Various OPEN dataset statments are :
OPEN DATASET path_fil
FOR OUTPUT
Thanks to reply. -
Problem with "CALL Transformation" in ABAP
Hello All,
I am creating XML from ABAP program and using CALL TRANSFORMATION. Everything works fine but when my XML is created sometimes in some "element" values it is truncating space between the texts. For example, I have a field "description" with value "Bon Apetite" it changes to "BonApetite" (space truncated) after transformation! I did research everywhere but could not find why this would happen! Please give me any feedback if you have any information.
Thanks.
MithunHello Mithun,
when you use the call transformation statement you have to specifiy the xslt transformation used. As a first step you usually use the transformation with the name ID. This is a special transformation for making the asXML representation of abap data. Unfortunately if you look into this transformation you find the following:
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:transform>
If I remember correctly when you use another transformation this will first call the ID transformation and after this the specified one. So it should not be possible to just copy ID transformation and remove the line. I'll have to think again how to avoid the behaviour.
Best Regards
Roman -
Problem in Call transformation - xslt program
Hi Experts,
For the below XML file i have declared the XSLT Program as described.
i am not able to get the data into Internal table.
Could you pls help me in where am i going wrong?
Is it XSLT declaration or what?
Data declarations
TYPES: BEGIN OF TY_BH,
RECORDTYPE(02), " Record Type
DOCTYPE(02), " Document type
REFERENCE(16), " Reference Document Number
DOCUMENTDATE(08), " Document Date in Document
POSTINGDATE(08), " Posting Date in the Document
COMPANYCODE(04), " Company Code
CURRENCY(03), " Currency Key
EXCHANGERATE(08), " Exchange rate
PARK(01), " Park document
ITEMNUMBER(03), " Number of line item
END OF TY_BH,
BEGIN OF TY_HH,
RECORDTYPE(02), " Record Type
SOURCE(04),
DESTINATION(04),
TIMESTAMP(14),
END OF TY_HH,
BEGIN OF TY_TT,
RECORDTYPE(02),
TOTALRECORDS(10) TYPE N,
TOTALVALUE(16),
END OF TY_TT.
TYPES: BEGIN OF TY_BL,
RECORDTYPE(02),
REFERENCE(16),
REFLINEITEM(03),
ACCTTYPE(01),
DRCRINDICATOR(01),
ACCOUNT(10),
AMOUNT(13),
VENDORNAME1(40),
VENDORNAME2(40),
VENDORNAME3(40),
VENDORNAME4(40),
STREET(40),
CITY(40),
POSTALCODE(10),
COUNTRY(02),
CONTACTPERSON(10),
ALTERNATEPAYEECODE(10),
ALTERNATEPAYEENAME1(40),
ALTERNATEPAYEENAME2(40),
ALTERNATEPAYEENAME3(40),
PAYMENTTERMS(04),
BASELINEDATE(08),
PAYMENTMETHODS(01),
ALLOCATION(18),
LINEITEMTEXT(50),
TAXCODE(02),
TAXAMOUNT(13),
WHTAXCODE(02),
WHTAXBASE(13),
FUND(10),
FUNDCENTER(16),
COSTCENTER(10),
INTERNALORDER(12),
TAXAUTOMATICALLY(01),
SPECIALGLINDICATOR(01),
END OF TY_BL.
DATA: GT_BH TYPE STANDARD TABLE OF TY_BH,
GS_BH TYPE TY_BH,
GT_BL TYPE STANDARD TABLE OF TY_BL,
GS_BL TYPE TY_BL,
GT_HH TYPE STANDARD TABLE OF TY_HH,
GS_HH TYPE TY_HH,
GT_TT TYPE STANDARD TABLE OF TY_TT,
GS_TT TYPE TY_TT.
DATA: GT_RESULT_XML5 TYPE ABAP_TRANS_RESBIND_TAB,
GS_RESULT_XML5 TYPE ABAP_TRANS_RESBIND.
DATA: GS_RIF_EX TYPE REF TO CX_ROOT,
GS_VAR_TEXT TYPE STRING.
DATA: BEGIN OF GT_XML,
HH TYPE TY_HH,
BH LIKE TABLE OF GT_BH,
BL LIKE TABLE OF GT_BL,
TT TYPE TY_TT,
END OF GT_XML.
DATA: GT_ITAB TYPE STANDARD TABLE OF CHAR2048,
GS_ITAB TYPE CHAR2048.
I have the below file read into internal table GT_ITAB.
XML File
<?xml version="1.0" encoding="utf-8"?>
<ABCInbound xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\XYZSchema\ABCInbound.xsd">
<HH>
<RecordType>HH</RecordType>
<Source>ABC</Source>
<Destination>XYZ</Destination>
<TimeStamp>20050909220546</TimeStamp>
</HH>
<BH>
<RecordType>BH</RecordType>
<DocType>AB</DocType>
<Reference>2205516125</Reference>
<DocumentDate>20080909</DocumentDate>
<PostingDate></PostingDate>
<CompanyCode>ABC</CompanyCode>
<Currency>INR</Currency>
<ExchangeRate>1.0000</ExchangeRate>
<Park></Park>
<ItemNumber>2</ItemNumber>
</BH>
<BL>
<RecordType>BL</RecordType>
<Reference>2205516125</Reference>
<RefLineItem>1</RefLineItem>
<AcctType>K</AcctType>
<DrCrIndicator>H</DrCrIndicator>
<Account>01000003</Account>
<Amount>364.00</Amount>
<VendorName-1>TOM & JERRY IS MY</VendorName-1>
<VendorName-2> NAME TO BE PAID</VendorName-2>
<VendorName-3>1987566Z</VendorName-3>
<VendorName-4>22</VendorName-4>
<Street>UCX STREET</Street>
<City>ROAD 4</City>
<PostalCode>515004</PostalCode>
<Country>IND</Country>
<ContactPerson></ContactPerson>
<AlternatePayeeCode></AlternatePayeeCode>
<AlternatePayeeName-1></AlternatePayeeName-1>
<AlternatePayeeName-2></AlternatePayeeName-2>
<AlternatePayeeName-3></AlternatePayeeName-3>
<PaymentTerms></PaymentTerms>
<BaselineDate></BaselineDate>
<PaymentMethods></PaymentMethods>
<Allocation></Allocation>
<LineItemText>item text</LineItemText>
<TaxCode></TaxCode>
<TaxAmount>0.00</TaxAmount>
<WHTaxCode></WHTaxCode>
<WHTaxbase>0.00</WHTaxbase>
<Fund></Fund>
<FundCenter></FundCenter>
<CostCenter></CostCenter>
<InternalOrder></InternalOrder>
<TaxAutomatically></TaxAutomatically>
<SpecialGLIndicator></SpecialGLIndicator>
</BL>
<TT>
<RecordType>TT</RecordType>
<TotalRecords>1</TotalRecords>
<TotalValue>222</TotalValue>
</TT>
</ABCInbound>
Call transformation as below
GET REFERENCE OF GT_XML INTO GS_RESULT_XML5-VALUE.
GS_RESULT_XML5-NAME = 'IABC'.
APPEND GS_RESULT_XML5 TO GT_RESULT_XML5.
TRY.
CALL TRANSFORMATION Z_XML_TO_ABAP5
SOURCE XML GT_ITAB
RESULT (GT_RESULT_XML5).
CATCH CX_ROOT INTO GS_RIF_EX.
GS_VAR_TEXT = GS_RIF_EX->GET_TEXT( ).
MESSAGE GS_VAR_TEXT TYPE 'E'.
ENDTRY.
WHEN I CHECK GT_XML its initial.
XSLT Program Z_XML_TO_ABAP5 is like below.
Pls let me know if my xslt declaration is wrong.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<IABC>
<xsl:apply-templates select="//ABCInbound"/>
</IABC>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="ABCINBOUND">
<item>
<RECORDTYPE>
<xsl:value-of select="RecordType"/>
</RECORDTYPE>
<SOURCE>
<xsl:value-of select="Source"/>
</SOURCE>
<DESTINATION>
<xsl:value-of select="Destination"/>
</DESTINATION>
<TIMESTAMP>
<xsl:value-of select="TimeStamp"/>
</TIMESTAMP>
<RECORDTYPE>
<xsl:value-of select="RecordType"/>
</RECORDTYPE>
<DOCTYPE>
<xsl:value-of select="DocType"/>
</DOCTYPE>
<REFERENCE>
<xsl:value-of select="Reference"/>
</REFERENCE>
<DOCUMENTDATE>
<xsl:value-of select="DocumentDate"/>
</DOCUMENTDATE>
<POSTINGDATE>
<xsl:value-of select="PostingDate"/>
</POSTINGDATE>
<COMPANYCODE>
<xsl:value-of select="CompanyCode"/>
</COMPANYCODE>
<CURRENCY>
<xsl:value-of select="Currency"/>
</CURRENCY>
<EXCHANGERATE>
<xsl:value-of select="ExchangeRate"/>
</EXCHANGERATE>
<PARK>
<xsl:value-of select="Park"/>
</PARK>
<ITEMNUMBER>
<xsl:value-of select="ItemNumber"/>
</ITEMNUMBER>
<RECORDTYPE>
<xsl:value-of select="RecordType"/>
</RECORDTYPE>
<REFERENCE>
<xsl:value-of select="Reference"/>
</REFERENCE>
<REFLINEITEM>
<xsl:value-of select="RefLineItem"/>
</REFLINEITEM>
<ACCTTYPE>
<xsl:value-of select="AcctType"/>
</ACCTTYPE>
<DRCRINDICATOR>
<xsl:value-of select="DrCrIndicator"/>
</DRCRINDICATOR>
<ACCOUNT>
<xsl:value-of select="Account"/>
</ACCOUNT>
<AMOUNT>
<xsl:value-of select="Amount"/>
</AMOUNT>
<VENDORNAME1>
<xsl:value-of select="VendorName-1"/>
</VENDORNAME1>
<VENDORNAME2>
<xsl:value-of select="VendorName-2"/>
</VENDORNAME2>
<VENDORNAME3>
<xsl:value-of select="VendorName-3"/>
</VENDORNAME3>
<VENDORNAME4>
<xsl:value-of select="VendorName-4"/>
</VENDORNAME4>
<STREET>
<xsl:value-of select="Street"/>
</STREET>
<CITY>
<xsl:value-of select="City"/>
</CITY>
<POSTALCODE>
<xsl:value-of select="PostalCode"/>
</POSTALCODE>
<COUNTRY>
<xsl:value-of select="Country"/>
</COUNTRY>
<CONTACTPERSON>
<xsl:value-of select="ContactPerson"/>
</CONTACTPERSON>
<ALTERNATEPAYEECODE>
<xsl:value-of select="AlternatePayeeCode"/>
</ALTERNATEPAYEECODE>
<ALTERNATEPAYEENAME1>
<xsl:value-of select="AlternatePayeeName1"/>
</ALTERNATEPAYEENAME1>
<ALTERNATEPAYEENAME2>
<xsl:value-of select="AlternatePayeeName2"/>
</ALTERNATEPAYEENAME2>
<ALTERNATEPAYEENAME3>
<xsl:value-of select="AlternatePayeeName3"/>
</ALTERNATEPAYEENAME3>
<PAYMENTTERMS>
<xsl:value-of select="PaymentTerms"/>
</PAYMENTTERMS>
<BASELINEDATE>
<xsl:value-of select="BaselineDate"/>
</BASELINEDATE>
<PAYMENTMETHODS>
<xsl:value-of select="PaymentMethods"/>
</PAYMENTMETHODS>
<ALLOCATION>
<xsl:value-of select="Allocation"/>
</ALLOCATION>
<LINEITEMTEXT>
<xsl:value-of select="LineItemText"/>
</LINEITEMTEXT>
<TAXCODE>
<xsl:value-of select="TaxCode"/>
</TAXCODE>
<TAXAMOUNT>
<xsl:value-of select="TaxAmount"/>
</TAXAMOUNT>
<WHTAXCODE>
<xsl:value-of select="WHTaxCode"/>
</WHTAXCODE>
<WHTAXBASE>
<xsl:value-of select="WHTaxbase"/>
</WHTAXBASE>
<FUND>
<xsl:value-of select="Fund"/>
</FUND>
<FUNDCENTER>
<xsl:value-of select="FundCenter"/>
</FUNDCENTER>
<COSTCENTER>
<xsl:value-of select="CostCenter"/>
</COSTCENTER>
<INTERNALORDER>
<xsl:value-of select="InternalOrder"/>
</INTERNALORDER>
<TAXAUTOMATICALLY>
<xsl:value-of select="TaxAutomatically"/>
</TAXAUTOMATICALLY>
<SPECIALGLINDICATOR>
<xsl:value-of select="SpecialGLIndicator"/>
</SPECIALGLINDICATOR>
<RECORDTYPE>
<xsl:value-of select="RecordType"/>
</RECORDTYPE>
<TOTALRECORDS>
<xsl:value-of select="TotalRecords"/>
</TOTALRECORDS>
<TOTALVALUE>
<xsl:value-of select="TotalValue"/>
</TOTALVALUE>
</item>
</xsl:template>
</xsl:transform>
I able to get if declare only for BL and BH in separate xslt transformations.
Regards,
SimhaHello Mithun,
when you use the call transformation statement you have to specifiy the xslt transformation used. As a first step you usually use the transformation with the name ID. This is a special transformation for making the asXML representation of abap data. Unfortunately if you look into this transformation you find the following:
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:transform>
If I remember correctly when you use another transformation this will first call the ID transformation and after this the specified one. So it should not be possible to just copy ID transformation and remove the line. I'll have to think again how to avoid the behaviour.
Best Regards
Roman -
Problem with Call Transformation (ABAP to XML)
Hello
I call the tranformation function to serialize. I want to convert a ABAP internal table into XML.One of the column type is of time(t). On transformation, the values are changed.
Ex : If I have a value of 000009 (time format), on calling transformation it gets converted to 00:00:09. I dont want this conversion. I want to have the value as it is. I cant change the column data type from time to string.
Regards
Raghavendrahi
good
try this code
Just look at this piece of code, I think it should help you.
DATA : ITAB TYPE TABLE OF SPFLI,
L_XML TYPE REF TO CL_XML_DOCUMENT.
SELECT * FROM SPFLI INTO TABLE ITAB.
CREATE THE XML OBJECT
CREATE OBJECT L_XML.
CONVERT THE DATA TO XML
CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB[] ).
DATA IS CONVERTED TO XML; DISPLAY THE XML-DOCUMENT
CALL METHOD L_XML->DISPLAY.
thanks
mrutyun^ -
Problem XML .. Call Transformation
Hi Guru´s,
Please, I need a help!!! ...
I´m creating an XML and my Excel will open it...and I use Call transformation.
Ok, it´s works perfect.... but I had to include a validating data in particular column(ranges data) and I can´t do it...
I try data validation:
But don´t work fine. I suspect that data validation not working very well in call transformation...
Somebody Can help me???
Thanks...
Alexandrehi
good
try this code
Just look at this piece of code, I think it should help you.
DATA : ITAB TYPE TABLE OF SPFLI,
L_XML TYPE REF TO CL_XML_DOCUMENT.
SELECT * FROM SPFLI INTO TABLE ITAB.
CREATE THE XML OBJECT
CREATE OBJECT L_XML.
CONVERT THE DATA TO XML
CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB[] ).
DATA IS CONVERTED TO XML; DISPLAY THE XML-DOCUMENT
CALL METHOD L_XML->DISPLAY.
thanks
mrutyun^ -
Como salvar o resultado de um call transformation em um diretorio local?
Tudo bem pessoal,
Estou em um desenvolvimento onde tenho que salvar o resultado de um CALL TRANSFORMATION e ter como resultado um XML posteriormente salva-lo em um diretorio local, do SAP para desktop, estou tendo o resultado correto e consigo ver atraves de uma função chamada 'SWF_XML_DISPLAY' passando o resutlato com a variavel do tipo XSTRING.
No momento de usar o gui_download recebo uma exceção por objeto não pode ser convertido, já tentei fazer a conversão para binario e neste scenario consigo salvar mas o resultado não segue o padrão xml com as tag definidas e eu gostaria de salvar no padrão do XML.
Alguém poderia me ajudar nesse problema?
Desde já agradeço a atenção de todos.
Grazziani BatistaNunca usei CALL TRANSFORMATION, mas dê uma olhada nisso:
http://sapblog.rmtiwari.com/2009/04/generate-simple-transformation-for-xml.html
Outra coisa... evite postar em português, geralmente só respondem em inglês.
Boa sorte -
Creating XML file Using Call Transformation
Hello Friends,
I have searched before posting thread, couldnt find anything.
I am creating an XML file using Call Transformation. My internal table has 3 date fields and some other fields. For some records I dont have values for the date fields. In that case my XML file is giving the date value as 0000-00-00 since I declared it as Date type. This value 0000-00-00 is not accepted by the middle ware as the valid date. I can not change it as String type as per the suggestion.
In that case I am advised to skip printing the date field tag if it doesnt have value.
Is there any way to skip the date field if it is empty. Any Suggestions please ?.
Thanks
Lakshmi.Hi,
I had exactly the same problem before. When you call a transformation there is an option called initial_components. According to SAP if you use initial_components = 'SUPRESS' the empty fields should not being generated on the XML.
Now, this didn't work for me and I have seen some people with the same problem. Here is how I solved this (maybe not the best way but it worked):
First: My fields are all CHAR in my table
Second: In the transformation, you can use conditional transformation to not display a tag if field is empty, here a piece of my transformation (I am using simple transformations):
<tt:root name="ROOT"/>
<tt:cond s-check="not-initial(ref('ROOT.L1_NM')) or not-initial(ref('ROOT.L2_NM'))">
<TRNMTR_NM>
<tt:cond s-check="not-initial(ref('ROOT.L1_NM'))">
<l1_nm>
<tt:value ref="ROOT.L1_NM"/>
</l1_nm>
</tt:cond>
<tt:cond s-check="not-initial(ref('ROOT.L2_NM'))">
<l2_nm>
<tt:value ref="ROOT.L2_NM"/>
</l2_nm>
</tt:cond>
</TRNMTR_NM>
</tt:cond>
As you can see, I first check if the fields have values.
Hope it helps
Edited by: carlosrv on Oct 4, 2011 8:22 PM -
XML to ABAP internal table with CALL TRANSFORMATION
I can't create a transformation that allow passing next XML file to an internal table:
Please, I need someone could help me, because I don t have XML knowledge
<< Moderator message - Everyone's problem is important. But the answers in the forum are provided by volunteers. Please do not ask for help quickly. >>
Kind regards,
Edited by: Rob Burbank on Jul 21, 2011 4:02 PMHi Gastón Juarez,
sorry, didn't see your post, you should have linked the previous to this one
If we create a ZZZ transformation of type ST, it would be something like this (I didn't test). Note that I concatenated the date and time, because field operations in ST are not possible (we should use XSLT instead, but it's counter performant):
... (here the usual header)
<tt:root name="ABAP_X"/>
<tt:template>
<corailExport xmlns= " http://www.abc.com/corailExport_Transcou201D
xmlns: xsi= " http://www.w3.org/2001/XMLSchema-instanceu201D
xsi: schemaLocation= " http://www.abc.com/corailExport_Transco corailExport_Transco.xsd u201C>
<exportDate><tt:skip></tt:skip></exportDate>
<tt:loop ref=".ABAP_X" name="line">
<transcodification>
<tt:attribute name="applyingDate" value-ref="$line.APPLYING_DATE"></tt:attribute>
<previousCofor><tt:value ref="$line.OLD_COFOR"></tt:value></previousCofor>
<newCofor><tt:value ref="$line.NEW_COFOR"></tt:value></newCofor>
</transcodification>
</tt:loop>
</corailExport>
</tt:template>
The program:
TYPES : BEGIN OF ty_x,
applying_date TYPE string,
old_cofor TYPE lifnr,
new_cofor TYPE lifnr,
END OF ty_x.
DATA l_xml TYPE string.
DATA lt_x TYPE TABLE OF ty_x.
l_xml = 'your xml'.
CALL TRANSFORMATION zzz
SOURCE XML l_xml
RESULT abap_x = lt_x.
BR
Sandra -
Hi,
hope anybody can help.
I try to transform a object to another object via XSLT transformation.
Here is my coding :
DATA: wa_transformation TYPE y0dpl_structures.
DATA: obj_import TYPE abap_trans_srcbind_tab,
wa_import TYPE abap_trans_srcbind.
DATA: obj_export TYPE abap_trans_resbind_tab,
wa_export TYPE abap_trans_resbind.
DATA: obj_data TYPE REF TO data.
* Get transformation data
SELECT SINGLE *
INTO wa_transformation
FROM y0dpl_structures
WHERE filetype = i_file_type.
* Create table with internal structure
CREATE DATA e_data TYPE (wa_transformation-structure_name).
wa_import-name = 'IMPORT'.
GET REFERENCE OF i_data INTO wa_import-value.
APPEND wa_import TO obj_import.
* Call transformation
CALL TRANSFORMATION (wa_transformation-transformation)
SOURCE (obj_import)
RESULT (obj_export).
i_data is a import parameter from type "ref to data".
My problem is, that "Call transformation" makes a shortdump when calling them.
Regards,
AntonFound a solution for my problem. Now it works!
DATA: wa_transformation TYPE y0dpl_structures.
DATA: obj_import TYPE abap_trans_srcbind_tab,
wa_import TYPE abap_trans_srcbind.
DATA: obj_data TYPE REF TO data.
DATA: wa_return TYPE bapiret2.
FIELD-SYMBOLS: <data> TYPE ANY TABLE.
* Get transformation data
SELECT SINGLE *
INTO wa_transformation
FROM y0dpl_structures
WHERE filetype = i_file_type.
IF sy-subrc IS INITIAL.
* Create table with internal structure
CREATE DATA e_data TYPE STANDARD TABLE OF (wa_transformation-structure_name).
ASSIGN i_data->* TO <data>.
wa_import-name = 'IMPORT'.
GET REFERENCE OF <data> INTO wa_import-value.
APPEND wa_import TO obj_import.
* Call transformation
CALL TRANSFORMATION (wa_transformation-transformation)
SOURCE (obj_import)
RESULT export_data = e_data.
ELSE.
MOVE: 'Y0_DPL' TO wa_return-id,
'E' TO wa_return-type,
'108' TO wa_return-number.
APPEND wa_return TO e_return.
CLEAR: wa_return.
ENDIF. -
ABAP-Mapping with CALL TRANSFORMATION
Hi everybody,
I got an ABAP mapping that uses CALL TRANSFORMATION:
TRY.
CALL TRANSFORMATION (strxsltid)
SOURCE XML IDOCXML_DOCUMENT
RESULT XML result.
CATCH cx_xslt_abap_call_error INTO lr_oref.
text = lr_oref->get_text( ).
ENDTRY.
The TRANSFORMATION returns result THAT GETS ALREADY serialized!
On base of the result I want to create an new output document:
* Create output document
DATA: li_odocument TYPE REF TO if_ixml_document.
li_odocument = NEW_DOCUMENT.
* Render document
DATA: li_ostream TYPE REF TO if_ixml_ostream.
li_ostream = li_streamfactory->create_ostream_xstring( result ).
* Create renderer
DATA: li_renderer TYPE REF TO if_ixml_renderer.
li_renderer = li_ixmlfactory->create_renderer( ostream = li_ostream
document = li_odocument ).
li_renderer->render( ).
--> The problem is, that already CALL TRANSFORMATION creates a output document. so at the end of the mapping I got a new document wich includes the result of CALL TRANSFORMATION and NEW_DOCUMENT in one document.
How can I suppress CALL TRANSFORMATION from writing the output-stream?
Thanks regards
Mario
Edited by: Mario Müller on Feb 24, 2010 2:27 AMno answers
-
CALL TRANSFORMATION on Unicode WebAS 6.20: No valid source context supplied
Hello,
in the last day's I was stuck into a strange problem. I had to develop a Web Service Client on our Web AS 6.20 Unicode system. I followed the Blog <a href="/people/durairaj.athavanraja/blog/2004/09/20/consuming-web-service-from-abap">Consuming Web Service from ABAP</a>. The problem was that my CALL TRANSFORMATION always throwed an exception "No valid source context supplied". I've tested the transformation with a local copy of the XML the Web Service returned and it works quite well. I had a look into the Documentaion of CALL TRANSFORMATION and it says:
== Documentation Quote Begin ==
Addition 3a
... SOURCE XML sxml
Effect
Specification of the transformation source
Transfer the XML document sxml using addition 3a. The following three possibilities exist for specifiying sxml:
The XML document can be in an ABAP variable sxml of the type STRING or XSTRING or in an internal standard table sxml of the elementary line type C.
== Documentation Quote End ==
So there should be no difference between STRING and XSTRING. But there is a difference! Here is my testcase which I've derived from my Blog <a href="/people/gregor.wolf3/blog/2006/06/27/geocode-business-partner-with-google-maps">Geocode Business Partner with Google Maps</a>:
<b>XSLT Transformation - ZGOOGLE_GEOCODE_TO_ABAP</b>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asx="http://www.sap.com/abapxml" xmlns:kml="http://earth.google.com/kml/2.0" version="1.0">
<xsl:template match="/">
<asx:abap version="1.0">
<asx:values>
<GEOCODE>
<LON>
<xsl:value-of select="substring-before(kml:kml/kml:Response/kml:Placemark/kml:Point/kml:coordinates,',')"/>
</LON>
<LAT>
<xsl:value-of select="substring-before(substring-after(kml:kml/kml:Response/kml:Placemark/kml:Point/kml:coordinates,','),',')"/>
</LAT>
<ALT>
<xsl:value-of select="substring-after(substring-after(kml:kml/kml:Response/kml:Placemark/kml:Point/kml:coordinates,','),',')"/>
</ALT>
</GEOCODE>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>
<b>ABAP Report</b>
REPORT z_gw_test_geocode.
DATA:
BEGIN OF geocode,
lon TYPE string,
lat TYPE string,
alt TYPE string,
END OF geocode.
DATA: client TYPE REF TO if_http_client,
url TYPE string,
c_xml TYPE string,
x_xml type xstring.
* Build URL to call Googe Maps Geocoding
CONCATENATE 'http://maps.google.com/maps/geo?'
'q=Tacherting,+DE'
'&output=xml'
'&key=ABQIAAAA2WL-mG7HpdSjlxystL3uBhRvBuAcdiWwcJAQgt9kNvfse-yNqBQuxwHkHo31WjTJ_RzVPIhXNludVg'
INTO url.
****Create the HTTP client
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = url
IMPORTING
client = client
EXCEPTIONS
OTHERS = 1.
client->send( ).
client->receive( ).
****Get the response content in Character format
c_xml = client->response->get_cdata( ).
****Get the response content as Binary
x_xml = client->response->get_data( ).
****Transform XML as String to ABAP Values
DATA: xslt_err TYPE REF TO cx_xslt_exception,
error_text TYPE string.
WRITE: / 'Transformation with STRING'.
TRY.
CALL TRANSFORMATION zgoogle_geocode_to_abap
SOURCE XML c_xml
RESULT geocode = geocode.
CATCH cx_xslt_exception INTO xslt_err.
error_text = xslt_err->get_text( ).
WRITE: / error_text.
ENDTRY.
WRITE: / 'LON: ', geocode-lon.
WRITE: / 'LAT: ', geocode-lat.
WRITE: / 'ALT: ', geocode-alt.
****Transform XML as XString to ABAP Values
WRITE: / 'Transformation with XSTRING'.
TRY.
CALL TRANSFORMATION zgoogle_geocode_to_abap
SOURCE XML x_xml
RESULT geocode = geocode.
CATCH cx_xslt_exception INTO xslt_err.
error_text = xslt_err->get_text( ).
WRITE: / error_text.
ENDTRY.
WRITE: / 'LON: ', geocode-lon.
WRITE: / 'LAT: ', geocode-lat.
WRITE: / 'ALT: ', geocode-alt.
<b>Result</b>
This is the result on our 6.20 Unicode System:
Transformation with STRING
No valid source context supplied
LON:
LAT:
ALT:
Transformation with XSTRING
LON: 12.570504
LAT: 48.078269
ALT: 0
I've tried it on our 6.20 and 6.40 NON-Unicode systems and the result was:
Transformation with STRING
LON: 12.570504
LAT: 48.078269
ALT: 0
Transformation with XSTRING
LON: 12.570504
LAT: 48.078269
ALT: 0
Finaly I've tried it on our Solutin Manager 4.0 which runs on Web AS 7.00 and is also a Unicode installation. Here the result is correct:
Transformation with STRING
LON: 12.570504
LAT: 48.078269
ALT: 0
Transformation with XSTRING
LON: 12.570504
LAT: 48.078269
ALT: 0
So now what to do? I've found nothing in OSS regarding this behaviour. Any tips? I also try a OSS Message.
Regards
GregorHi,
Can you tell me about your project on short notes. For information.
Regards
R.Rajendran -
Hi
Using <b>XSLT</b> and <b>Call transformation</b> (XSLT scheme) to convert XML file to html the problem is that line breaks in xml are ignored when passing the call tranformation.
<b>Note in xml look like:</b>
<com:Note><![CDATA[
Serie 87% 0,000000
Amount in this period 01-01-2006 - 01-07-2006 - 180 days
Currency 16.267.117,38 DKK
Loan DKK 14.332.700,00
Debt 7.358.534,23
Indexsfactor 226,230
]]></com:Note>
<b>When HTML displayed in sap, - note is just a long string which continue out of the screen. Note looks like:</b>Serie 87% 0,000000Amount in this period 01-01-2006 - 01-07-2006 - 180 daysCurrency 16.267.117,38 DKKDebt 7.358.534,23Indexsfactor 226,230
What to do ? Any ideas ?hi Jan,
Check out the link
http://www.topxml.com/code/default.asp?p=3&id=v20031025170911&ms=20&l=xsl&sw=categ
This link contains a file that contains an importable xslt stylesheet with two templates. The first is a text wrap template that breaks texts at carriage returns. You need to modify the xslt.
[code]<xsl:template name="text.wrap">
<xsl:param name="texttowrap"/>
<xsl:variable name="textlength" select="string-length($texttowrap)"/>
<!-- don't waste time if no text supplied or remaining from recursion-->
<xsl:if test="$textlength > 0">
<xsl:choose>
<xsl:when test="contains($texttowrap,$CR)">
<!-- get the text before the first instance of a carriage return character-->
<xsl:variable name="<span style="background-color:yellow;color:red;font-weight:bold;">line</span>beforefirst<span style="background-color:yellow;color:red;font-weight:bold;">break</span>" select="substring-before($texttowrap,$CR)"/>
.................[/code]
Hope this helps.
Regards,
Richa -
XSLT, Call transformation, Character Set
Hi
Using call transformation (XSLT scheme) to convert XML file to html the problem is that
When HTML displayed in sap, - name 'Søren Fjællegård' is displayed like 'S#ren Fj#lleg#rd'
What to do ? Any ideas to handle special character setsHi Jon,
What is the XSLT program that you're using to transform the XML?
Can you try modifying the XSLT stylesheet and add or modify the following attribute.
<xsl:output indent="yes"/>
Regards,
Erwin
Maybe you are looking for
-
OBA3 (Customer / Vendor Tolerance) and OBA4 (FI Tolerancde Group for User)
Hi Expert, With reference to the subject of this post, could anyone can highlight to me the actual difference between these 2 tolerance settings? I use OBA4 to set the payment different for cash discount and payment differences, and it works. Therefo
-
Hi All, We have couple of WD ABAP appraisals deployment on our ESS/MSS Portal. We are currently having an issue of title bar header being displayed in German which opens in seperate portal window. Pls Check this [attachment|http://wiki.sdn.sap.com/wi
-
How to query for tables referenced to a certain table by a FK?
Hello - I have a table called "SERVICE". i can't drop the table because it is referenced via a foreign key by other tables. What view(s) can I query to find the referenced tables? Thanks in advance!
-
Raise exception but not stop running procedure
My PL/SQL bloc is made of a while loop and an exception section. The exception would happend during one lap. I would like to handle the exception and then continue with the next lap. How can i prevent the procedure from just stopping after i raise an
-
Download Error (-48)
Since the latest iTunes update I have had some really strange happenings with my Apple TV. The most annoying problem is that I cannot download any content from the iTunes Store on my Apple TV. I receive a message saying that the content was not downl