Sei sulla pagina 1di 10

KM: How To Series

Convergent Invoicing in SAP


Version 1.0

Dibya Ranjan Pradhan Surya Chaganti

How To Series

Table of Contents

Contents
Background......................................................................................................3 Business Requirement:.................................................................................3 Define output type for XML format and use translation tool to generate XML from ABAP data type.....................................................................................3 Prerequisites....................................................................................................3 System Requirements:..................................................................................3 SAP Configuration:........................................................................................3 Process Flow.....................................................................................................4 Billing output in XML format through transaction VF01/VF02/VF03/VF31.........4 Sample Development.......................................................................................4 Expected Outcome...........................................................................................8 FAQs................................................................................................................9

FAQs

Billing output in XML format (ABAP to XML) Dibya Pradhan, Rahul Kadukar, Deloitte, R10

Page 2

How To Series
Background
Business Requirement: The Business requires to issue billing output in XML format. Based on the output types defined in the system we can issue billing output as print output, FAX, email and EDI. When billing run (VF31) is done client may require billing output in PDF/XML format. Define output type for XML format and use translation tool to generate XML from ABAP data type. This document will cover the creation transformation using transaction STRANS/XSLT_TOOL. This document also contains details about defining output type in NACE for XML output.

Prerequisites
System Requirements: SAP ECC 6.0 System ABAP Developer access. SAP Configuration: Output type for XML output needs to be defined in NACE for application billing (V3). Assign driver program for medium Print output and Form routine Entry.

Billing output in XML format (ABAP to XML) Dibya Pradhan, Rahul Kadukar, Deloitte, R10

Page 3

How To Series

Billing output in XML format (ABAP to XML) Dibya Pradhan, Rahul Kadukar, Deloitte, R10

Page 4

How To Series
Process Flow
Billing output in XML format through transaction VF01/VF02/VF03/VF31

Sample Development
Development activities The following development activities are needed:

1. Create a structure to hold all invoice data. E.g. structure with a header
invoice structure and deep invoice item structure.

2. Create a transformation using the custom structure created above. 3. Create a driver program to fetch and populate invoice details to the custom 4. Assign driver program to the output type for XML in NACE.
Billing output in XML format (ABAP to XML) Dibya Pradhan, Rahul Kadukar, Deloitte, R10

structure. Call transformation and generate XML.

Page 5

How To Series
Detailed Technical Approach: 1. Create a structure to hold all invoice data.

1. Create structures to hold invoice header and item data.

Billing output in XML format (ABAP to XML) Dibya Pradhan, Rahul Kadukar, Deloitte, R10

Page 6

How To Series
2. Create a transformation using the custom structure created above.

1. Create

transformation in XSLT_TOOL/STRANS. Go to XSLT_TOOL/STRANS. Give transformation name and select create. Give description of the transformation and select transformation type Simple Transformation.

2. Use wizard to create XML lines for the transformation. Select wizard
from the tool bar.

3. Select the root node, right click and insert new root.

Billing output in XML format (ABAP to XML) Dibya Pradhan, Rahul Kadukar, Deloitte, R10

Page 7

How To Series

4. Drag the node INVOICE from the root node and drop in the Sample
transformation window.

5. Save and go back. XML source code is created in the editor. Now
change the <TagName> as per requirement. Select Pretty Printer, save and activate the transformation.

3. Create a driver program to fetch and populate invoice details to the custom structure. Call transformation and generate XML.

Billing output in XML format (ABAP to XML) Dibya Pradhan, Rahul Kadukar, Deloitte, R10

Page 8

How To Series
1. In the driver program call the transformation exporting structure with
all required invoice details.

2. Code can be written to download the XML string on the specified


location or to preview the XML. To preview XML function module SCOL_TRACE_SHOW_XML can be used. 4. Assign driver program to the output type for XML in NACE.

1. Create an output type for XML in NACE. Define driver program to the
output type.

Expected Outcome
Once above development is complete:

1. To generate invoice output in XML format, execute billing run (VF31) with XML
output type.

2. XML is downloaded or previewed online.

Billing output in XML format (ABAP to XML) Dibya Pradhan, Rahul Kadukar, Deloitte, R10

Page 9

How To Series

FAQs 1. How to add new fields to the XML?


Define the field in the structure. Populate the field in the driver program. In the transformation drag the field. Define <TAG> for the field. Select pretty printer and activate the transformation.

2. How to handle UTF-8/UTF-16 XML format.


For UTF-8encoding use data type XSTRING to collect XML file. For UTF-16 encoding use data type string to collect XML file.

Billing output in XML format (ABAP to XML) Dibya Pradhan, Rahul Kadukar, Deloitte, R10

Page 10