Testing Ariba Network integration cXML with SAP ERP MM

As you are integrating your SAP ERP MM with the Ariba Network to digitize and automate your purchase order to invoice and payment processes in collaboration with your suppliers, you will at some point in time have to test proper processing of cXML messages such as invoices coming in from your suppliers on the Ariba Network. Well, before you go about real data from your real suppliers, you may want to test with some dummy supplier on the network.

In case you are using the Ariba Network integration for SAP Business Suite rapid-deployment solution or RDS for short, which I recommend, because it’s my “baby” and it’s good for you, you are already familiar with testing and validating your configurations. As long as you strictly stick to the scope of the RDS you would probably not even need to get into this test guide. But if you were to go beyond, and do something as “daring” as implement one of the Business Add-Ins (or BAdI for short, even though they are also goodies for you, for sure), you’d want to see how the data coming in with the cXML message are going to be processed in your ERP system. Alright. Do something daring today. Implement a BAdI.

This test guide shall lead you through the respective testing procedure. It is provided with best knowledge and intent, based on SAP–internal development and test landscapes. Customizations in your landscapes may be different and will have to be adapted accordingly.

Preconditions for this test to work
All you need at this point are:

  • A test account as a supplier (sic) on the Ariba Network (ask your Ariba AE or support contact to provide you with one, or just use the attached cXML template and test data files)
  • An SAP ERP system, at least at ECC 6.0, with the Ariba Network Integration for SAP Business Suite Add-On 1.0 installed.

Obtaining a cXML File from an Ariba Supplier

Buyers who correspond with their suppliers using the Ariba Network can obtain cXML files of the invoices the suppliers send them. The supplier needs to log on to his Ariba account, go to one of the last invoices sent and export the cXML file. The cXML downloads as a text file.

Figure 1 Ariba Network – Supplier View of an Invoice

Figure 2 cXML downloads as text file

Figure 3 cXML Text File Sample

For your convenience, a sample xml text is copied below at XML Sample, and I attached a template and my own test data file for you.

Using cXML File in SAP ERP

In the SAP ERP system, use transaction SPROXY.

Select the Enterprise Services Browser and find package ARBFND1_PRX. (If you can’t find that package for the heck of it, the add-on has not yet been installed. Get your basis team to install that for you following the instructions mentioned above at “Preconditions”.)

Figure 4 SPROXY – Enterprise Service Browser – ARBFND1_PRX

Doubleclick on Object cXMLInvoiceDetailRequest_In to obtain the object details displayed in figure 4 on the right hand side.

With the cursor still on object cXMLInvoiceDetailRequest_In start the test with function key F8. A popup window appears which you just need to confirm.

Figure 5 – Popup Window creating request template – just confirm

Figure 6 – XML Request Template – use button “XML Editor” or (Ctrl+F2)

In the request template, you need to replace the message type “String 1” with “InvoiceDetailRequest”, and replace everything between <cXML> and </cXMLMessageContent> with the respective content from your cXML file (in the attached zip). In order to do that, you first need to open the cXML Editor using keys Ctrl+F2. For practical purposes, we shall assume it is indeed the InvoiceDetailRequest that you are planning on testing.

From the cXML test file (below and attached), copy only the text in between <cXML payloadID … and </Request></cXML>, but not the first two lines

<?xml version=”1.0″encoding=”UTF-8″?> and <!DOCTYPE cXML SYSTEM “http://xml.cxml.org/schemas/cXML/1.2.028/InvoiceDetail.dtd“>.

Figure 7 – Insert the content from the cXML file into the Test Service Provider editor

Use the XML checker (function key F9) to ensure a well-formed XML. The checker will return with errors that are easy to solve.

Figure 8 – The checker will throw errors which are easy to solve

Confirm the error, and see in which line the checker highlights the issue. Most likely, the text file has separated strings that belong together for the XML parser to recognize. Just mend those lines by rejoining loose ends. Here are some examples:

Figure 9 – XML parser found an open bracket and threw an error

In Figure 9, the highlight in line 88 and the position of the cursor show where the parser stumbled. Apparently, the bracket was not closed. You can easily fix that. Position the cursor after PA</ and delete the trailing white space.

Figure 10 – Once the white space is eliminated, test again

Once the white space is eliminated, test again, until no further issues occur and the checker confirms “XML is well-formed”.

Here some more samples for errors and how the fix looks.

Figure 11 – Parser throws “Error while parsing an XML stream: ”=’ expected’.”

Here you’ve got to fix the connection of the open bracket at the end of line 122. See Figure 12 below.

Figure 12 – Line 122 had an open bracket. Close it by deleting trailing white space of line 122

Figure 13 – Again a trailing white space issue in line 138 …

Figure 14 – … easily fixed by eliminating white space

