Thursday, December 20, 2007

XML XSLT with ABAP

Create ABAP coding

At first we create the internal table TYPES and DATA definition, we want to fill with the XML data. I have declared the table "it_airplus" like the structure from XML file definition for a better overview, because it is a long XML Definition (see the XSD file in the sample ZIP container by airplus.com)

*the declaration
TYPES: BEGIN OF t_sum_vat_sum,
a_rate(5),
net_value(15),
vat_value(15),
END OF t_sum_vat_sum.

TYPES: BEGIN OF t_sum_total_sale,
a_currency(3),
net_total(15),
vat_total(15),
vat_sum TYPE REF TO t_sum_vat_sum,
END OF t_sum_total_sale.

TYPES: BEGIN OF t_sum_total_bill,
net_total(15),
vat_total(15),
vat_sum TYPE t_sum_vat_sum,
add_ins_val(15),
total_bill_amount(15),
END OF t_sum_total_bill.TYPES: BEGIN OF t_ap_summary,
a_num_inv_det(5),
total_sale_values TYPE t_sum_total_sale,
total_bill_values TYPE t_sum_total_bill,
END OF t_ap_summary.TYPES: BEGIN OF t_ap,
head TYPE t_ap_head,
details TYPE t_ap_details,
summary TYPE t_ap_summary,
END OF t_ap.DATA: it_airplus TYPE STANDARD TABLE OF t_ap
...
...
*call the transformation
CALL TRANSFORMATION ZFI_AIRPLUS
SOURCE xml l_xml_x1
RESULT xml_output = it_airplus
.

see the complete report: Read data from XML file via XSLT program

No comments:

Blog Archive