Creating an XML From a Deep Structure using XSL Transformation
Hi ABAPers,
I have a requirement to use XSL Transformations on an ABAP deep type structure.
Currently i have an API that fills in this deep structure and by using CALL TRANSFORMATION ID.... i will get the BIG XML having having 100s of nodes . But actualy form the deep structure i need only some NODES (say 50)... So i tried writing an XSLT
in the transaction STRANS.. but on using this TRANSFORMATION which i wrote i am getting an error messgae like INVALID XML...
Am i going in right track or is there a good solution...
My sample transformation is as below...
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:value-of select="DATA/NODE_ELEMENTS/UUID_KEY/UUID"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/SEMANTICAL_NAME"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/STRUCT_CAT"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/USAGE_CAT"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/RESTRICTED_IND"/>
<xsl:value-of select="VALUES/DATA/NODE_ID"/>.
</xsl:template>
</xsl:transform>
Please help me in solving this issue....
Thanks,
Linda.
Hi Linda,
I am replying based on your sample code.
Try the below following suggestions.
here 'GRPHDR' is the node where I am selecting the data.
IGRPHDR is the name of the reference.
First calling the transformation in you program.
TYPES: BEGIN OF tl_hdr,
msgid(20) TYPE c,
END OF tl_hdr.
DATA : t_hdr TYPE STANDARD TABLE OF tl_hdr.
GET REFERENCE OF t_hdr INTO l_result_xml-value.
l_result_xml-name = 'IGRPHDR'.
APPEND l_result_xml TO t_result_xml.
TRY.
CALL TRANSFORMATION yfi_xml_read
SOURCE XML it_xml_data
RESULT (t_result_xml).
CATCH cx_root INTO l_rif_ex.
l_var_text = l_rif_ex->get_text( ).
l_bapiret-type = 'E'.
l_bapiret-message = l_var_text.
APPEND l_bapiret TO errormsgs.
EXIT.
ENDTRY.
in XSL transformation
First write a block of statement to specify from which node you are taking the data.
No matter it is a node or sub-node.
<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>
<IGRPHDR> " reference name of internal table
<xsl:apply-templates select="//GrpHdr"/>
</IGRPHDR>
</asx:values>
</asx:abap>
</xsl:template>
Next select the data from the nodes under the nodes specified in the transformation.
here msgid is the field i am selecting for value.
<xsl:template match="GrpHdr">
<item>
<MSGID> " field in the internal table t_hdr where data has to go
<xsl:value-of select="MsgId"/>
</MSGID>
</item>
</xsl:template>
reply back if further clarification is needed.
Thanks and regards,
Kannan N
Similar Messages
-
Creating dynamic internal table with deep structure
Hi all,
I need to create an internal table with deep structure dynamically. I've already created tables with method 'create_dynamic_table' but I'm struggling with the deep structure.
I would need an internal table with the following structure:
DATA: BEGIN OF lt_t1,
s1 TYPE REF TO data,
s2 TYPE REF TO data,
END OF lt_t1.
S1 and S2 have to be tables.
It might be possible with RTTS but all the examples in the forums (that I've found so far) are related to at least one DDIC-structure. And that's my problem because both tables are created during runtime.
Thank you in advance
NicolaHi Frédéric,
I hope my english is good enough to explain it correctly:
We use a function builder for SEM-BPS which copies data from one Cube to another. This Cube is transactional, so you can't easily read a structure out of DDIC.
The export parameter of this function builder is a table with type 'any table'.
Until today we used a fixed definition e.g.:
TYPES:
BEGIN OF xtyp_chas,
/sie/sr_ocomp TYPE /b52/oisr_ocomp,
/sie/ts_03psp TYPE /b52/oits_03psp,
0activity TYPE /bi0/oiactivity,
0acty_elemt TYPE /bi0/oiacty_elemt,
0costelmnt TYPE /bi0/oicostelmnt,
0co_area TYPE /bi0/oico_area,
0creditor TYPE /bi0/oicreditor,
0currency TYPE /bi0/oicurrency,
0curtype TYPE /bi0/oicurtype,
0db_cr_ind TYPE /bi0/oidb_cr_ind,
0fiscper TYPE /bi0/oifiscper,
0fiscper3 TYPE /bi0/oifiscper3,
0fiscyear TYPE /bi0/oifiscyear,
0metype TYPE /bi0/oimetype,
0network TYPE /bi0/oinetwork,
0part_actty TYPE /bi0/oipart_actty,
0part_cctr TYPE /bi0/oipart_cctr,
0piobjsv TYPE /bi0/oipiobjsv,
0project TYPE /bi0/oiproject,
0unit TYPE /bi0/oiunit,
0vtdetail TYPE /bi0/oivtdetail,
0vtstat TYPE /bi0/oivtstat,
0vtype TYPE /bi0/oivtype,
0bus_area TYPE /bi0/oibus_area,
0cashdetail TYPE /bi0/oicashdetail,
0cashtype TYPE /bi0/oicashtype,
0comp_code TYPE /bi0/oicomp_code,
0coorder TYPE /bi0/oicoorder,
0cs_dimen TYPE /bi0/oics_dimen,
0cs_unit TYPE /bi0/oics_unit,
0int_bus TYPE /bi0/oiint_bus,
0part_abcpr TYPE /bi0/oipart_abcpr,
0part_coord TYPE /bi0/oipart_coord,
0part_wbsel TYPE /bi0/oipart_wbsel,
0piovalue TYPE /bi0/oipiovalue,
0profit_ctr TYPE /bi0/oiprofit_ctr,
0ps_obj TYPE /bi0/oips_obj,
0statussys0 TYPE /bi0/oistatussys0,
zfbwheroj TYPE /bic/oizfbwheroj,
END OF xtyp_chas,
BEGIN OF xtyp_kyfs,
0amount TYPE /bi0/oiamount,
0quantity TYPE /bi0/oiquantity,
zf03oaws TYPE /bic/oizf03oaws,
zf03oqty TYPE /bic/oizf03oqty,
zf03ozsta TYPE /bic/oizf03ozsta,
END OF xtyp_kyfs,
BEGIN OF xtyp_zf03g003,
s_chas TYPE xtyp_chas,
s_kyfs TYPE xtyp_kyfs,
END OF xtyp_zf03g003,
xtyp_zf03g003_t TYPE HASHED TABLE OF xtyp_zf03g003
WITH UNIQUE KEY s_chas.
DATA: lt_ibm_data TYPE xtyp_zf03g003_t,
ls_ibm_data TYPE xtyp_zf03g003.
So one table (s_chas) contains the characteristics of the Cube and the other (s_kyfs) contains the keyfigures. That's exactly the format we need for the export parameter. At the end of the program, we use the following coding to fill the export table (eto_chas):
loop at lt_ibm_data into ls_ibm_data.
collect ls_ibm_data-s_chas into eto_chas.
endloop.
So in this moment I give this table the structure that is needed to move the data into the cube. I can't change the requirement because it is a standard interface.
I would like to change that coding to be dynamically. Because if somebody changes a charasteristic or a keyfigure in the cube, we would have to change the function builder too. I don't think that the SEM-BPS department will let us know every time they've changed something anyway.
So I hope that my explanation wasn't too confusing
Nicola -
Any Tutorial / Sample to create Single PDF from multiple source files using PDF assembler in a watched folder process. I have a client application which will prepare number of source files and some meta data information (in .XML) which will be used in header/footer. Is it possible to put a run time generated DDX file in the watch folder and use it in Process. If possible how can I pass the file names in the DDX. Any sample Process will be very helpful.
If possible, make use of Assembler API in your client application instead of doing this using watched folder. Here are the Assembler samples : LiveCycle ES2.5 * Programming with LiveCycle ES2.5
Watched folder can accept zip files (sample : Configuring a watched folder to handle multiple input files and write results to a single folder | Adobe LiveCycle Blog ). You can also use execute script to create the DDX at runtime : LiveCycle ES2 * Application Development Using LiveCycle Workbench ES2
Thanks
Wasil -
How to read data from the Deep structure.
Hi
How to get from the deep structure. Means i have one table in that having onother structure. i need to read data from that inner structure.
Regards
ReddyHi,
you can access in the way u use for the normal structure, u should only consider a deep structure is a table without headerline.
TABLES: BKPF, BSEG.
TYPES: TY_ITEM TYPE TABLE OF BSEG.
DATA: BEGIN OF W_DOCUMENT,
HEADER TYPE BKPF,
ITEM TYPE BSEG,
END OF W_DOCUMENT.
DATA: T_DOCUMENTS LIKE STANDARD TABLE OF W_DOCUMENT.
Insert the data:
SELECT * FROM BKPF WHERE ....
W_DOCUMENT-HEADER = BKPF.
SELECT * FROM BSEG INTO TABLE W_DOCUMENT-ITEM
WHERE BUKRS = BKPF-BUKRS
AND BELNR = BKPF-BELNR
AND GJAHR = BKPF-GJAHR.
APPEND W_DOCUMENT TO T_DOCUMENTS.
ENDSELECT.
Read the data:
LOOP AT T_DOCUMENTS INTO W_DOCMENT.
Header data
WRITE: / W_DOCUMENT-HEADER-BUKRS,
W_DOCUMENT-HEADER-BELNR,
W_DOCUMENT-HEADER-GJAHR.
Item data
LOOP AT W_DOCUMENT-ITEM INTO BSEG.
WRITE: / BSEG-BUZEI,
BSEG-WRBTR CURRENCY W_DOCUMENT-HEADER-WAERS.
ENDLOOP.
ENDLOOP.
Regards,
Padmam. -
Create Sales order from Internal Purchase Order using IDOC
Hello Friends,
I have requirement to create Sales Order from Internal Purchase Order Using IDOC.
Backgorund, we have already configured IDOC orders05 to create Sales Order from external Purchase order from Inbound IDOC, and it is working fine.
Now we have new requirement to create Sales Order from our own Purchase order, i.e. When PO is created in one plant corresponidng sales order automatically must needs to create in another Plant with respect PO.
I m trying to design a solution for above problem as follows,
1.create an Inbound Idoc from PO, by creatiing one new message type on PO save.
2.Process that Inbound IDOC same as it is from external PO.
3.Once processed Sales order will create.
Please help me in step 1. to create Inbound IDOC from PO.
If you want any further clarification please write me.
Thanks,
MaheshI had done a similar scenario before and we achieved it through SAP XI. The problem is with the control record. When we create a ORDERS IDOC from a PO the control record will be for outbound transmission. We sent the file to XI and XI resent it back with some data parsing and a new inbound control record. This way it went neat outbound and inbound.
I'm not sure what kind of architecture you have. If you have to do it within your ECC/R/3, then you could create the outbound IDOC to a new port and write a fresh RFC to pick it up from the same folder and create a new control record for inbound processing.
I haven't tried this; but there is a "processing w. trigger (inbound)" option on the outbound process code. May be you can explore into that a bit more.
I'm sure there could be better approaches to handle this within ECC so if you stumble on any, do write back. I would like to know to update my knowledge . -
Creating Simple transformation for an XML data having deep structure
Hi
I have the following XML structure..
<REQUESTS>
<REQUESTNAME>REQ123</REQUESTNAME>
<REQUESTID>1234</REQUESTID>
<CITY>NEWYORK</CITY>
<ZIPCODE>123456</ZIPCODE>
<COMPETENCIES>
<LANGUAGES>
<COMPETENCY>
<SKILL>SAP</SKILL>
<PROFICIENCY>TEST</PROFICIENCY>
<SKILL>JAVA</SKILL>
<PROFICIENCY>TEST123</PROFICIENCY>
(here we may have any number of records for SKILL&PROFICIENCY...)*
</COMPETENCIES>
</LANGUAGES>
</COMPETENCY>
</REQUESTS>
My requirement is to read the above data from an URL and push it into an internal table.
For this I'm trying to use Simple transformations but I'm facing difficulty in doing this.
Can you pl. guide me how to create the transformation and the corresponding code for this.
Best Regards
AnilHi
Here is the actual XML structure..
- <REQUEST>
<COUNTRY />
<ADDRESS />
<CITY />
<ASSIGNTYPE>IP</ASSIGNTYPE>
<CHARGETYPE>CH</CHARGETYPE>
<REMOTEALLOWED>Y</REMOTEALLOWED>
<SALESRATE>EUR</SALESRATE>
<SECURITY>NO</SECURITY>
<TRAVELEXP>Y</TRAVELEXP>
<MAXDAILYRATE />
<CREDENTIALS />
<EXPENDDATE />
<NEWENDDATE />
<NEWEXPENDDATE />
<REPLYBEFORE>2010-11-30</REPLYBEFORE>
<STARTDATE>2010-01-01</STARTDATE>
<ENDDATE>2010-12-31</ENDDATE>
<GCMTYPE>PM</GCMTYPE>
<GCMLEVELFROM>02</GCMLEVELFROM>
<GCMLEVELTO>08</GCMLEVELTO>
<LOCATION>FR43</LOCATION>
<MOBILITY>04</MOBILITY>
<ZIPCODE />
- <COMPETENCIES>
- <LANGUAGES>
- <COMPETENCY>
<SKILL>01106034</SKILL>
<PROFICIENCY>005103</PROFICIENCY>
</COMPETENCY>
</LANGUAGES>
- <ACTIVITIES>
- <COMPETENCY>
<SKILL>01105500</SKILL>
<PROFICIENCY>004507</PROFICIENCY>
</COMPETENCY>
</ACTIVITIES>
- <BUSINESS>
- <COMPETENCY>
<SKILL>01105729</SKILL>
<PROFICIENCY>004605</PROFICIENCY>
</COMPETENCY>
</BUSINESS>
- <INDUSTRIES>
- <COMPETENCY>
<SKILL>01105491</SKILL>
<PROFICIENCY>004901</PROFICIENCY>
</COMPETENCY>
</INDUSTRIES>
- <METHODS>
- <COMPETENCY>
<SKILL>01105591</SKILL>
<PROFICIENCY>004805</PROFICIENCY>
</COMPETENCY>
</METHODS>
- <OFFERINGS>
- <COMPETENCY>
<SKILL>01105840</SKILL>
<PROFICIENCY>005002</PROFICIENCY>
</COMPETENCY>
</OFFERINGS>
- <PRODUCTS>
- <COMPETENCY>
<SKILL>01107304</SKILL>
<PROFICIENCY>004703</PROFICIENCY>
</COMPETENCY>
</PRODUCTS>
</COMPETENCIES>
<CANDIDATES />
</REQUEST>
Here..... <SKILL></SKILL> <PROFICIENCY></PROFICIENCY> can be more than 1 entry...
For this I have created a simple transformation like below..
I have used the tcode 'XSLT_TOOL '..
In SE11 I have created a Table type 'ZCOMPETENCIES' which is having a line type 'ZLANGS'.
ZLANGS is a structure which has another structure called 'ZCOMPETENCY' and this 'ZCOMPETENCY' is having fields
SKILL & PROFICIENCY.
I have used the wizard button which u can find 'XSLT_TOOL '.. and provided the table type ZCOMPETENCIES' and it has automatically created the following transformation...
<?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="ROOT" type="?"/>
<tt:root name="COMPETENCIES" type="ddic:ZCOMPETENCIES"/>
<tt:template>
<COMPETENCIES>
<tt:loop ref=".COMPETENCIES">
<ZLANGS>
<COMPETENCY>
<SKILL tt:value-ref="COMPETENCY.SKILL"/>
<PROF tt:value-ref="COMPETENCY.PROF"/>
</COMPETENCY>
</ZLANGS>
</tt:loop>
</COMPETENCIES>
</tt:template>
</tt:transform>
I have written following code to get the data
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = gs_file
CHANGING
data_tab = gt_itab
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
GET REFERENCE OF gt_person INTO gs_result_xml-value.
gs_result_xml-name = 'COMPETENCIES'.
APPEND gs_result_xml TO gt_result_xml.
TRY.
CALL TRANSFORMATION ZTEST_TRAN
SOURCE XML gt_itab
RESULT (gt_result_xml).
CATCH cx_root INTO gs_rif_ex.
gs_var_text = gs_rif_ex->get_text( ).
MESSAGE gs_var_text TYPE 'E'.
ENDTRY.
Please let me know if you need any further details..
Best Regards
Anil -
How to create an xml from xsd in abap
HI Experts,
i want to create an xml file from xsd and i want to validate an xml file against an xds.is this possible in abap.if it is possible can any one give me an sample code
for this one.
how to create an xml file in abap.i have seen so many blogs which parses the xml file but i didn't get blog for creating an xml file.how can we do that one.
any suggestions will be appriciated
thanks in advance
With Regards
NaiduHI
GOOD
IT IS POSSIBLE IN ABAP
Extensible Markup Language (XML) is a simple, very flexible text format derived from SGML (ISO 8879). Originally designed to meet the challenges of large-scale electronic publishing, XML is also playing an increasingly important role in the exchange of a wide variety of data on the Web and elsewhere.
XSD->
XML Schemas express shared vocabularies and allow machines to carry out rules made by people. They provide a means for defining the structure, content and semantics of XML documents. in more detail.
XDS->
XDS can process data images from CCD-, imaging-plate, and multiwire-detectors in a variety of formats. Detector specific Input file templates greatly simplify the use of XDS; they are provided as part of the documentation.
XDS runs under Unix or Linux on a single server or a grid of up to 99 machines of the same type managed by the MOSIX system; in addition, by using OpenMP, it can be executed in parallel on up to 32 processors at each node that share the same address space.
http://www2.stylusstudio.com/SSDN/default.asp?action=9&fid=23&read=2926
/people/r.eijpe/blog/2006/02/19/xml-dom-processing-in-abap-part-iiia150-xml-dom-within-sap-xi-abap-mapping
THANKS
MRUTYUN -
Creating mysql schema from pojo with hibernate using netbeans
I have been fortunate in finding some good tutorials on how to create POJOs from database schema using hibernate (e.g. http://netbeans.org/kb/docs/web/hibernate-webapp.html).
Does anyone know of tutorials on creating database schemas from POJOs -- preferable using netbeans? Even the very smallest tutorial with one table or two related tables will do.961389 wrote:
I have been fortunateNot really, that is not rare information.
Does anyone know of tutorials on creating database schemas from POJOs -- preferable using netbeans? Even the very smallest tutorial with one table or two related tables will do.Netbeans has little to do with the creation of the schema, it's the container that's usually configured to do it. You can use the "hibernate.hbm2ddl.auto" property to control whether the DDL is created from the entities automatically. -
Creating hierarchical XML from MS SQL
Hello,
I am trying to create a hierarchical XML from MS SQL database. I have got a SQL running:
select distinct
1 as Tag,
NULL as Parent,
X_SEQ_NUM as [Invoice!1!Invoice_Num!element],
COALESCE(INV.ADJUSTMENT_AMT,0) as [Invoice!1!Adjusted_Total!element],
Null as [Item!2!CostedAccrual!element],
Null as [Item!2!QuotAcc!element],
Null as [Item!2!Prod_Name!element]
from S_INVOICE INV
inner join S_INVOICE_ITEM ITEM on (ITEM.INVOICE_ID = INV.ROW_ID)
inner join S_PROD_INT PROD on (PROD.ROW_ID = ITEM.PROD_ID)
where
INV.X_TAX_POINT_DT between '2010-02-01' and '2010-02-15'
and (PROD.X_FREIGHT_FLG = 'Y' or PROD.X_INT_PROD_FLAG = 'Y')
and X_SEQ_NUM = '1066505'
UNION ALL
select distinct
2 as Tag,
1 as Parent,
INV.X_SEQ_NUM ,
COALESCE(INV.ADJUSTMENT_AMT,0),
COALESCE(ITEM.X_UNIT_PRI,0) as CostedAccrual, --costed accrual
COALESCE(ITEM.X_QUOTED_AMT,0)/ITEM.X_EXCHANGE_RATE as QuotAcc,
PROD.NAME as Prod_Name
from S_INVOICE INV
inner join S_INVOICE_ITEM ITEM on (ITEM.INVOICE_ID = INV.ROW_ID)
inner join S_PROD_INT PROD on (PROD.ROW_ID = ITEM.PROD_ID)
where
INV.X_TAX_POINT_DT between '2010-02-01' and '2010-02-15'
and (PROD.X_FREIGHT_FLG = 'Y' or PROD.X_INT_PROD_FLAG = 'Y')
and X_SEQ_NUM = '1066505'
ORDER by 3, 7
for XML EXPLICIT
( we are on a siebel created db)
and I get the following
<?xml version="1.0" encoding="UTF-8" ?>
- <ROWSET>
- <ROW>
- <XML_F52E2B61-18A1-11d1-B105-00805F49916B>
- <Invoice>
<Invoice_Num>1066505</Invoice_Num>
<Adjusted_Total>220.0000000</Adjusted_Total>
- <Item>
<CostedAccrual>200.0000000</CostedAccrual>
<QuotAcc>0.00000000000000000000000</QuotAcc>
<Prod_Name>Third Party Services</Prod_Name>
</Item>
</Invoice>
</XML_F52E2B61-18A1-11d1-B105-00805F49916B>
</ROW>
</ROWSET>
(Apologies for the lack of outlining)
My question is about the the line "XML_F52E...." as it isn't right and I'm not sure how to proceed.
Any thoughts?
Thank you in advance.
RichardHi Richard,
Not sure, if i got it correctly.
You are talking abt the element name ?
then, always give meaningful short name to columns in the query. -
How to create dll file from c code to use in compactrio 9004 RT controller
Hi.
I am using Compactrio 9004 Real time controller and i am new to this. I have a C code and i want to use this with the RT controller.I red that that can be done by creating a dll file and can be called in labview.Can any body expalin how to create a DLL from the c code and be used with this RT controlelr?
Regards,
Vishnuvishnu123 wrote:
Hi,
Earlier in this forum itself in cRIO 900x controllers will run Pharlap and run C/C++ code compiled into .dll files.Can you please tell how to transfer the created DLL to RT controller memory throght FTP?
Thanks and regards,
Vishnu
There is another KB article about this for Pharlap based controllers. And you are right the earlier CompactRIO controllers were Pharlap based. Basically for a deployed application to work, you need to put the DLL through FTP in "/ni-rt/system". If you deploy it directly from the project everything will be loaded into memory through the project environment itself including directly dependable DLLs, (but of course won't survive a power cycle).
I hope you are aware that while Windows DLLs can work on Pharlap OS they by no means will do so always. The Pharlap OS has not a fully featured Windows API. Also you need to be careful which version of Visual C you are going to use depending on the Pharlap OS version, since the VC runtime DLLs already present on the controller will need to be the same as the ones your Visual C environment likes to link in. Recent Pharlap OS versions use the msvcr71.dll. It's very possible that those runtime libraries can't just simply be copied from a normal Windows installation but might have been recompiled by NI specifically for their controller targets.
So to avoid problems it's a good idea to make sure your DLL uses the same runtime library DLL or make your DLL to include the static MS runtime.
Rolf Kalbermatter
Message Edited by rolfk on 02-05-2008 09:51 AM
Message Edited by rolfk on 02-05-2008 09:53 AM
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Problem converting XML back to ABAP Structure using XSLT
Hi Experts,
I am currently trying to convert this xml file back to my ABAP structure but i have been unsuccessful so far. In XML file contain more than 1 reocrd. But my XSLT program is retriving only only first record. Try to help to get all the records.
Sample XML File:
Thanks for your help in advance.
Regards,
Srinihere is the XSLT program YSIMPLEXMLTOITAB1
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<OUTTAB>
<xsl:for-each select="//String">
<ZTEST11>
<FINAL_RESULT>
<xsl:value-of select="."></xsl:value-of>
</FINAL_RESULT>
</ZTEST11>
</xsl:for-each>
</OUTTAB>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>
ABAP report program to test this.
REPORT yjfkdjkfmxl
NO STANDARD PAGE HEADING.
DATA: BEGIN OF ztest11 OCCURS 0,
final_result(220),
END OF ztest11 .
DATA: xml_string TYPE string .
DATA: xslt_error TYPE REF TO cx_xslt_exception,
xslt_message TYPE string .
CLEAR xml_string .
CONCATENATE
`<?xml version="1.0" encoding="utf-8"?>`
`<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> `
`<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">`
`<ns:matchResponse xmlns:ns='http://www.openuri.org/'>`
`<matchResult xsi:type='SOAP-ENC:Array' SOAP-ENC:arrayType='xsd:string[18]'>`
`<String xsi:type='xsd:string'>23901|EUS|20060625 |ABU NIDAL ORGANISATION||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23934|EUS|20060625 |ABU NIDAL ORGANISATSIOON||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23940|EUS|20060625 |ABU NIDALORGANIZACIJA||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>4228|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||DZ|ALGERIA|60|5084 |19950125|19950123|20880808</String>`
`<String xsi:type='xsd:string'>4229|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||LB|LEBANON|60|5084 |19950125|19950123|20880808</String>`
`<String xsi:type='xsd:string'>4231|sdme|19950301 605084 19950125|ABU NIDAL ORGANIZATION||||||LY|LIBYAN ARAN JAMAHIRIYA|60|5084 |19950125|19950123|20880808</String>`
`<String xsi:type='xsd:string'>4232|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||SD|SUDAN|60|5084 |19950125|19950123|20880808</String>`
`<String xsi:type='xsd:string'>4233|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||IQ|IRAQ|60|5084 |19950125|19950123|20880808</String>`
`<String xsi:type='xsd:string'>6643|dto|19971008 6252649 199710086651088 200110056856860 20031002|ABU NIDAL ORGANIZATION||||||XX|ALL|68|56860 |20031002|19971008|20880808</String>`
`<String xsi:type='xsd:string'>23941|EUS|20060625 |ABU NIDAL SZERVEZET||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>4332|sdme|19950126 605084 19950125|NIDAL, ABU|DOB: May 1937 or 1940||JAFFA|||IL|ISRAEL|60|5084 |19950125|19950123|20880808</String>`
`<String xsi:type='xsd:string'>23950|EUS|20060625 |ORGANIZACIJA ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23911|EUS|20060625 |ORGANIZACIÓN ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23946|EUS|20060625 |ORGANIZACJA ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23916|EUS|20060625 |ORGANIZAÇÃO ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23955|EUS|20060625 |ORGANIZZAZIONE ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23949|EUS|20060625 |ORGANIZÁCIA ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:nil='true'></String>`
`</matchResult>`
`</ns:matchResponse>`
`</SOAP-ENV:Body>`
`</SOAP-ENV:Envelope>`
INTO xml_string .
TRY .
CALL TRANSFORMATION (`YSIMPLEXMLTOITAB1`)
SOURCE XML xml_string
RESULT outtab = ztest11[].
CATCH cx_xslt_exception INTO xslt_error.
xslt_message = xslt_error->get_text( ).
ENDTRY.
Regards
Raja -
Problem converting XML back to ABAP Structure using XSLT program
Hi Experts,
I am currently trying to convert this xml file back to my ABAP structure but i have been unsuccessful so far. In XML file contain more than 1 reocrd. But my XSLT program is retriving only only first record. Try to help to get all the records.
Sample XML File:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<m:matchResponse xmlns:m="http://www.openuri.org/">
<matchResult soapenc:arrayType="xs:string[1]">
<enc:String xmlns:enc="http://www.openuri.org/encodedTypes">
23417|finc|20060427 |BELMETALNERGO||||||X
X|ALL||||20060427|20880808
</enc:String>
</matchResult>
</m:matchResponse>
</soapenv:Body>
</soapenv:Envelope>
My XSLT Program:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl="http://www.sap.com/sapxsl" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hp="http://www.openuri.org/" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<OUTTAB>
<xsl:for-each select="soapenv:Envelope/soapenv:Header/soapenv:Body/m:matchResponse/matchResult/enc:String">
<ZA2_RPL_DETAILS_S>
<FINAL_RESULTS>
<xsl:value-of select="."/>
</FINAL_RESULTS>
</ZA2_RPL_DETAILS_S>
</xsl:for-each>
</OUTTAB>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>
My Structure is : Structure Name is ZA2_RPL_DETAILS_S.
filed is: FINAL_RESULT CHAR553
My requirement is to store the complete value between <String> and </String>.
Currently it is giving the blank records
Thanks for your help in advance.
Regards,
RaoHi,
post here
expert forums -> sapnetweaver -> exchange infrastructure
Regards -
To Create an XML from a java Bean
I have a java class( a bean ) wih a number of properties. I need to create an xml file which is closely tied with the bean. How can I do it?
Search the web there's stuff out there that can do this for you
-
How to create an XML from Source Table
Hi,
I am new to ODI and have a requirement as part of our project -
Say have a table in Source schema with few columns and need to convert the same to XML format and insert the XML as a CLOB column in table of target schema.
There could also be a case where the XML generated in Source will have to be passed on to Target by calling a web service at target (through ODI)
Please help with all the steps required to achieve the same.
Regards,
KumarHI
GOOD
IT IS POSSIBLE IN ABAP
Extensible Markup Language (XML) is a simple, very flexible text format derived from SGML (ISO 8879). Originally designed to meet the challenges of large-scale electronic publishing, XML is also playing an increasingly important role in the exchange of a wide variety of data on the Web and elsewhere.
XSD->
XML Schemas express shared vocabularies and allow machines to carry out rules made by people. They provide a means for defining the structure, content and semantics of XML documents. in more detail.
XDS->
XDS can process data images from CCD-, imaging-plate, and multiwire-detectors in a variety of formats. Detector specific Input file templates greatly simplify the use of XDS; they are provided as part of the documentation.
XDS runs under Unix or Linux on a single server or a grid of up to 99 machines of the same type managed by the MOSIX system; in addition, by using OpenMP, it can be executed in parallel on up to 32 processors at each node that share the same address space.
http://www2.stylusstudio.com/SSDN/default.asp?action=9&fid=23&read=2926
/people/r.eijpe/blog/2006/02/19/xml-dom-processing-in-abap-part-iiia150-xml-dom-within-sap-xi-abap-mapping
THANKS
MRUTYUN -
Creating JCo IDoc from flat file structure
Hi,
I need to send an IDoc into SAP using JCo.
The input to my program is a string containing lines representing a flat file idoc, e.g.
Line 1="EDI_DC40 2 ORDERS04.."
Line 2="E1EDK01 00000100000001 USD..."
Line 3="E1EDK14 0000030000000...."
Is there a simple way to use JCo to create & send the IDoc?
i.e.
1) If I use JCo and RFC IDOC_INBOUND_ASYNCHRONOUS, what would be all the steps/calls to SAP (create TID, call IDOC_INBOUND_ASYNCHRONOUS, confirm TID..?)
And can IDOC_INBOUND_ASYNCHRONOUS be called using the flat file structures (without having to map to all the JCo ParameterList fields)? Since the flat file structures are in the format required by the RFC, just in one long string.
Line 1=>IDOC_CONTROL_REC_40
Lines 2..n=>IDOC_DATA_REC_40
2) Similarly, if I were to use JCo plus the JCO IDoc library, is there a way to pass the flat file structures without having to do all the mapping to segment fields?
3) Other options..?
I want to use ALE to SAP, not files, even though the input is in the flat file structure.Your reply gives a link to the general JCo documentation.
It doesn't give ideas on how to call an RFC or IDoc from JCO without mapping each and every field from a flat file structure.
I'm looking for a way to do something like this:
Function IDOC_INBOUND_ASYNCHRONOUS has table parameters
IDOC_CONTROL_REC_40 STRUCTURE EDI_DC40
IDOC_DATA_REC_40 STRUCTURE EDI_DD40
Since I have the flat file representation of the IDoc, the first line should overlay exactly onto the EDI_DC40 structure. And the subsequent lines should overlay onto EDI_DD40. (all fields in this RFC are strings)
However JCO and JCO IDoc library seem very strongly typed, so it looks like I would have to map each field from the flat file structure to a field in the JCO Function or JCO IDoc object.
This could be done in a generic way using the function/idoc metadata, however there would still be some overhead.
Is there a way to get round this, and build the function/idoc treating its parameters as one long string?
Maybe you are looking for
-
HT204053 How do I change my iPhone iCloud account to match my iPad account
How to change my iCloud account to match my iPad account.
-
Rejected App no problem with binary
Hi, Apple rejected my binary because they belive there is http streaming in my app but there isn't. Do I need to resubmit the app or can I deal with Apple in the resolution centre? They haven't replied to my response in two days? Please advise. Than
-
How to track my iPhone 5 ... I lost it in Singapore n my data roaming is off...are there any chances to find it ..
-
G4 has SuperDrive CD/DVD player/recorder. Was able to watch a DVD movie when I first got laptop (about a month ago), but don't remember what application I used. Now, system can't seem to find the player. 1) When I search Finder help, I get a link for
-
Just purchsed upgrade OSX Mountain Lion. Went to install and it says "OSX cannot be installed on Macintosh HD" Why?