Once the checker confirms “XML is well-formed”, you can go on and test the request.

Test the Request

Press Execute button or use function key F8.

A Response tab will open and likely show some error due to missing customer-specific configuration.

Figure 15 – The Response tab shows errors, mostly due to missing configuration

Typical errors related to missing configuration are identified as

  • 028(ARBERP_MAP “No company code assigned to NetworkID in Customizing”, or
  • 122(ARBERP_MAP), “No company code could be determined for partner name [partner name] sent by vendor”.

Basic Customer-specific Settings

In order to eliminate message 028, assign a company code to the network ID in customizing.

In transaction SPRO, open the SAP Reference IMG (F5) and follow this path of the SAP Customizing Implementation Guide:

Integration with Other SAP Components > SAP Business Suite Integration Component for Ariba > Application-Specific Settings > SAP ERP Integration Component for Ariba > Assign Ariba Network ID to Company Code. Enter the network ID from your cXML file introduced by brackets <To> <Credential domain=”NetworkID”> <Identity>, e.g. “AN02000277436” and assign a valid company code.

Figure 16 – Customizing for Ariba Network ID and Company Code

Retest the Request. You may have to restart the test by returning to transaction SPROXY. Download your XML file and reload it as you restart the test.

Breakpoint for Customer BAdI

In transaction se80, you can set a breakpoint in class CL_ARBERP_MAP_IN, METHOD: IF_ARBFND_APPL_IN~EXECUTE_APPLICATION_INBOUND, at “me->call_define_cust_spec_pro_badi”.

Or you set a breakpoint in class CL_ARBERP_MAP_IN, method CALL_DEFINE_CUST_SPEC_PRO_BADI.

In order to implement the BAdI method for processing Invoices, consider methods DEFINE_CUST_SPEC_PROCESSING and MAP_INVC_TO_BUS2081_IN_PRE.

Implement the BAdI from the IMG (Figure 16).

This concludes the test procedure. Please let me know your results, and suggestions for improvement.

XML Sample
[This sample was taken from a test supplier on the Ariba Network and represents a test invoice for services]

<cXML payloadID=”1447188553507-8319620044300512987@216.109.98.100″ timestamp=”2015-11-10T12:49:13-

08:00″><Header>

<From>

<Credential

domain=”NetworkID”>

<Identity>AN02000277438</Identity>

</Credential>

<Credential

domain=”VendorID”><Identity>9010</Identity></Credential><Credential

domain=”PrivateID”><Identity>9010</Identity></Credential></From>

<To>

<Credential

domain=”NetworkID”>

<Identity>AN02000277436</Identity>

</Credential>

</To>

<Sender>

<Credential domain=”NetworkID”>

<Identity>AN01000000001</Identity>

</Credential>

<UserAgent>SCMSupplier</UserAgent>

</Sender>

</Header>

<Request

deploymentMode=”production”><InvoiceDetailRequest><InvoiceDetailRequestHeader invoiceDate=”2015-11-10T12:49:13-

08:00″

invoiceID=”INV025775″ invoiceOrigin=”supplier” operation=”new”

purpose=”standard”><InvoiceDetailHeaderIndicator/><InvoiceDetailLineIndicator/><InvoicePartner><Contact

role=”remitTo”><Name

xml:lang=”en”>9010 LOB Nala

Supplier1</Name><PostalAddress><Street>PO12129</Street><Street/><Street/><Street/><City>Pittsburg</City><State>P

A</State><PostalCode>15222</PostalCode><Country

isoCountryCode=”US”>United

States</Country></PostalAddress></Contact></InvoicePartner><InvoicePartner><Contact

role=”billTo”><Name

xml:lang=”en”>BestRun USA</Name><PostalAddress

name=”IDES

US INC”><Street>1230 Lincoln Avenue</Street><City>NEW

YORK</City><State>NY</State><PostalCode>10019</PostalCode><Country

isoCountryCode=”US”/></PostalAddress><Phone><TelephoneNumber><CountryCode

isoCountryCode=”US”>1</CountryCode><AreaOrCityCode> </AreaOrCityCode><Number>212-345-

0983</Number></TelephoneNumber></Phone><Fax><TelephoneNumber><CountryCode

isoCountryCode=”US”>1</CountryCode><AreaOrCityCode> </AreaOrCityCode><Number>212-345-

5693</Number></TelephoneNumber></Fax></Contact></InvoicePartner><InvoicePartner><Contact

role=”from”><Name

xml:lang=”en”>9010 LOB Nala

Supplier1</Name><PostalAddress><Street>.</Street><Street/><Street/><Street/><City>New

York</City><State>NY</State><PostalCode>10021</PostalCode><Country

isoCountryCode=”US”>United

States</Country></PostalAddress></Contact></InvoicePartner><InvoicePartner><Contact

role=”billFrom”><Name

xml:lang=”en”>9010 LOB Nala

Supplier1</Name><PostalAddress><Street>.</Street><Street/><Street/><Street/><City>New

York</City><State>NY</State><PostalCode>10021</PostalCode><Country

isoCountryCode=”US”>United

States</Country></PostalAddress></Contact></InvoicePartner><InvoicePartner><Contact

role=”soldTo”><Name

xml:lang=”en”>LOB NALA

BUYER2</Name><PostalAddress><Street>PO12129</Street><Street/><Street/><Street/><City>Pittsburg</City><State>PA</

State><PostalCode>15222</PostalCode><Country

isoCountryCode=”US”>United

States</Country></PostalAddress></Contact></InvoicePartner><InvoiceDetailShipping><Contact

role=”shipFrom”><Name

xml:lang=”en”>9010 LOB Nala

Supplier1</Name><PostalAddress><Street>PO12129</Street><Street/><Street/><Street/><City>Pittsburg</City><State>P

A</State><PostalCode>15222</PostalCode><Country

isoCountryCode=”US”>United

States</Country></PostalAddress></Contact><Contact

addressID=”3200″ role=”shipTo”><Name

xml:lang=”en”>Atlanta</Name><PostalAddress

name=”default”><Street>867 1 300 Peach tree

street South</Street><City>ATLANTA</City><State>GA</State><PostalCode>30310</PostalCode><Country

isoCountryCode=”US”/></PostalAddress><Phone><TelephoneNumber><CountryCode

isoCountryCode=”US”>1</CountryCode><AreaOrCityCode/><Number>040-22707-

0</Number></TelephoneNumber></Phone><Fax><TelephoneNumber><CountryCode

isoCountryCode=”US”>1</CountryCode><AreaOrCityCode/><Number>040-22707-

101</Number></TelephoneNumber></Fax></Contact></InvoiceDetailShipping><PaymentTerm

payInNumberOfDays=”14″><Discount><DiscountPercent

percent=”3.000″/></Discount></PaymentTerm><PaymentTerm

payInNumberOfDays=”30″><Discount><DiscountPercent

percent=”2.000″/></Discount></PaymentTerm><PaymentTerm

payInNumberOfDays=”45″><Discount><DiscountPercent

percent=”0.00″/></Discount></PaymentTerm><Extrinsic

name=”invoiceSourceDocument”>PurchaseOrder</Extrinsic><Extrinsic

name=”invoiceSubmissionMethod”>Online</Extrinsic></InvoiceDetailRequestHeader>

<InvoiceDetailOrder><InvoiceDetailOrderInfo><OrderReference orderID=”4500025775″><DocumentReference

payloadID=”005056834D3E1ED5A1FBD5C2FFD76286″></DocumentReference></OrderReference></InvoiceDetailOrderInfo><Invo

iceDetailServiceItem invoiceLineNumber=”1″ quantity=”100″><InvoiceDetailServiceItemReference

lineNumber=”1000200010″><Description xml:lang=”en”>Gardening

Servies</Description></InvoiceDetailServiceItemReference><ServiceEntryItemReference serviceEntryDate=”2015-11-

10T12:43:16-08:00″ serviceEntryID=”SES25775″ serviceLineNumber=”1″><DocumentReference payloadID=”1447188196796-

2025126069885812817@216.109.98.100″></DocumentReference></ServiceEntryItemReference><SubtotalAmount><Money

currency=”USD”>1700</Money></SubtotalAmount><UnitOfMeasure>HUR</UnitOfMeasure><UnitPrice><Money

currency=”USD”>17</Money></UnitPrice><GrossAmount><Money

currency=”USD”>1700</Money></GrossAmount><NetAmount><Money

currency=”USD”>1700</Money></NetAmount></InvoiceDetailServiceItem></InvoiceDetailOrder><InvoiceDetailSummary><Su

btotalAmount><Money currency=”USD”>1700</Money></SubtotalAmount><Tax><Money

currency=”USD”>0.00</Money><Description xml:lang=”en”></Description><TaxDetail category=”Tax Exempt”

percentageRate=”0″><TaxableAmount><Money currency=”USD”>1700</Money></TaxableAmount><TaxAmount><Money

currency=”USD”>0.00</Money></TaxAmount><Description xml:lang=”en”>NALA LOB

Exempt</Description></TaxDetail></Tax><GrossAmount><Money

currency=”USD”>1700</Money></GrossAmount><NetAmount><Money

currency=”USD”>1700</Money></NetAmount><DueAmount><Money

currency=”USD”>1700</Money></DueAmount></InvoiceDetailSummary></InvoiceDetailRequest>

</Request>

</cXML>

Leave a Reply

Your email address will not be published. Required fields are marked *