Skip to Content
Author's profile photo Former Member

EPIC TUTORIAL (Part 1) – Mass load data to extension fields post-implementation

In this extremely lengthy post, I will show you how to extend a Business Object in ByDesign, then mass load data to the extended fields. I’ve heard this requested by many customers, and many times it involves creating an extension field post-implementation, and not being able to mass load data to the new field. In this case I chose to use the Customer BO to extend and load stuff too, but you could go with whatever other BO is available to you.

Note that this was done in the FP3.5 ByD Studio and though it seems lengthy this whole deal really only takes about 10 minutes. Another key thing to mention here is that for a customer to use this, they would need to engage a partner or SAP via the customer one-off process. HOWEVER, this process could also be made to be generic, and sold in the SAP Store (bu don’t try it, because it’s my idea).

Anyway, I’ve had to separate this into two posts because I’ve tried to be as thorough as possible in this tutorial, and for some reason the SCN places some limits on blog size or length.

Pause.

Deep breath.

Here we go:

Create a new solution. I’d go with a global solution so you can enable yourself as a key user in case you want to adapt any UI stuff. In this case I’m using the Foundation Deployment Unit because that’s where the Business Partner objects (Customer, Supplier, etc.) hang out.

Go ahead and Enable Key User for good measure.

Next create an extension to the Customer BO, so you can add those fields you forgot to initially migrate.

Now add those fields to the BO extension. Remember that extension fields are limited to a short list of data types, so don’t get any ideas of adding something too fancy.

Here’s the BO extension code:

import AP.Common.GDT;

import AP.FO.BusinessPartner.Global;

[Extension] businessobject AP.FO.BusinessPartner.Global:Customer {

              node Common {

              element SomeText:Text;

              element SomeAmount:Amount;

              element SomeQuantity:Quantity;

              element SomeDate:Date;

           }

}

Now create a new BO that you’ll use for staging all the data you want to mass load to your Customers.

Again, here’s the code

import AP.Common.GDT as apCommonGDT;

businessobject ExtensionFieldStaging {

              [AlternativeKey] element CustomerID:BusinessPartnerInternalID;

              element SomeText:Text;

              element SomeAmount:Amount;

              element SomeQuantity:Quantity;

              element SomeDate:Date;

}

Create an AfterModify script for the staging BO. Why? Because when we load stuff to the BO, it’s modified, so it will populate your Customer extension fields after it’s modified.

The AfterModify script finds the customers in our staging table then populates the extension fields on the customer BO. Here’s the script:

import ABSL;

import AP.FO.BusinessPartner.Global;

var query_customer;

var query_customer_selparam;

var query_customer_result;

var customer;

// Get customers in staging

query_customer = Customer.QueryByIdentification;

query_customer_selparam = query_customer.CreateSelectionParams();

query_customer_selparam.Add(query_customer.InternalID , “I”, “EQ”, this.CustomerID);

query_customer_result = query_customer.Execute(query_customer_selparam);

// Set extension field values for each Customer identified

foreach (customer in query_customer_result) {

               customer.CurrentCommon.SomeText = this.SomeText.content;

               customer.CurrentCommon.SomeAmount = this.SomeAmount;

               customer.CurrentCommon.SomeQuantity = this.SomeQuantity;

               customer.CurrentCommon.SomeDate = this.SomeDate;

              }

Now we want to create a Service Integration to load up our staging BO.

XML File Input is the easiest way to load the staging BO, so let’s go with that!

Select our staging table for XML input (duh).

The next step is the one to pay attention to. First, make sure to check List Mass Processing, unless you want to load stuff one at a time. Then select all the fields in the staging BO, and identify each instance by Customer ID as shown below.

Finish!

Activate the Service Integration, then save the generated .xsd file somewhere convenient, such as a folder on your Desktop.

Look, it’s saved!

And now, because the SCN won’t let me use any more images in this post, I’ll have to continue to part 2.

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Andreas Eissmann
      Andreas Eissmann

      Thanks Judson for blogging this! I'm currious for next part.

      Andreas

      Author's profile photo Former Member
      Former Member

      Thanks, really useful.

      Jesús

      Author's profile photo ram k
      ram k

      good information for new comer like me into COD.

      rams.

      Author's profile photo ram k
      ram k

      Thanks Jude, excellent tutorial.

      rams.

      Author's profile photo Former Member
      Former Member

      Very nice tutorial, congrats!

      Author's profile photo Lewis Peters
      Lewis Peters

      Has anyone managed to get this sort of method to work for multi-level structures, e.g. one contract has many line items, and the ability to mass-modify certain fields in each line item is needed?