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. How to do that is described in this help.sap.com link (scroll down to Installation and Upgrade Information, and apply notes for Foundation Component ARBFNDI1 and 2 as applicable to your ERP release level, and the note for SAP ERP Integration Component ARBERPI1).
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 and 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 , but not the first two lines
andhttps://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
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 , 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).
Bonne chance!
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]
08:00″>
<Credential
domain=”NetworkID”>
AN02000277438
<Credential
domain=”VendorID”>9010<Credential
domain=”PrivateID”>9010
<Credential
domain=”NetworkID”>
AN02000277436
AN01000000001
SCMSupplier
deploymentMode=”production”>
08:00″
invoiceID=”INV025775″ invoiceOrigin=”supplier” operation=”new”
purpose=”standard”><Contact
role=”remitTo”><Name
xml:lang=”en”>9010 LOB Nala
Supplier1PO12129PittsburgP
A15222<Country
isoCountryCode=”US”>United
States<Contact
role=”billTo”><Name
xml:lang=”en”>BestRun USA<PostalAddress
name=”IDES
US INC”>1230 Lincoln AvenueNEW
YORKNY10019<Country
isoCountryCode=”US”/><CountryCode
isoCountryCode=”US”>1 212-345-
0983<CountryCode
isoCountryCode=”US”>1 212-345-
5693<Contact
role=”from”><Name
xml:lang=”en”>9010 LOB Nala
Supplier1.New
YorkNY10021<Country
isoCountryCode=”US”>United
States<Contact
role=”billFrom”><Name
xml:lang=”en”>9010 LOB Nala
Supplier1.New
YorkNY10021<Country
isoCountryCode=”US”>United
States<Contact
role=”soldTo”><Name
xml:lang=”en”>LOB NALA
BUYER2PO12129PittsburgPA</
State>15222<Country
isoCountryCode=”US”>United
States<Contact
role=”shipFrom”><Name
xml:lang=”en”>9010 LOB Nala
Supplier1PO12129PittsburgP
A15222<Country
isoCountryCode=”US”>United
States<Contact
addressID=”3200″ role=”shipTo”><Name
xml:lang=”en”>Atlanta<PostalAddress
name=”default”>867 1 300 Peach tree
street SouthATLANTAGA30310<Country
isoCountryCode=”US”/><CountryCode
isoCountryCode=”US”>1040-22707-
0<CountryCode
isoCountryCode=”US”>1040-22707-
101<PaymentTerm
payInNumberOfDays=”14″><DiscountPercent
percent=”3.000″/><PaymentTerm
payInNumberOfDays=”30″><DiscountPercent
percent=”2.000″/><PaymentTerm
payInNumberOfDays=”45″><DiscountPercent
percent=”0.00″/><Extrinsic
name=”invoiceSourceDocument”>PurchaseOrder
name=”invoiceSubmissionMethod”>Online
payloadID=”005056834D3E1ED5A1FBD5C2FFD76286″><Invo
iceDetailServiceItem invoiceLineNumber=”1″ quantity=”100″>
lineNumber=”1000200010″>Gardening
Servies
10T12:43:16-08:00″ serviceEntryID=”SES25775″ serviceLineNumber=”1″>
currency=”USD”>1700HUR
currency=”USD”>17
currency=”USD”>1700
currency=”USD”>1700<Su
btotalAmount>1700
currency=”USD”>0.00
percentageRate=”0″>1700
currency=”USD”>0.00NALA LOB
Exempt
currency=”USD”>1700
currency=”USD”>1700
currency=”USD”>1700
New NetWeaver Information at SAP.com
Very Helpfull