Data Types that characterize Custom Fields in SAP C4C Fiori UI
There are times when we are required to think out of the box, when we need to be innovative with the tools at hand. And it works better when the tools are flexible enough to allow us to be creative with those. In my experience with SAP Cloud for Customer application so far, there have been quite a few such situations where the customer requirements were not really straight forward and needed me to tweak or tailor the system in some way or the other so as to ensure that the customer is happy to see what shows up the screen. There is one thing that almost always comes in handy when building some tricky requirements in the system and that is Adaptation mode.
Adaptation mode holds myriad jewels that give us the freedom to tailor the system screens to exact business need(s). One of those is the ability to create Extension Fields complimenting the already supplied standard fields. What really drives the behavior of an Extension field is the Data Type of that field and there are a bunch of them available for us to select out of.
In this blog post, I am going to talk about this special adaptation feature which works like a charm when we are trying to build client requirements in the Cloud for Customer Application – Data Types in Extension Fields. So, let’s get going with it.
Let’s briefly talk about the Extension Fields or KUT Fields or Custom Fields. This comes into the picture when we need to capture some specific master/transactional data in the system however the fields available by standard do not suffice for this requirement. That’s when we head to Adaptation looking to create an Extension Field on the desired screen.
Let’s quickly see how this is done.
- Navigate to the screen which we want to enhance with the extension field.
- Switch on the Adaptation mode from the profile icon on the top right corner of the screen.
- Select the Section of the screen where you want to add the field and the system highlights it with a red box.
- Select the UI component and the underlying section where you want to create the extension field.
- Click on “Add” and select “Field” and we find a list of existing fields by SAP.
- In order to create a new field, click “Create Fields” on the top left of the pop-up window.
- The system determines the business context based on the section of the screen that you select. The Business Context determines which other screens you can add the field to e.g. Form Templates, Data Sources for Reports, Search Categories, and Extension Scenarios
- A label is a text on the screen used to describe the field. This is what the users will see. The technical name is automatically populated based on Label, however, is available for editing. No spaces are allowed in Technical Name.
- Toggle the Calculated field to Yes if you want the new field to calculate the result before displaying it on the screen. The system allows defining simple calculation rules.
- Under the Calculation Rule, either enter a constant value manually or select a value from the dropdown list. The values available to you from the dropdown list are proposed by the system based on the type of field you are creating and the business context of the field.
- Mark the data protection and privacy level of the field, if required.
Extension Data Types:
And now we enter the world of Data Types, a major part of our focus here, which I intend to touch upon in detail.
Often times, we are not sure which data type will be most suitable to our field requirements and so let’s take a deeper look at all the Data Types and understand each of them with reference examples or use cases.
- Text: As the name pretty much specifies, this is the data type you select when you want your new field to allow the users to enter the descriptive text of their choice. Here, you have an option to choose out of the below:
- Short Text (40) ~ a text string up to a length of 40 characters
- Medium Text (80) ~ a text string up to a length of 80 characters
- Long Text (120) ~ a text string up to a length of 120 characters
- Extended Text ~ a text string with no limit. Yes, you can write a story here. [Chuckle]
- Formatted Text: This is a very unique data type which if selected allows the users to use plenty of formatting features available in a text editor enabling them to choose things like font size, text alignment, as well as spacing.
- List: This data type enables you to define and create a List of Values or simply speaking a Drop Down field for your users. You must define a list of values that can later be selected from the dropdown list by users as shown below. In the image below, you see different ratings for sales reps to choose from when they create new accounts. The character limit for each value is 30 and you can add a maximum of 1000 values.
- Multivalued List: This is different from a List data type in the sense that it allows the users to select multiple values in the list instead of just one. The character limit for this field is 256. For example, when users want to select the preferred sports like Football, Basketball, Tennis with an option to choose more than one option.
- Indicator: This data type allows you to create a switch field on your screen with options of Yes and No. Very handy.
- Date: As the name suggests, this is your data type of choice when you want your users to be able to enter a date. There is a character limit of 8, obviously. The first 4 of these represent the year, the next 2 the month, and the final 2 the day. (DDMMYYYY)
- Date/Time: If you want the users to be able to select not only a date but a time as well, then this is your data type of choice. Once again, an obvious character length limit of 21.
- Decimal Number: A very handy data type for most of your number inputting needs. The system populates the Decimal Places and Length fields. You can specify the field length and a maximum of 31 characters including the decimal places. Tip: let the Decimal Places be zero if you don’t want the decimal [wink]
- Amount: There could often be confusion whether to choose Amount or Quantity as your data type when dealing with a value of measure. It is suggested to use amount when you can’t measure the value, i.e., whether someone can add the number up on a calculator. Need a data type that allows you to enter an amount? This is the one. Here you can choose a default value and there is the character limit of 31 (28 for value and 3 for currency code).
- Quantity: You can maintain the quantity for a product for a lead or an opportunity. It points to a unit field. Have liters or kilograms or pounds to input. Pick quantity as a data type and select the unit of measure. The type of quantity can be the length, mass, temperature, amount of substance. It is best to choose quantity when you’re talking about an inanimate object. The character limit is 34 (31 and 3 for unit code).
- Web Address: with a character limit of 255 this is the data type for letting your users specify a URL. For example, https://help.sap.com/.
- Time: Let’s you input a time entry with a character limit of 6.
- Email Address: Data type of choice for entering email ids. The character limit for the data type email address is 315 (255 and 60).
- Object Data Type: This is a really useful data type and allows you to be able to pick an existing object instance in the field such as Account, Contact, Lead, Opportunity, etc. We can do so my selecting a value from the sub-type dropdown list.
- Global Data Type: Some of the data types which find system-wide usage are grouped under this particular data type. Examples are Country Code, Currency Code, Integer Value, Percent, and Phone Number, etc.
Upon successfully creating the extension field in the system we need to save the changes. Once the dialog box closes the new field will be available in the list of available fields. We can select the checkbox next to the field and click on Apply. The field is then added to the master layout and will be available to all users.
Save the settings, click on your profile, and End the Adaptation mode.
And this leads us to the end of this blog post. I have enjoyed writing this and I really hope this information was simple and helpful to you. Please do leave your feedback/questions in the comments section below.