During the implementation of Cloud for Sales we focus on providing value for the end customer, and search for the optimal solution that is supporting the processes of our customer. Adapting the solution to the customers needs often consists of creating custom fields in the Key User Tool (I will not use the abbreviation for our Dutch readers). With these fields we are able to store any kind of customer specific data in the Cloud system. One of the type of field that can be created is a List field, or drop-down field. Standard the Key User Tool allows you to upload the values with an Excel import. Details on how to do this can be found in below blog. However there is a limit to the amount of values that a List type field can contain, this limit is 1000 entries.
I know this sounds like a lot, but every now and then you run into situations that require a larger data set, like the list of the Chamber of Commerce with SBI codes, a standard branch index code, in The Netherlands. The list contains about 1250 values. We will show how to create such a field in the SAP Cloud Application studio, together with some tricks. This way there is no limit to the amount of values.
Details on how to work with a List field created with the Key User Tool you can find in this blog.
Creating a Code list field in the Cloud Application studio.
We start by creating a Custom Solution, and a Business Object extension on the Customer object. In our solution we first create a code list object.
We are presented with a wizard to fill the Code list with all list values. If you really have over a 1000 records to create you don’t want to type all entries. I have a small trick for that to save a lot of time. All files of your solution are locally stored on your hard drive. Usually this is in a folder called CopernicusIsolatedShell, here in the subfolder projects you will find your solution, and a file called SBI.codelist. This is an XML file containing all details of the codelist. You can change it in for instance Notepad++. The codes are stored in below XML attributes, which you can write on 1 line in notepad++, so that there is 1 line for each codelist value.
I have used Excel to create 1250 rows containing the attribute values and text in between. Now you can just copy paste the values and texts from your design document. With a simple concatenate function in Excel you can merge all fields together and paste them in the SBI.codelist file in Notepad++. Now we have created 1250 line in 5 minutes. 🙂
In some cases you may need to translate the values. This can be done by right clicking on the Codelist object and selecting translation and then download. After selecting a target language the system will download a XLIFF file to your PC.
With this XML we can also do some tricks in Excel. The original file looks like this:
The file only contains the source description, you need to add a target attribute directly after the source attribute. I have pasted the XML in Excel, added a column with <target>, the target description can be added via a vlookup, and a closing column with </target>. Now perform some Excel standard work, with concatenate and copy/paste values and the file is extended with 1250 target descriptions.
Creating a field
Now that we have the codelist object we need to create a field on the Customer Object Extension in our solution. This can be done via below code on the XBO.
Notice that in this example i have also added two process extensions on the field to add the field to an ODATA and an SOAP webservice.
Adding the field to the UI
Now that we have added a field (element) to the XBO we are allowed to do some screen enhancements. Right click on the XBO and select Enhance Screen. In the presented pop-up choose COD_Account_TI for the details screen of a Customer. In the UI designer search for the correct SectionGroup and add the field to the UI via the option “Add extension field to Section group” in the Extensibility Explorer.
And we are all done. we have a List field with 1250 entries in the UI and all entries are translated.
Good luck extending your solutions and have a great Holiday Season. Cheers!!