Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
7,796

SAP Cloud development has lot of interesting and undocumented features. One for such example is Field Transformation.

This document gives you an idea on how to use it and where to use it.


Using field transformations, you can avoid lot of extra fields which are basically calculated. Calculation can mean anything here based on your operation.

Let us take a small example to see how it works.


Example: To display logon language of user, you don't need to write an absl script always. If you want to render it on the UI, then UI layer can do the same job as absl does.

With the assumption that you've defined your BO and opened your QAF/OIF screen in UI Designer and switched to Data Model, follow these steps:

Step 1: Create a new field in your DataModel and set the DedicatedField (LogonLanguage) property to true.

    

Ste 2: Switch to Controller tab and create a New FieldTransformation.

    



Step 3:
In the next screen that you see, set the field values as shown in the below screenshot (where TargetField is the one which you created in Step1)

    

Step 4: That's it. It just works with what you've done till now. Bring the DedicatedField (LogonLanguage) on to the screen where ever you want and preview the screen.

    



If you ask me, " Okay. We are done with SimpleExample. Now what? How complex can this thing go? ", my answer would be " I am here to help you to make a good start. There are lot of other reusable functions which might help your use case which you'll have to dig it out yourself buddy. "

  • Just toggle through namespaces in Step 3.
  • Make sure that you have these properties of the DedicatedField in your DataModel filled properly right after TargetField assignment in Step 3.

         

  • You might encounter dumps for some FieldTransformations as it totally depends on the DataType of the DedicatedField most of the times. Each FieldTransformation returns values of a particular DataType. Some may not be even PSM released. If there's nothing you can do and you tried your best already, then do raise an incident to know the exact reason why it didn't work in your case.


It is just not the case that you need to use the UI layer functions always. If you want to bring up something on to the screen which is an outcome of your absl code, even that is possible.

  • Create a new Reusable library and create a New Function with the UI Designer indicator checked as shown in the below screenshot.

         

  • In this case, as we are writing a simple code to return Current User's LoggedIn language, we just need a return parameter. But, make sure that the data type you use is available in the list of released GDT datatypes as you're gonna have to assign the same data type to the DedicatedField later on in UI Deisgner. Review and Finish the function creation screen.

         

  • Prepare your absl code with something like as shown in the below screenshot.

         

  • Okay. Now, we are done with what has to be done on absl side. Going back to UI Designer part, we just need to make one change in method which we already followed that is at Step 3. Select your solution Namespace in the Namespace field.

         

  • You know about the rest of the Process. Good luck with it.


Is this the only advantage of such a useful feature? Well, fortunately, NO!

As the title of this document talks about using Field Transformation but not in UI Designer alone. So, here you go with another way where you can make a good use of Field Transformations.

  • Consider a general requirement that you have a Date field in your Custom BO and user stores date when creating instances but wants to see just the Month while viewing Report so that he can sort the Business Data based on 'Month'.
  • So, when you create DataSource on your Custom BO, stop at Stage 3/6 and have a look at what that screen provides you. Select your Date field and look at the right pane for what all you can do with that. You should something like below:

    

  • In this example, you will have new field in your Report with name "Month" which gives you only Month values from the custom field "FinalDate". You don't have to store 'Month' as a separate field in your Custom BO to show it for reporting purposes. Isn't this good?
  • There are few such DataTypes with which you can play in this screen like Duration. You can get this info from Documentation. Have fun with it.


End of story pal! Let me know if this could be done in a better way or something needs to be added. Thanks for going through.

24 Comments
Jens-Limbach
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hey,

thanks for this great post! Always missed more detailed documentation about transformations!

Cheers,
Jens

ralf_baumann
Advisor
Advisor
0 Kudos

Hi,

this is a great post. Looking forward to reading more interesting blogs from you.

Cheers,

Ralf

dhruv_mehta
Active Contributor
0 Kudos

srivatsava.janaswamy2,


Hi , Nice post.


However i have a doubt , you fetched the User Deatils by using Context but what if you want to pass an ID and based on that you want to return a collection?


Does any one have worked on such scenario?

Former Member
0 Kudos

Hi Dhruvin,

Did you get the above scenario worked out? could you pass an importing parameter to the reuse Library function and based on it get a returning value?

I have a 'Read' function in my reuse libraryID which has a importing parameter 'ProductID' I have a returning value based on this ProductID.

However I am unable to successfully pass the importing parameter from the UI designer floorplan where the data is stored in my data-model's dedicated data-field.

