SAP for Utilities Discussions
Connect with fellow SAP users to share best practices, troubleshoot challenges, and collaborate on building a sustainable energy future. Join the discussion.
cancel
Showing results for 
Search instead for 
Did you mean: 

Converting ANLAGE(Installation) from external input to internal format (ex. 40000000 -> 0040000000)

angeliev
Explorer
0 Kudos

Hello everyone!

I am working on a project at my company, developing an app that displays data about electricity usage. However, I am encountering a problem and would greatly appreciate any assistance.

I have searched the internet but haven't found a solution to my issue.

The app requires users to input the number of an installation (ANLAGE) which is then utilized in the CDS Views. The challenge arises because our clients sometimes use specific numbers as prefixes for the installation number. Some users are unaware of this and enter the number without the prefix.

For example:

Internal number (ANLAGE) = '0060000000' (Here, the prefix is '00' before '600...')

User input in the UI5 app = '60000000'

This discrepancy leads to a problem where the CDS views fail to retrieve any data from the database.

I need a universal solution that can be applied across multiple systems with varying prefixes (such as '00', '99', '2', etc.).

Userinput = '60000000' -> no results

This is how it is shown, if I use other parameters. So there must be some way its being converted.

Does any 1 have an idea?

Thanks in advance friends !

Best wishesh
Angeliya

4 REPLIES 4

michael_kilger
Explorer
0 Kudos

Hello Angeliya,

in classic ABAP this works:

SHIFT anlage RIGHT DELETING TRAILING space.
OVERLAY anlage WITH '0000000000'.

Kind regards,
Michael

angeliev
Explorer
0 Kudos

Good morning Michael,

Thank you for your answer!

I have now tested this solution, and it works fine, but only for the case where the customers' internal numbers start with '00'. I need it to be dynamic so that the code suits all systems.

For example, in my case, the "ANLAGE" numbers start with '00', but we have customers whose numbers start with '2'. So, in that case, when the user inputs '600000' on the UI5 mask, it has to be converted to '2600000', and I would like it to be dynamic, without changing the code for every system.

Thanks a lot in advance!

Best regards,

Angeliya

michael_kilger
Explorer
0 Kudos

If you want dynamic behaviour you have to check against the number range (Transaction SNRO).
Your number range object is possibly 'ANLAGENNR'? The underneath number intervals are customized differently in your systems.
Check out the corresponding number interval of your number range object.
With this Information you can build your overlay-mask dynamically ( '0000000000' or '0200000000' or ...).
I think to solve this you have to dig a little bit in the table layer of transaction SNRO for better understanding...

srinivasankh
Contributor
0 Kudos

Hi Angeliya,

You can use standard FM: CONVERSION_EXIT_ALPHA_INPUT

example:

Data : lv_anlage TYPE eanl-anlage.


CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = <your input>
IMPORTING
output = lv_anlage.

Now this lv_anlage will have leading zeros.

Hope this helps.

Thanks,

Srini