Skip to Content

My part 2 of this blog will continue on how to use a Custom Data Source in C4C – specifically loading data by a SAP standard web service.

We will actually send a payload using the AnalyticsDataUpload webservice to update our Custom Data Source (CDS).  If you remember in Part 1, last time we walked through setting up a communication system and arrangement and then exporting the WSDL.

We will use a tool to demonstrate how to use the webservice.  It’s called soapUI, and it’s open source software (aka free !)   There is a paid version, if you feel you need a lot of features and support.  I recommend soapUI version 5.0.0.  (the free version, of course).

  1. First, let’s load the WSDL we got back in Part 1.

In soapUI, click on File -> New SOAP Project.  Don’t fill in the Project Name yet – the Browse will autofill that.

So click on Browse, and find the WSDL.  The Project Name auto-fills.  The screenshot below shows an example.

Click OK to create the project.

11-27-2014 12-01-16 AM.png

2.      In the Request 1, I edited the given template and filled in the needed XML.  This is the following payload XML I got:

11-27-2014 12-07-17 AM.png

Line 13 contains the technical name of my CDS

Line 15 says we are using the Merge Operation

Line 17 to 19 is the actual rows of the data.  Line 17 begins the <Data>node and IMMEDIATELY lists the columns our XML intends to use.

– DO NOT PUT a new line after <Data> node !

Line 18 and 19 is the actual rows of CSV using a semi-colon delimiter.  Do not change the delimiter to comma or other character.

Of course, you have as many data rows as you need.  I’m just using 2 for my blog here.

Line 19 shows that the last row of data must NOT have a newline, but rather IMMEDIATELY is joined by the </Data> node.

If you are not careful about the special situation on  <Data> and </Data> tags, your web service call will NOT work.

BEFORE – Below is a quick view of my CDS BEFORE the webservice:

CDS Below merge.png

So comparing with my payload, TC09 is a new key.  TC05 does exist in the CDS.  My payload is specified for a MERGE operation, and I click the RUN !

AFTER – Below is a quick view of my CDS after the web service updated the CDS:

CDS After Merge.png

As you can see, when existing IDs match a row in CDS, the payload data row overwrites the CDS data row.

When no match IDs, the row is inserted to the CDS.

So this method allows for updates to existing data rows as long as you have the ID.

Lastly if you use “OVERWRITE” as method (see line 15 of the payload), you will cause the clearing of all data rows in the CDS, and an upload of your data.

BTW,  in one of my current projects, we are putting CDS web services through its paces with a record count of 200k to upload.  I may add updates on what I find.

Enjoy !

To report this post you need to login first.

16 Comments

You must be Logged on to comment or reply to a post.

  1. Ginger Gatling

    Hi Tim

    Thanks for this blog and the previous blogs on cloud data source.  We were going to write a how-to guide for this – but for now I’ll point to your blogs and the one Rishbah did – thank you so much!!

    Regards

    Ginger

    (0) 
  2. Rogier Smit

    Hey Tim (or anyone else who can help us), just wondering if we can trace the web service messages from SAP BW to C4C just as inbound traffic in the web service message monitoring tool. The reason why I ask this is because we’ve setup a SOAP connection as such, we get a positive feedback on the BW side (as in data has been successfully transferred) but the data source is not updated at the C4C side. We also do not see any inbound traffic in the web service message monitor. How can we troubleshoot / trace this?

    Thanks,

    Rogier

    Administrator_-_SAP_Cloud_for_Customer.png

    (0) 
    1. Manideep Satya

      Hey Smith,

      You should see the incoming messages @ Web Service Message Monitoring untill and unless it is a Synchronous call. However in your case, make sure that communication arrangment in C4C is Active with Successful Connectivity as the first step.

      (0) 
    1. Ginger Gatling

      Hi Anton,

      HCI-DS will have documentation on help.sap.com.  We do have customers using HCI-DS to load data into C4C, but I’m not sure that it is a cloud data source.  I don’t think we have written anything up from that experience.   Please check help.sap.com for HCi-DS details.

      -ginger

      (0) 
      1. Anton Delitsch

        The problem that I havn’t found any solution in is that the SOAP interface for uploading data to C4C is basically an CSV embedded in an SOAP message, all the date is in one field with headers.

        When using HCI-DS I havn’t found a way to perform that conversion. It is possible to concatenate fields using || but not merging rows.

        (0) 
        1. Rémy PLAUCHU

          Hi Anton

          I’m using HCI DS to load C4C Cloud Datasource. Unfortunately we have to call the web-service once per source record. So in each call we pass one line for the column headers and one line of data. I have not found any faster method unfortunately.

          If someone knows a more efficient approach, please help!

          Thanks

          (0) 
          1. Anton Delitsch

            Hi,

            I tried to solve it using HCI-DS but never got it working.

            What I finally did was to export the data using HCI-DS to an CSV file, this file was then picked up by HCI using SFTP and imported in the cloud data source.

            To get the data into the right format we used an content modifier with this body:

            <glob:AnalyticsDataUploadRequest xmlns:glob=”http://sap.com/xi/SAPGlobal20/Global“>

              <BusinessDocumentBasicMessageHeader/>

              <AnalyticsDataUploadRequestContent>

              <MDAVName>${file:name.noext}</MDAVName>

              <AnalyticsImportMethod>OVERWRITE</AnalyticsImportMethod>

              <Data>${in.body}</Data>

              </AnalyticsDataUploadRequestContent>

            </glob:AnalyticsDataUploadRequest>

            (0) 
            1. Richard Kleibl

              Hello,

              i used HCI-DS in mutilpe projects to fill in the Cloud DataSource. It is a little bit tricky with an intermediate step, where you generate an intermediate output file.

              1. read in the source file / db as one string per record

              2. add to every xth record (based on how many records you want to transfer to C4C an end flag)

              3. create an output txt file which is an xml file. Therefore you have to append add the first record the xml header, the <data> start tag and the header information of the datasource. Afterwards a line break and the first record of the source.

              on each endflag add the closing </data> tag and a new starting <data> and {header} and {linebreak}

              ensure that at the end you close the xml file with an </data> tag. I therefore added a flag on the last record.

              4. Read in the file as an array with multiple <data> tags. Map it to the ws and done.

              Hope this helps.

              Kind Regards

              (0) 
  3. Srinivasan S

    Hi Tim,

    The Blog was very useful. We have tried Data Integration by getting a response from ECC system. The trick part here is we have got responses with multiple rows of data (sales orders for a year) but only one row appears in the Overview page(Accounts Screen) of the standard UI.

    This process of loading data occurs after a button click (Event-After Modify). Each time this button is clicked the same data loads. Please help us in providing a solution to load these multiple data.

    Thanks.

    Srinivasan.S

    (0) 
    1. Ginger Gatling

      Hi Srinivasan,

      So – have you created custom cloud data source objects you are loading from ERP?    Would you please describe your scenario a bit more?

      -ginger

      (0) 
      1. Srinivasan S

        Hi Ginger,

        We are trying to get responses from ECC System using SOAP web service for Open Deliveries. We have created the communication arrangement and communication scenario and we are getting the response properly from the system.

        We are trying to display this in a custom facet in the Accounts page. This action is triggered with a button click. When the button is clicked we are not able to view multiple data even though the response contains multiple data.

        Only the first data displays. Please help!

        Thanks,

        Srinivasan

        (0) 

Leave a Reply