Well, actually it is but in slightly different approach. We all know what ALPHA conversion is and how it looked like before ABAP 7.4 ? unfamous CONVERSION_EXIT_ALPHA_INPUT and CONVERSION_EXIT_ALPHA_OUTPUT. There may be some newbies among us so let’s remind what it does ? if you want to perform SQL query in ABAP very often you need to convert your data to internal format (or in the opposite direction when you take care for user experience and want to get rid of leading zeros). In the ancient times you would do something like this:
Kinda lenghty isn’t it? But with arrival of ABAP 7.4 it changed a little bit (a lot). You can achieve the same result in one line instead of 5:
So far I haven’t discovered anything you were not aware of before ? it’s been around for some time.
Let’s imagine a scenario, where you have a mapping table with generic fields or range of type char20 ? you don’t have data element you can refer to. In this case you would need to do something like this:
A little bit annoying ? you need to create helping variable, perform alpha conversion and then assign. And this is where we get to the point of this article ? you can do it even easier.
You could combine the above solution with constructor expression CONV!
Imagine how easier life gets with this technique and how many helping variables can be saved. You can use it directly in VALUE constructors and FOR loops:
And what do you think about this approach?
Write to us