dhruv_mehta
Active Contributor
0 Kudos

I dont think it is possible sangeeta in my case i was using context Bo ( which is i think has a single instance through out the session ) so i did not need read but yes i think from UI Designer i was not able to pass parameter in import! u can do that in absl code.

Former Member
0 Kudos

Hey Sangeeta,

Have you solved your problem? I'm facing exactly the same...

Former Member
0 Kudos

Hi Janna,

I was able to solve my problem without using field transformation. I have built a custom BO with the parameter ProductID as the key. I could call the ReadBO operation on this BO from the UI designer. From this BO I called my reuse library function.

I can send you the details of my solution if you need it.

dhruv_mehta
Active Contributor
0 Kudos

Nice approach...

Former Member
0 Kudos

Hey Sangeeta,

thank you for your answer! Your approach sounds sufficient. Indeed it'd be very helpful if you sent me more details of your solution..

Dedeepya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi All, Though its an old post, I have stepped on Field Transformations with import params just now, and they dont seem to work:) Is this a known limitation, that Import Parameters cannot be passed from UI Designer to Reuse Function in PDI? I have a similar scenario as Sangeetha had, but I cannot use a custom BO for it, as I need to generate a URL on the fly. Any expert comments? BR Dedepepya

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Dedeepya,

If you are on an SAP BO you canonly use the Extensibility Explorer view inside the UI Designer. The possibilities of this Extensibility Explorer are limited. :sad:

So, sorry, this is not possible here.

Bye,

   Horst

Dedeepya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Horst, I got it working. I learnt that the import does not support structured content e.g. InternalID or UUID as they are structured data types.  I updated import data type to a LONG EXTENDED TEXT and i could get the required flow. However, I would like to test if it is possible to return an entire structure 🙂 and not just a field. BR Dedeepya

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Dedeepya,

This depends on the defintion of the input paraneter of the Transformation Definition.

What TD are you using: From SAP or an own one?

Bye,

    Horst

Dedeepya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Horst, I am using a custom TD (defined as a reusable function on PDI).

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Dedeepya,

So it is onyour responsibility to define the interface of the TD so it matches the required data types. :grin:

Bye,

   Horst

Dedeepya
Product and Topic Expert
Product and Topic Expert

Hi Horst, That is correct, I was passing ID of Account and I used the same data type in my TD as well. But the ID was not passing to the TD Function, that is when SAP Product team communicated we can only use Non-Structured data like LANGUAGE_INDEPENDANT_TEXT element.

Former Member
0 Kudos

Hi all,

Can we use custom Reuse functions for FieldTransformation in Data Source?

I cannot find my custom Reuse function while creating Data Source.

Best Regards,

Fred

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Fred,

What I take out from the docu at section 8.10.2.5 Transformation Rules is:

Available Transformation Rules

Transformation rules are only available for fields of the data types GLOBAL_DateTime, Date, and the Name, Description, and Text data types, which represent character strings.

A list of available TR is following in the docu.

Therefore I doubt that any function from your CRU lib is available in a Data Source.

Sorry,

    Horst

Former Member
0 Kudos

Hi Horst,

:sad: too bad.

Thanks for clarification.

Best Regards,

Fred

Dedeepya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Horst, I tried using my Field Transformation Rule on a LANGUAGEINDEPENDENT_EXTENDED_Text element but for the resp. field on Data Source i could only get "Concatenate" as Transformation Rule, I could not get the custom Reuse Functions i have created with same data types for import & return parameters. BR Dedeepya

Former Member
0 Kudos

Hi Dedeepya,

Yes, same situation.

Dedeepya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Fred, Its confirmed custom Reuse Library functions are not enabled for use on Data Sources.

dordas
Participant
0 Kudos
Hi all

 

In my solution I'm using 1908 and trying to use the first workarround. In UI designer works and pass the activation



but if you try activate throught Solution Explorer > Activate an server message is raised and activation fails.



 

Does somebody know something about that?

 

Thanks in advance
dordas
Participant
0 Kudos
I'm in a similar situation trying to pass an UUID to a built-in function.

If, in the definition of built-in, I define the input parameter as UUID type, the program crash with an ASSIGN_CLASS error when floorplan is rendered.

In the other hand, if I define it as for example AP.PDI.bo:String it works.

I realize that for structured types, even are strings, their content attribute is provided when we choose it in the UI designer. E.g.:

myfieldUUID-~content

Labels in this area