XML to internal table conversion within ABAP mapping class
I am doing a ABAP mapping for file to Idoc. My requirement is to convert XML file into ABAP internal table (within ABAP mapping class). Is there any standard FM, method, transformation etc, which can be used here.
Thanks, Dehra
Dehra,
Have you seen this weblogs which talks about this:
/people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach
/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach
/people/r.eijpe/blog/2006/02/19/xml-dom-processing-in-abap-part-iiia150-xml-dom-within-sap-xi-abap-mapping
/people/r.eijpe/blog/2006/02/20/xml-dom-processing-in-abap-part-iiib150-xml-dom-within-sap-xi-abap-mapping
Hope this helps you....
---Satish
Similar Messages
-
Simple transformation error in converting XML to internal table
Hi Team,
I have an issue, its working in Dev, QA, and Prod in PI 7.0, once we upgrade it to PI 7.1 I'm getting the below mention error,
Unknown Simple transformation error in converting XML to internal table
Application error in mapping program ZF_INT006_FILE_TO_SAP_FILE, error code: , error text: Unknown Simple transformation error in converting XML to internal table An exception has occurred.
Can any one suggest related notes are suggestion.
appericate in advance for the solutions which you all provide me
Thank you
Venkat AnilCheck the flag "use SAP XML toolkit" for the operation mapping and try, if that works then.
Check the flag for all XSLT and Java mappings which is migrated from PI 7.0 -
Xml to Internal table : Issue
Dear All,
I have written a program to bring the data from xml to internal table Below is the strucutre of my xml file .
- <Data>
- <MT Type="CR">
<MatType>FERT</MatType>
</MT>
- <OP Type="CR">
<MatNumber>9901040103-000115</MatNumber>
- <Activities Element="AT">
- <AT Type="CR">
<MaterialNumber>115</MaterialNumber>
<ActivityType>DEPR.</ActivityType>
</AT>
- <AT Type="CR">
<MaterialNumber>117</MaterialNumber>
<ActivityType>L.C.R</ActivityType>
</AT>
</Activities>
</OP>
</Data>
.However I am not able to handle the multiple entries which comes together . ie
- <AT Type="CR">
<MaterialNumber>115</MaterialNumber>
<ActivityType>DEPR.</ActivityType>
</AT>
- <AT Type="CR">
<MaterialNumber>117</MaterialNumber>
<ActivityType>L.C.R</ActivityType>
</AT>
Please let me know how to handle this . Thanks!
Regards,
SyedHi ,
To convert XML data into internal table u have to use FM "SMUM_XML_PARSE", this FM takes XString as input ,so first u have to
convert ur xml string into XString using FM "SCMS_STRING_TO_XSTRING".
Thanks
jitendra -
Internal table declaration -OO ABAP
Hi,
I am looking to declare an internal table using OO objects. My declaration are as follows..
TYPES : Begin of itab,
f1 type c,
f2 type c,
End of itab.
DATA : itab1 type standard table of itab.
DATA: wa_tab type itab.
I have an internal table to say itab_pa2001 which i am reading all the records of pernr into ITAB_PA2001.To get the text i want to select * from t5*** into ..... Finally wht am looking is to move some of the fields into the final table ITAB. Could you please let me know how to set this up as i am getting wrong values when i am looping as below.
how to declare a structure in ITAB using ABAP OO....??
LOOP at ITAB_PA2001 into wa_itab.
ENDLOOP.
Thanks,
VindHi,
Please refer to following links :
[How to declare an internal table in OO-ABAP programming? |Re: How to declare an internal table in OO-ABAP programming?;
[sample object oriented ABAP program |http://wiki.sdn.sap.com/wiki/display/Snippets/sampleobjectorientedABAPprogram]
Hope this helps.
Regards,
Chandravadan -
Reading data from XML to Internal table
Hi Experts,
I got a requirement to read the data fom xml to internal table.is it possible to store deep internel table data into flat internal tables?my internel table contains 4 internel table and these 4 internel table contains 2 internel tables each...can any one help me o this...
points will be rewarded...
Regards,
RakhiHi Rakhi,
* Structure to Get the Client Details as in XML format
DATA: BEGIN OF client,
BEGIN OF Personal_Details,
kunnr like kna1-kunnr,
name1 like kna1-name1,
adrnr like kna1-adrnr,
END OF Personal_Details,
BEGIN OF Address,
street like adrc-street,
city1 like adrc-city1,
END OF Address,
BEGIN OF Communication,
fax_number like adrc-fax_number,
tel_number like adrc-tel_number,
END OF Communication,
END OF client.
DATA: it_client TYPE TABLE OF client WITH HEADER LINES,
result LIKE client.
DATA: xml_string TYPE string.
* Get the Client Details into the structure to be made as an XML string
TRY.
* Convert the Structure to XML string
CALL TRANSFORMATION ('ID')
SOURCE para = it_client
RESULT XML xml_string.
* Convert the XML string to structure - result
CALL TRANSFORMATION ('ID')
SOURCE XML xml_string
RESULT para = result.
CATCH cx_st_error.
ENDTRY.
best regards,
Thangesh -
Acces dynamic configuration variable (e.g. filename) in ABAP mapping class
Hi experts
I am searching for a possibility to acces a dynamic configuration variable (DCV) in an ABAP mapping class. Since I could not find a solution in SDN and other sources, I hope somebody in this forum can help me.
What I already found is the following code which can be used to set a DCV, but what I would be interested in is how to read a DCV.
Any help is appreciated.
Markus
METHOD if_mapping~execute.
DATA l_record type mpp_dynamic.
* copy payload
result = source.
* add an adapter specific attribute
l_record-namespace = 'http://sap.com/xi/XI/System/File'.
l_record-name = 'FileName'.
l_record-value = 'test.xml'.
dynamic_configuration->add_record( l_record ).
ENDMETHOD.Hi Markus,
you can find everything in my blogs
/people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping
Regards,
michal -
XML to ABAP internal table conversion
Hi Guys,
Via debugging,I downloaded the context of an ABAP webdynpro application into an XML file on my desktop. Now I want to use this file as an input to a FM. This is what I have done for it
1) Used the GUI_UPLOAD fm to convert the xml file on my desktop into xstring
2) used transformation like this
CALL TRANSFORMATION id
SOURCE xml = ls_xml_xstring
RESULT para = lt_result.
lt_result is of the type that the FM input expects
step 2 does not work. I know I am missing something there. Pls tell me what it is. Its a huge file and I dont want to manually create the input.
BR,
GirishHi,
Have you seen this weblogs which talks about this:
/people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach
/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach
/people/r.eijpe/blog/2006/02/19/xml-dom-processing-in-abap-part-iiia150-xml-dom-within-sap-xi-abap-mapping
/people/r.eijpe/blog/2006/02/20/xml-dom-processing-in-abap-part-iiib150-xml-dom-within-sap-xi-abap-mapping
Hope this helps you....
Regards
Nishant Malhotra -
How to upload XML file into the internal table in Webdynpro ABAP ?
Hi Friends,
I am not able to upload the XML file into ABAP,can you please help me in solving this issue with the help of source code.
Regards
DineshHi Dinesh,
Try go through this program which I had developed earlier. It takes as input an XML file and then breaks it down into name-value pairs of an intrnal table. You need to pass an XML file as input to this program. (I had hard coded the path for my XML file in it. You need to replace it with 1 of your own or you can just delete it and use the browse button to selet the file on your PC)
Regards,
Uday
REPORT ZUDAY_XML no standard page heading.
" Internal table to store the XML file in binary mode
data: begin of it_xml occurs 1,
c(255) type x,
end of it_xml,
" Name-value pairs table rturned by FM SMUM_XML_PARSE
it_SMUM_XMLTB type SMUM_XMLTB occurs 0 with header line,
" Table returned by FM SMUM_XML_PARSE for error handling
it_bapiret2 type bapiret2 occurs 0 with header line.
" XSTRING variable to be used by FM SCMS_BINARY_TO_XSTRING to hold the XML file in XSTRING format
data: I_xstring type xstring,
" String variable to hold XML file path to pass to GUI_UPLOAD
I_file_path type string,
" Variable to store the size of the uploaded binary XML file
I_LENGTH TYPE I VALUE 0.
parameters: P_path type IBIPPARMS-PATH default 'C:\Documents and Settings\c5104398\Desktop\flights.xml'.
" Get the XML file path from the user
at selection-screen on value-request for P_path.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = P_PATH. -
XML to Internal table using XSLT by CALL TRANSFORMATION error
Dear experts,
I have to fetch the data from an XML file using XSLT into internal tables. The XML file is very big as following:-
<?xml version="1.0" standalone="yes" ?>
- <Shipment>
<shipmentID>25091203S000778</shipmentID>
<manifestDateTime>2009-12-03T20:16:52.00</manifestDateTime>
<shipmentFacilityNumber>025</shipmentFacilityNumber>
<shipmentFacilityAbbreviation>CHI</shipmentFacilityAbbreviation>
<shipmentFacilityAddress1>810 KIMBERLY DRIVE</shipmentFacilityAddress1>
<shipmentFacilityAddress2 />
<shipmentFacilityCity>CAROL STREAM</shipmentFacilityCity>
<shipmentFacilityState>IL</shipmentFacilityState>
<shipmentFacilityPostalCode>601880000</shipmentFacilityPostalCode>
<shipmentTruckCarrierCode>X150</shipmentTruckCarrierCode>
<shipmentSourceCode>T</shipmentSourceCode>
<userID>CAMPOSG</userID>
- <Delivery>
<primaryCustomerNumber>954371</primaryCustomerNumber>
<primaryCustomerName>MIDWEST OFFICE SUPPLY</primaryCustomerName>
<primaryCustomerAddress1 />
<primaryCustomerAddress2>4765 INDUSTRIAL DR</primaryCustomerAddress2>
<primaryCustomerCity>SPRINGFIELD</primaryCustomerCity>
<primaryCustomerState>IL</primaryCustomerState>
<primaryCustomerPostalCode>627030000</primaryCustomerPostalCode>
<primaryCustomerPhoneNumber>2177535555</primaryCustomerPhoneNumber>
<shuttleStopFacilityNumber />
<billOfLadingNumber>25HZK99</billOfLadingNumber>
<carrierProNumber />
<shipmentTotalCartonCount>6</shipmentTotalCartonCount>
<shipmentTotalWeight>266</shipmentTotalWeight>
- <order>
<orderNumber>25HZK99</orderNumber>
<subOrderNumber />
<dateProcessed>2009-12-03</dateProcessed>
<primaryOrderNumber />
<shipTruckCode>X150</shipTruckCode>
<shipTruckDescription>UDS - ADDISON</shipTruckDescription>
<shipTruckPriorityCode>01</shipTruckPriorityCode>
<shipTruckGroupCode>01</shipTruckGroupCode>
<shipTruckDepartureTime>20.00.00</shipTruckDepartureTime>
<shipTruckDockID>07</shipTruckDockID>
<ldpFacilityAbbreviation />
<shuttleAvailableIndicator>N</shuttleAvailableIndicator>
<shuttleMessageText />
<crossDockFacilityCode />
<crossDockTruckCode />
<crossDockID />
<subsidizedFreightTruckID />
<customerPurchaseOrderNumber>623559</customerPurchaseOrderNumber>
<headerTypeCode>P</headerTypeCode>
<orderTypeID>RG</orderTypeID>
<deliveryTypeID>DS</deliveryTypeID>
<deliveryMethodCode />
<customerBarCode />
<customerReferenceData>25HZK99</customerReferenceData>
<customerReferenceText />
<customerRouteData>ZNED UNTED</customerRouteData>
<customerRouteText>ROUTE</customerRouteText>
<endConsumerPurchaseOrderNumber />
<endConsumerPurchaseOrderText />
<endConsumerName>CHARLESTON TRANS. FACILITY</endConsumerName>
<endConsumerAddress1>HOMEWOOD DT PROGRAM DEPT. 3</endConsumerAddress1>
<endConsumerAddress2>17341 PALMER BLVD.</endConsumerAddress2>
<endConsumerAddress3 />
<endConsumerCity>HOMEWOOD</endConsumerCity>
<endConsumerState>IL</endConsumerState>
<endConsumerPostalCode>60430</endConsumerPostalCode>
<endConsumerCountryCode />
<fillFacilityNumber>025</fillFacilityNumber>
<shpFacilityNumber>025</shpFacilityNumber>
<homeFacilityAbbrCode>STL</homeFacilityAbbrCode>
<homeFacilityNumber>015</homeFacilityNumber>
<multiCartonIndicator>Y</multiCartonIndicator>
<primaryCustomerIndicator>Y</primaryCustomerIndicator>
<shipToCustomerNumber>954371001</shipToCustomerNumber>
<customerCompanyID>01</customerCompanyID>
<customerTruckID>U888</customerTruckID>
<customerTruckDescription>UDS - ADDISON</customerTruckDescription>
<customerTruckDockID>13</customerTruckDockID>
<thirdPartyBillCarrier />
<thirdPartyBillID />
<thirdPartyBillType />
<qualityCheckIndicator>N</qualityCheckIndicator>
<warehouseLaydownID />
<packListPosition>I</packListPosition>
<preferredPackingType>CTN</preferredPackingType>
<preferredPackingMaterial>PAPER</preferredPackingMaterial>
<preferedPackingInstructions />
<totalOrderCartonQty>6</totalOrderCartonQty>
<convertAddressIndicator>N</convertAddressIndicator>
<dealerInstructionIndicator>Y</dealerInstructionIndicator>
<dealerinstructions1>CPO#: 623559</dealerinstructions1>
<dealerinstructions2>ATTN: DANA GRIFFIN</dealerinstructions2>
<dealerinstructions3>INFO: 612</dealerinstructions3>
<dealerinstructions4>ROUTE: ZNED UNTED</dealerinstructions4>
<dealerinstructions5 />
<dealerinstructions6 />
<shippingInstructionsIndicator>N</shippingInstructionsIndicator>
<shippingInstructions1 />
<shippingInstructions2 />
<shippingInstructions3 />
<shippingInstructions4 />
<shippingInstructions5 />
<shippingInstructions6 />
<specialInstructionsIndicator>N</specialInstructionsIndicator>
<specialInstructions1 />
<specialInstructions2 />
<customeContainerDesc />
- <carton>
<deliveryCartonID>253370905995</deliveryCartonID>
<shipIndicator>Y</shipIndicator>
<deliveryPalletID>X150</deliveryPalletID>
<consolidatedDeliveryCartonID />
<scanDateTime>2009-12-03T19:36:12.00</scanDateTime>
<cartonWeight>52</cartonWeight>
<dropShipFlag>1</dropShipFlag>
<carrierTrackingNumber />
<carrierZoneID>0</carrierZoneID>
<codAmount />
<customerPackageAmount />
<declaredValue />
<residentialDeliveryIndicator />
<serviceTypeCode>00</serviceTypeCode>
<ssccCode>006860244400829393</ssccCode>
- <Item>
<shipPrefix>UNV</shipPrefix>
<shipStockNumber>21200</shipStockNumber>
<itemDescription>PAPER XERO/DUP WE LTR 20#</itemDescription>
<orderQuantity>1</orderQuantity>
<originalShipQuantity>1</originalShipQuantity>
<shipQuantity>1</shipQuantity>
<inventoryUnitCode>CT</inventoryUnitCode>
<inventoryWeightQuantity>52.000</inventoryWeightQuantity>
<upcNumber>00000000000000</upcNumber>
<upcRetailCode>087547212004</upcRetailCode>
<hazmatIndicator>N</hazmatIndicator>
<serialRequiredIndicator>N</serialRequiredIndicator>
<dealerMemoPO>S</dealerMemoPO>
<cartonLineNumber>1</cartonLineNumber>
<orderLineNumber>11</orderLineNumber>
<originalOrderPrefix>UNV</originalOrderPrefix>
<originalOrderStockNumber>21200</originalOrderStockNumber>
<reasonCode />
- <Item_Serial>
<serialNumber />
</Item_Serial>
</Item>
</carton>
</order>
</Delivery>
</Shipment>
This is not the complete XML file as it exceeds the 15000 characters and then I cann't post here. So I have deleted much part of it.
The hierarchy is as following: Shipment->Delivery->Order->Carton->Item.
I have created a XSLT for it which is working fine.
But when I execute my report program it gives CX_SY_XSLT_FORMAT_ERROR saying that
Transformation error: Non-canonical structure of element name XML_OUTPUT.Dear experts,
My report program is as following:-
*& Report Z_ASNTRNS
REPORT Z_ASNTRNS.
*& Report Z_ASNTRNS
TYPE-POOLS: abap, ixml.
TABLES: ZASN_SHIPMENT,ZASN_DELIVERY,ZASN_ORDER,ZASN_CARTON,ZASN_ITEM.
*CONSTANTS gs_file TYPE string VALUE 'C:Documents and SettingsC5134126DesktopRajesh_kandakatlaSampleASNFile.xml'.
This is the structure for the data from the XML file
TYPES: BEGIN OF ts_item,
ZSHIPMENT LIKE ZASN_ITEM-ZSHIPMENT,
VBELN LIKE ZASN_ITEM-VBELN,
ORDER_NUMBER LIKE ZASN_ITEM-ORDER_NUMBER,
CARTON_ID LIKE ZASN_ITEM-CARTON_ID,
ITEM LIKE ZASN_ITEM-ITEM,
CARTON_LINE_NUM LIKE ZASN_ITEM-CARTON_LINE_NUM,
CARTON_LINE_NUMBER LIKE ZASN_ITEM-CARTON_LINE_NUM,
AEDAT(8),
AEZET(6),
ITEM_DESCRIPTION LIKE ZASN_ITEM-ITEM_DESCRIPTION,
ORD_QTY(16),
ORIGINAL_SHIP(16),
SHIP_QTY(16),
UPC_NUMBER LIKE ZASN_ITEM-UPC_NUMBER,
DEALER_MEMO_PO(5),
ORDER_LINE_NUM LIKE ZASN_ITEM-ORDER_LINE_NUM,
STATUS LIKE ZASN_ITEM-STATUS,
END OF ts_item.
TYPES: BEGIN OF ts_carton,
ZSHIPMENT LIKE ZASN_CARTON-ZSHIPMENT,
VBELN LIKE ZASN_CARTON-VBELN,
ORDER_NUMBER LIKE ZASN_CARTON-ORDER_NUMBER,
CARTON_ID LIKE ZASN_CARTON-CARTON_ID,
AEDAT(8),
AEZET(6),
SHIP_INDICATOR LIKE ZASN_CARTON-SHIP_INDICATOR,
TRACKING_NUMBER LIKE ZASN_CARTON-TRACKING_NUMBER,
ZZCARTON_WGT(18),
Item type ts_item,
END OF ts_carton.
TYPES: BEGIN OF ts_order,
ZSHIPMENT LIKE ZASN_ORDER-ZSHIPMENT,
VBELN LIKE ZASN_ORDER-VBELN,
ORDER_NUMBER LIKE ZASN_ORDER-ORDER_NUMBER,
AEDAT(8),
AEZET(6),
SUB_ORDER LIKE ZASN_ORDER-SUB_ORDER,
ORDER_DATE(8),
PRIMARY_ORDER LIKE ZASN_ORDER-PRIMARY_ORDER,
CUSTOMER_PO LIKE ZASN_ORDER-CUSTOMER_PO,
PRIMARY_ID LIKE ZASN_ORDER-PRIMARY_ID,
SHIP_TO LIKE ZASN_ORDER-SHIP_TO,
ANZPK(5),
carton type ts_carton,
END OF ts_order.
TYPES: BEGIN OF ts_delivery,
ZSHIPMENT LIKE ZASN_DELIVERY-ZSHIPMENT,
VBELN LIKE ZASN_DELIVERY-VBELN,
AEDAT(8) TYPE C,
AEZET(6) TYPE C,
PRIMARY_CUSTOMER LIKE ZASN_DELIVERY-PRIMARY_CUSTOMER,
BILL_OF_LADING LIKE ZASN_DELIVERY-BILL_OF_LADING,
CARTON_COUNT(5),
TOTAL_WEIGHT(18),
order type ts_order,
END OF ts_delivery.
TYPES: BEGIN OF ts_shipment,
ZSHIPMENT LIKE ZASN_SHIPMENT-ZSHIPMENT,
MANIFEST_DATE_TIME(25),
AEDAT(8) TYPE C,
AEZET(6) TYPE C,
SDATE(8) TYPE C,
STIME(6) TYPE C,
SFACILITY_NUMBER LIKE ZASN_SHIPMENT-SFACILITY_NUMBER,
ZZCARRIERCODE LIKE ZASN_SHIPMENT-ZZCARRIERCODE,
Delivery type ts_delivery,
END OF ts_shipment.
TYPES: BEGIN OF ts_shipment1,
ZSHIPMENT LIKE ZASN_SHIPMENT-ZSHIPMENT,
MANIFEST_DATE_TIME(25),
SFACILITY_NUMBER LIKE ZASN_SHIPMENT-SFACILITY_NUMBER,
ZZCARRIERCODE LIKE ZASN_SHIPMENT-ZZCARRIERCODE,
PRIMARY_CUSTOMER LIKE ZASN_DELIVERY-PRIMARY_CUSTOMER,
BILL_OF_LADING LIKE ZASN_DELIVERY-BILL_OF_LADING,
CARTON_COUNT(5),
TOTAL_WEIGHT(18),
ORDER_NUMBER LIKE ZASN_ORDER-ORDER_NUMBER,
SUB_ORDER LIKE ZASN_ORDER-SUB_ORDER,
ORDER_DATE(8),
PRIMARY_ORDER LIKE ZASN_ORDER-PRIMARY_ORDER,
CUSTOMER_PO LIKE ZASN_ORDER-CUSTOMER_PO,
PRIMARY_ID LIKE ZASN_ORDER-PRIMARY_ID,
SHIP_TO LIKE ZASN_ORDER-SHIP_TO,
CARTON_ID LIKE ZASN_CARTON-CARTON_ID,
SHIP_INDICATOR LIKE ZASN_CARTON-SHIP_INDICATOR,
TRACKING_NUMBER LIKE ZASN_CARTON-TRACKING_NUMBER,
ZZCARTON_WGT(18),
ITEM LIKE ZASN_ITEM-ITEM,
CARTON_LINE_NUM LIKE ZASN_ITEM-CARTON_LINE_NUM,
CARTON_LINE_NUMBER LIKE ZASN_ITEM-CARTON_LINE_NUM,
ITEM_DESCRIPTION LIKE ZASN_ITEM-ITEM_DESCRIPTION,
ORD_QTY(16),
ORIGINAL_SHIP(16),
SHIP_QTY(16),
UPC_NUMBER LIKE ZASN_ITEM-UPC_NUMBER,
DEALER_MEMO_PO(5),
ORDER_LINE_NUM LIKE ZASN_ITEM-ORDER_LINE_NUM,
END OF ts_shipment1.
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
*Typdefinition für Airplus
*READ THE DOCUMENTATION "LASG_XML_INVOICE_BTM"!!!
VARs beginning with "a_" are ATTRIBUTES
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO if_ixml_istream,
l_ostream TYPE REF TO if_ixml_ostream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xml TYPE REF TO cl_xml_document,
l_xmldata TYPE string.
DATA: l_xml_table TYPE TABLE OF t_xml_line,
l_xml_line TYPE t_xml_line,
l_xml_table_size TYPE i.
DATA: l_filename TYPE string.
DATA: xml_out TYPE string ,
size type i.
DATA: l_xml_x1 TYPE xstring.
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce.
l_itab TYPE TABLE OF string.
DATA: BEGIN OF l_itab occurs 0,
data(256) type c,
end of l_itab.
TYPES : BEGIN OF TY_TEXT,
data(255) type C,
END OF TY_TEXT.
DATA: F_XML TYPE STRING.
DATA : LT_TEXT_OUT type table of TY_TEXT with header line.
tables
DATA: it_shipment TYPE STANDARD TABLE OF ts_shipment,
wa_shipment TYPE ts_shipment.
*Errorvariables
DATA: xslt_err TYPE REF TO cx_xslt_exception,
err_string TYPE string.
PARAMETERS: pa_file TYPE localfile OBLIGATORY
DEFAULT 'C:Documents and SettingsC5134126DesktopRajesh_kandakatlaSampleASNFile.xml'.
START-OF-SELECTION.
Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
here we use the CALL TRANSFORMATION method which calls
the XSLT program "z_asnfile"
TRY.
CALL TRANSFORMATION ('Z_ASNFILE')
SOURCE xml LT_TEXT_OUT[]
RESULT xml_output = it_shipment
catch any error, very helpful if the XSLT isn't correct
CATCH cx_xslt_exception INTO xslt_err.
err_string = xslt_err->get_text( ).
WRITE: / 'Transformation error: ', err_string.
EXIT.
ENDTRY." setting a breakpoint to watch the workarea
by the internal table "it_airplus"
break-point.
LOOP AT it_shipment INTO wa_shipment.
ENDLOOP.
*& Form get_xml_table
FORM get_xml_table CHANGING l_xml_table_size TYPE i
l_xml_table TYPE STANDARD TABLE.
l_filename = pa_file.
upload a file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
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.
Convert binary to text.
CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
EXPORTING
INPUT_LENGTH = 70000
FIRST_LINE = 0
LAST_LINE = 0
APPEND_TO_TABLE = ' '
MIMETYPE = ' '
WRAP_LINES = 'X'
IMPORTING
OUTPUT_LENGTH =
TABLES
BINARY_TAB = l_xml_table
TEXT_TAB = LT_TEXT_OUT
EXCEPTIONS
FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "get_xml_table -
Simple Transformation - XML to Internal Table Error
I have a webservice call that returns XML. I need to transform a portion of the response to an internal table, but my simple transformation is not working with loop processing. I have read through most posts regarding the topic but they're either too old or related to serialization. There aren't any exceptions thrown, but I don't get any data in the internal table (PAPERWORK root). Below are some code snippets. Any ideas on the problem with the XSLT template? Thanks.
Sample XML:
<?xml version="1.0" encoding="utf-8" ?>
<PrintVersionDataSet>
<Result>
<ReturnCode>W</ReturnCode>
<ReturnMessage>There are reports with later version(s)</ReturnMessage>
</Result>
<Paperwork>
<ReportCode>CVR</ReportCode>
<ReportName>Cover Sheet</ReportName>
<Version>2</Version>
<PrintedDateTime>2009-05-01T09:54:04.1-05:00</PrintedDateTime>
</Paperwork>
<Paperwork>
<ReportCode>SPS</ReportCode>
<ReportName>Sponsor Summary</ReportName>
<Version>2</Version>
<PrintedDateTime>2009-05-01T09:54:04.99-05:00</PrintedDateTime>
</Paperwork>
</PrintVersionDataSet>
XSLT Code:
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="RESULT"/>
<tt:root name="PAPERWORK"/>
<tt:template>
<PrintVersionDataSet>
<Result tt:ref="RESULT">
<ReturnCode>
<tt:value ref="RETURNCODE"/>
</ReturnCode>
<ReturnMessage>
<tt:value ref="RETURNMESSAGE"/>
</ReturnMessage>
</Result>
<tt:deserialize>
<tt:loop ref=".PAPERWORK">
<Paperwork>
<ReportCode>
<tt:value ref="REPORTCODE"/>
</ReportCode>
<ReportName>
<tt:value ref="REPORTNAME"/>
</ReportName>
<Version>
<tt:value ref="VERSION"/>
</Version>
<PrintedDateTime>
<tt:value ref="PRINTEDDATETIME"/>
</PrintedDateTime>
</Paperwork>
</tt:loop>
</tt:deserialize>
</PrintVersionDataSet>
</tt:template>
</tt:transform>
ABAP Call to Transform Data:
TRY.
CALL TRANSFORMATION Z_GA_PAPERWORK_VERS_WEBSVC
SOURCE XML LS_RESPONSE-VERIFY_PRINT_VERSION_RESULT
RESULT RESULT = LS_RESULT
PAPERWORK = LT_PAPERWORK.
CATCH CX_ROOT INTO ROOT_EXCEPTION.
CALL METHOD ROOT_EXCEPTION->IF_MESSAGE~GET_TEXT
RECEIVING
RESULT = LV_MESSAGE.
ENDTRY.Upon further inspection and testing with a simple file and program, I can see that the XML structure isn't quite correct for the loop process. There needs to be a single <PAPERWORK> node, instead of one for each table line in the file. This should allow the loop to execute properly after a slight adjustment to the XSLT template.
-
Help needed XML to Internal table and vice versa
Hello frnds, I need to convert Internal table to XML and Vice versa.
Now I am able to most of the part except for this...
the xml which I have to generate looks something like this...
- <trade_dt>
- <![CDATA[ 20111108000000:20111108235959
]]>
</trade_dt>
its a range I think
And then the reponse which I get back the XML is like
- <lockinfo>
- <![CDATA[
TRD_HEADER 1045 1 2
ACT_CASHFLOW 1042 1
TRD_TERM 1045 2
]]>
</lockinfo>
Is there any provision in class cl_ixml or class if_ixml_element to handle this part.....
Edited by: Amit Sawant on Dec 28, 2011 3:51 PMHello Amit,
I would suggest you, to use the XSL-Transformations, which can be inbound used in ABAP.
For example:
DATA:
l_xml TYPE string,
lt_flights TYPE TABLE OF SFLIGHT.
SELECT * FROM SFLIGHT INTO TABLE LT_FLIGHT.
CALL TRANSFORMATION id
SOURCE DATA = lt_flights
RESULT XML l_xml.
Now, you have a XML-String which is in the ABAP-XML Notation, which means, that ABAP can move this XML-Data back into an internal table/structure.
For the backward, you have to use the following statement:
CALL TRANSFORMATION id
SOURCE XML l_xml
RESULT DATA = lt_flights.
As you will see, it is very easy. The Transformation "id" is just one example and build in. When you have to transform the data, or do not want to have the ASX-Notation in it, you should at least define your own transformations with the transaction XSLT_TOOL and use it similar to the transformation "id".
Kind Regards,
Hendrik -
Upload XML to internal table and vice versa in SAP 4.6C
Hi,
Happy New Year to you all!
We are using 46C and I am beginning to learn about XML. We have a requirement to (1) upload an XML file into an internal table as well as (2) create an XML file from an internal table.
I read some of the posted messages about this but they didn't seem to be applicable in 46C (I could be wrong).
Could someone please help me using the sample file below?
<?xml version="1.0" ?>
- <AUCTIONBLOCK>
- <ITEM>
<TITLE>Still Life / Onions</TITLE>
<ARTIST>Linda Mann</ARTIST>
<DIMENSIONS>20x30 inches</DIMENSIONS>
<MATERIALS>Oil</MATERIALS>
<YEAR>1997</YEAR>
<DESCRIPTION>Still Life</DESCRIPTION>
<TIMESTAMP>1974</TIMESTAMP>
</ITEM>
</AUCTIONBLOCK>
Many thanks,
RosemarieHi,
Yes I'm on 4.6c. I've to comment several lines. Here is an example:
*& Report z_xit_xml_check
report z_xit_xml_check.
class cl_ixml definition load.
type-pools: ixml.
types: begin of t_xml_line,
data(256) type x,
end of t_xml_line,
begin of tsfixml,
data(1024) type c,
end of tsfixml.
data: l_ixml type ref to if_ixml,
l_streamfactory type ref to if_ixml_stream_factory,
l_parser type ref to if_ixml_parser,
l_istream type ref to if_ixml_istream,
l_document type ref to if_ixml_document,
l_node type ref to if_ixml_node,
l_xmldata type string.
data: l_elem type ref to if_ixml_element,
l_root_node type ref to if_ixml_node,
l_next_node type ref to if_ixml_node,
l_name type string,
l_iterator type ref to if_ixml_node_iterator.
data: l_xml_table type table of t_xml_line,
l_xml_line type t_xml_line,
l_xml_table_size type i.
data: l_filename type string.
parameters: pa_file type char1024 default
'd:joaodesenvolvimentos i act este.xml'.
Validation of XML file: Only DTD included in xml document is supported
parameters: pa_val type char1 as checkbox.
start-of-selection.
Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
Regards,
Maria João Rocha
perform get_xml_table changing l_xml_table_size l_xml_table.
wrap the table containing the file into a stream
l_istream = l_streamfactory->create_istream_itable( table =
l_xml_table
size =
l_xml_table_size ).
Creating a document
l_document = l_ixml->create_document( ).
Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
Validate a document
if pa_val eq 'X'.
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
endif.
Parse the stream
if l_parser->parse( ) ne 0.
if l_parser->num_errors( ) ne 0.
data: parseerror type ref to if_ixml_parse_error,
str type string,
i type i,
count type i,
index type i.
count = l_parser->num_errors( ).
write: count, ' parse errors have occured:'.
index = 0.
while index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
write: 'line: ', i.
i = parseerror->get_column( ).
write: 'column: ', i.
str = parseerror->get_reason( ).
write: str.
index = index + 1.
endwhile.
endif.
endif.
Process the document
if l_parser->is_dom_generating( ) eq 'X'.
perform process_dom using l_document.
endif.
*& Form get_xml_table
form get_xml_table changing l_xml_table_size type i
l_xml_table type standard table.
Local variable declaration
data: l_len type i,
l_len2 type i,
l_tab type tsfixml,
l_content type string,
l_str1 type string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab type table of string.
l_filename = pa_file.
upload a file from the client's workstation
call method cl_gui_frontend_services=>gui_upload
exporting
filename = l_filename
filetype = 'BIN'
importing
filelength = l_xml_table_size
changing
data_tab = l_xml_table
exceptions
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.
Writing the XML document to the screen
CLEAR l_str1.
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data
*replacement = space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
l_str1 = l_str1+0(l_xml_table_size).
SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
WRITE: /.
WRITE: /' XML File'.
WRITE: /.
LOOP AT l_itab INTO l_str1.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab
*IN
l_str1 WITH space.
WRITE: / l_str1.
ENDLOOP.
WRITE: /.
endform. "get_xml_table
*& Form process_dom
form process_dom using document type ref to if_ixml_document.
data: node type ref to if_ixml_node,
iterator type ref to if_ixml_node_iterator,
nodemap type ref to if_ixml_named_node_map,
attr type ref to if_ixml_node,
name type string,
prefix type string,
value type string,
indent type i,
count type i,
index type i.
data: name2 type string,
name_root type string,
node_parent type ref to if_ixml_node,
node_root type ref to if_ixml_node,
num_children type i.
node ?= document.
check not node is initial.
uline.
write: /.
write: /' DOM-TREE'.
write: /.
if node is initial. exit. endif.
create a node iterator
iterator = node->create_iterator( ).
get current node
node = iterator->get_next( ).
loop over all nodes
while not node is initial.
indent = node->get_height( ) * 2.
indent = indent + 20.
num_children = node->num_children( ).
case node->get_type( ).
when if_ixml_node=>co_node_element.
element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
node_root = node->get_root( ).
name_root = node_root->get_name( ).
write: / 'ELEMENT :'.
write: at indent name color col_positive inverse.
write: 'NUM_CHILDREN:', num_children.
write: 'ROOT:', name_root.
node_parent = node->get_parent( ).
name2 = node_parent->get_name( ).
write: 'NAME2: ' , name2.
if not nodemap is initial.
attributes
count = nodemap->get_length( ).
do count times.
index = sy-index - 1.
attr = nodemap->get_item( index ).
name = attr->get_name( ).
prefix = attr->get_namespace_prefix( ).
value = attr->get_value( ).
write: / 'ATTRIBUTE:'.
write: at indent name color col_heading inverse, '=',
value color col_total inverse.
enddo.
endif.
when if_ixml_node=>co_node_text or
if_ixml_node=>co_node_cdata_section.
text node
value = node->get_value( ).
write: / 'VALUE :'.
mjprocha
node_parent = node->get_parent( ).
write: at indent value color col_group inverse.
name2 = node_parent->get_name( ).
write: 'NAME2: ' , name2.
endcase.
advance to next node
node = iterator->get_next( ).
endwhile.
endform. "process_dom -
Xml to internal table using XSLT
hello all,
With the help of Mr. raja I have done with the code but still i have some problem. could any one help me(raja you too).
XLST program code (YSIMPLEXMLTOITAB)
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:output indent="yes"/>
<xsl:template match="QfiData">
<asx:abap xmlns:asx="http://www.sap.com/abapxml">
<asx:values>
<I_DATA>
<xsl:for-each select="Materials">
<I_DATA1>
<MATERIAL>
<xsl:value-of select="Material"/>
</MATERIAL>
<CONDITIONRATE>
<xsl:value-of select="ConditionRate"/>
</CONDITIONRATE>
<VALIDFROM>
<xsl:value-of select="ValidFrom"/>
</VALIDFROM>
<VALIDTO>
<xsl:value-of select="ValidTo"/>
</VALIDTO>
<REGIONID>
<xsl:value-of select="RegionID"/>
</REGIONID>
<MATERIALID>
<xsl:value-of select="MaterialID"/>
</MATERIALID>
</I_DATA1>
</xsl:for-each>
</I_DATA>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:stylesheet>
Program to test it.
REPORT y_test_xml_tran.
TYPES: BEGIN OF i_det,
Material(10),
ConditionRate(16) type p decimals 2 ,
ValidFrom(10) ,
ValidTo(10) ,
RegionID(3) ,
MaterialID(10) ,
end of i_det .
DATA: i_data TYPE TABLE OF i_det.
data: wa like line of i_data .
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"?>`
`<QfiData xmlns:xsl="http://www2.siemens.nl/qfiservice/QfiData.xsd">`
`<Materials>`
`<Material>463581</Material>`
`<ConditionRate> 2.44</ConditionRate>`
`<ValidFrom>20060208</ValidFrom>`
`<ValidTo>99991231</ValidTo>`
`<RegionID>48</RegionID>`
`<MaterialID>36294</MaterialID>`
`</Materials>`
`<Materials>`
`<Material>463582</Material>`
`<ConditionRate> 2.44</ConditionRate>`
`<ValidFrom>20060208</ValidFrom>`
`<ValidTo>99991231</ValidTo>`
`<RegionID>48</RegionID>`
`<MaterialID>36295</MaterialID>`
`</Materials>`
`</QfiData>`
INTO xml_string .
TRY .
CALL TRANSFORMATION (`YSIMPLEXMLTOITAB`)
SOURCE XML xml_string
RESULT i_data = i_data.
CATCH cx_xslt_exception INTO xslt_error.
xslt_message = xslt_error->get_text( ).
ENDTRY.
the error i am getting is:
Error message : ABAP XML formatting error in XML node of type "element", name: "abap"Can you tell how did you solve ?
-
Use Internal table in WebDynpro ABAP.
Hi,
I am using a internal table, for calling a FM, which require Internal table as its parameter. Since Internal table with header line is not supported in ABAP OO. How to attain this.
Thanq For Ur time.
Cheers,
SamHi Sam,
If we want to use an internal table for the FM as input then we can declare a table and use it.
But when we want use it as a workarea we need to define a work area (another attribute) of a internal table saparatly and use it.
Best regards,
Suresh -
Transforming XML into Internal Table
Hi guys, I have tried a simple nested code but i fail to write in the Name, Phone and Email portion ... I manage to get to the header level... Can any one gimme some pointers?
PS: I have read to those threads posted here already before I got this far
<b><u>MAIN CODE</u></b>
REPORT ZTESTJASON11.
TYPES: BEGIN OF T_HEADER,
NAME(140),
PHONE(23),
EMAIL(100),
END OF T_HEADER,
D_HEADER TYPE T_HEADER OCCURS 0.
TYPES: BEGIN OF T_ITEM,
HEADER TYPE D_HEADER,
END OF T_ITEM,
D_ITEM TYPE T_ITEM OCCURS 0.
TYPES: BEGIN OF T_LIST,
ITEM TYPE D_ITEM,
END OF T_LIST,
D_LIST TYPE T_LIST OCCURS 0.
TYPES: BEGIN OF TYPE_DATA,
LIST TYPE D_LIST,
END OF TYPE_DATA.
DATA: RESPONSE TYPE TABLE OF TYPE_DATA.
DATA: XMLOUT TYPE STRING.
DATA: ITAB LIKE SOLI OCCURS 0 WITH HEADER LINE.
DATA: HEADER_WA TYPE T_HEADER,
HEADER_LN TYPE D_HEADER,
ITEM_WA TYPE T_ITEM,
ITEM_LN TYPE D_ITEM,
LIST_WA TYPE T_LIST,
LIST_LN TYPE D_LIST.
MOVE: 'JIM BEAN' TO HEADER_WA-NAME,
'+6512345678' TO HEADER_WA-PHONE,
'[email protected]' TO HEADER_WA-EMAIL.
APPEND HEADER_WA TO HEADER_LN.
ITEM_WA-HEADER = HEADER_LN.
APPEND ITEM_WA TO ITEM_LN.
LIST_WA-ITEM = ITEM_LN.
APPEND LIST_WA TO LIST_LN.
myXML-LIST = LIST_LN.
PERFORM UPLOAD_XML.
FORM UPLOAD_XML .
REFRESH ITAB.
clear RESPONSE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:test11.XML'
filetype = 'BIN'
TABLES
data_tab = ITAB.
LOOP AT ITAB.
CONCATENATE XMLOUT ITAB-LINE INTO XMLOUT.
ENDLOOP.
CALL TRANSFORMATION ('ZTEST11X2A')
SOURCE XML XMLOUT
RESULT RESPONSE = RESPONSE.
BREAK-POINT.
ENDFORM.
<b><u>XML CODE (test11.xml)</u></b>
<?xml version="1.0" encoding="iso-8859-1"?>
<myXML>
<LIST>
<ITEM>
<HEADER>
<NAME>JIM BEAN</NAME>
<PHONE>+6512345678</PHONE>
<EMAIL>[email protected]</EMAIL>
</HEADER>
</ITEM>
</LIST>
</myXML>
<b><u>XSLT CODE (ZTEST11X2A)</u></b>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sap="http://www.sap.com/abapxml"
>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml">
<asx:values>
<RESPONSE>
<myXML>
<LIST>
<ITEM>
<xsl:for-each select="ITEM">
<I>
<HEADER>
<NAME> <xsl:value-of select="NAME"/> </NAME>
<PHONE> <xsl:value-of select="PHONE"/> </PHONE>
<EMAIL> <xsl:value-of select="EMAIL"/> </EMAIL>
</HEADER>
</I>
</xsl:for-each>
</ITEM>
</LIST>
</myXML>
</RESPONSE>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>Thanks a million in advance Raja, thanks for ur help, realli appreaciate it! ")
Here it is...
<u><b>MAIN CODE (itab declaration)</b></u>
REPORT ZTESTJASON11.
TYPES: BEGIN OF T_HEADER,
NAME(140),
PHONE(23),
EMAIL(100),
END OF T_HEADER,
D_HEADER TYPE T_HEADER OCCURS 0.
TYPES: BEGIN OF T_ITEM,
HEADER TYPE D_HEADER,
END OF T_ITEM,
D_ITEM TYPE T_ITEM OCCURS 0.
TYPES: BEGIN OF T_LIST,
ITEM TYPE D_ITEM,
END OF T_LIST,
D_LIST TYPE T_LIST OCCURS 0.
TYPES: BEGIN OF TYPE_DATA,
LIST TYPE D_LIST,
END OF TYPE_DATA.
DATA: RESPONSE TYPE TABLE OF TYPE_DATA.
DATA: XMLOUT TYPE STRING.
DATA: ITAB LIKE SOLI OCCURS 0 WITH HEADER LINE.
DATA: HEADER_WA TYPE T_HEADER,
HEADER_LN TYPE D_HEADER,
ITEM_WA TYPE T_ITEM,
ITEM_LN TYPE D_ITEM,
LIST_WA TYPE T_LIST,
LIST_LN TYPE D_LIST.
MOVE: 'JIM BEAN' TO HEADER_WA-NAME,
'+6512345678' TO HEADER_WA-PHONE,
'[email protected]' TO HEADER_WA-EMAIL.
APPEND HEADER_WA TO HEADER_LN.
ITEM_WA-HEADER = HEADER_LN.
APPEND ITEM_WA TO ITEM_LN.
LIST_WA-ITEM = ITEM_LN.
APPEND LIST_WA TO LIST_LN.
myXML-LIST = LIST_LN.
PERFORM UPLOAD_XML.
FORM UPLOAD_XML .
REFRESH ITAB.
clear RESPONSE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:test11.XML'
filetype = 'BIN'
TABLES
data_tab = ITAB.
LOOP AT ITAB.
CONCATENATE XMLOUT ITAB-LINE INTO XMLOUT.
ENDLOOP.
CALL TRANSFORMATION ('ZTEST11X2A')
SOURCE XML XMLOUT
RESULT RESPONSE = RESPONSE.
BREAK-POINT.
ENDFORM.
<u><b>XML CODE (test11.xml)</b></u>
<?xml version="1.0" encoding="iso-8859-1"?>
<myXML>
<LIST>
<ITEM>
<HEADER>
<NAME>JIM BEAN</NAME>
<PHONE>+6512345678</PHONE>
<EMAIL>[email protected]</EMAIL>
</HEADER>
</ITEM>
</LIST>
</myXML>
<u><b>XSLT CODE (ZTEST11X2A)</b></u>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sap="http://www.sap.com/abapxml"
>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml">
<asx:values>
<RESPONSE>
<myXML>
<LIST>
<ITEM>
<xsl:for-each select="ITEM">
<dataset1>
<HEADER>
<xsl:for-each select="HEADER">
<dataset2>
<NAME>
<xsl:value-of select="NAME"/>
</NAME>
<PHONE>
<xsl:value-of select="PHONE"/>
</PHONE>
<EMAIL>
<xsl:value-of select="EMAIL"/>
</EMAIL>
</dataset2>
</xsl:for-each>
</HEADER>
</dataset1>
</xsl:for-each>
</ITEM>
</LIST>
</myXML>
</RESPONSE>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>
Maybe you are looking for
-
Hello, I am fairly new the Java Concurrent Programs concept. I was just trying a simple Hello World example but I cannot seem to run it from the operating system. Here is my Hello World java program I created using Jdeveloper: package oracle.apps.fnd
-
Hi, Any ideas? Dual 500Mhz Powermac G4 OS 10.4.11 1GB SDRAM I have a folder of Excel spreadsheets - being self-employed they are invoices, mostly single pages. All worked okay for several years until I upgraded to Microsoft's Office:Mac 2008. Now the
-
Problems with installing firefox
When I try to install firefox my computer keeps freezing up just about when its done installing. I am running windows 7.
-
PLS HELP!! DELL DIMENSION L866r
I am having some problem with Solaris 8 installation over dell computer. I have Intel 810 chipset on the motherboard. I need the video driver for onboard video. First I install the O.S. it didnt find the right video driver. I Select VGA or text mode
-
How can I stop disc images from popping up when connecting a drive?
Hello, I have an external hard drive with several partitions, all formatted as Mac OS Extended. Two of the partitions are disc images of the install CD's for Drive Genius and Data Rescue from Prosoft Engineering. When I connect the drive using a FW80