Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

XML file with Header

singhtushar
Discoverer
0 Likes
1,644

Hello,

I have to create an XML output file with multiple header lines in ABAP. Below is the detailed requirement.

Standard header generated in XSLT transformation is giving this line- <?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>

But I have to add an additional header line like below along with the standard header

<?xmlversion="1.0" encoding="utf-8"?><wm1:PayStubLoad xmlns:wm1="XXXXXXXXXX"
                 wm1:numberRecords="000000182"
                 wm1:fileDateTime="2021-06-04T00:37:12.900Z"
                 wm1:fileToken="XXXXXXXXX"
                 wm1:employerCode="XXXX"
                 xmlns:xsi="XXXXXXX"
                 xsi:schemaLocation="XXXXXXXXXXXXXXXXXX"> 
<PayStub wm1:forgotPINPostalCode="XXXX"
             wm1:employeeDefaultPIN="XXXX"
             wm1:payPeriodEndDate="XXXXX"
             wm1:payPeriodStartDate="XXXXX"
             wm1:payStubAccessibleDate="XXXXX"
             wm1:payDate="XXXXX"
             wm1:adviceNumber="XXXXX"
             wm1:employeeCode="XXXXXX" /></wm1:PayStubLoad>

Could you please help how can we achieve this.

Thanks & Regards,

Srilekha

3 REPLIES 3
Read only

Sandra_Rossi
Active Contributor
1,454

Please edit your question, select your XML code and press the "CODE" button to make it correctly colorized/indented, so that it's easier for us to analyze it. Thank you.

<?xml version="1.0" encoding="utf-8"?>
<wm1:PayStubLoad xmlns:wm1="XXXXXXXXXX"
                 wm1:numberRecords="000000182"
                 wm1:fileDateTime="2021-06-04T00:37:12.900Z"
                 wm1:fileToken="XXXXXXXXX"
                 wm1:employerCode="XXXX"
                 xmlns:xsi="XXXXXXX"
                 xsi:schemaLocation="XXXXXXXXXXXXXXXXXX"> 
    <PayStub wm1:forgotPINPostalCode="XXXX"
             wm1:employeeDefaultPIN="XXXX"
             wm1:payPeriodEndDate="XXXXX"
             wm1:payPeriodStartDate="XXXXX"
             wm1:payStubAccessibleDate="XXXXX"
             wm1:payDate="XXXXX"
             wm1:adviceNumber="XXXXX"
             wm1:employeeCode="XXXXXX" />
</wm1:PayStubLoad>
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,454

I think you could follow a tutorial to create the simplest XSLT transformation and after that tell us what is your issue, and show your code.

Read only

singhtushar
Discoverer
0 Likes
1,454

Thanks Sandra.

I have created an XSLT transformation and was able to achieve the below output.

But my question is how to achieve multiple header tags as in below.

<?xml version="1.0" encoding="utf-8"?> <wm1:PayStubLoad xmlns:wm1="XXXXXXXXXX" wm1:numberRecords="000000182" wm1:fileDateTime="2021-06-04T00:37:12.900Z" wm1:fileToken="XXXXXXXXX" wm1:employerCode="XXXX" xmlns:xsi="XXXXXXX" xsi:schemaLocation="XXXXXXXXXXXXXXXXXX">

This is the user expected format from SAP.

Regards,

Srilekha.