Skip to Content

IP Address Comparison

Jan 12 at 10:08 AM


avatar image

Dear Members,

I am trying to compare IP address using below logic.The requirement is that i want to check if the system host IP is in between the IP range starting value is in loc_ip_from and end value is in loc_ip_to.


IF loc_ip_from LE system_host_ip


loc_ip_to ge system_host_ip.

Then I am Good.



But the logic fails.


loc_ip_from =

loc_ip_to =

and system_host_ip = . this fails because of '32' is 2 digit figure.

It works if I make it . because '032' is 3 digit

But if the system_host_ip = this is pass because '132' is 3 digit.

Can you suggest me better logic in abap.


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Jan 12 at 10:35 AM

(a) normalize the IP address to format ###.###.###.### for your string comparison or

(b) convert the IP address into binary representation and do number comparison

10 |10000 characters needed characters left characters exceeded