Skip to content

Avoid Hardcoded IPv4 and IPv6 Addresses in Source Code ​

WarningSecurity & Robustness#EC NO_HARDCODED_IPRemote Enabled

Overview ​

Avoid hardcoded IPv4 and IPv6 addresses in source code.

ATC Finding Message: Avoid hardcoded IP address; use SM59 destination or hostname configuration

Rationale ​

Hardcoding IP addresses in ABAP source code couples business logic to physical or virtual infrastructure, breaks DNS load balancing, and violates cloud portability guidelines. In modern hybrid and cloud environments (BTP, S/4HANA Private/Public Cloud), server IP addresses are dynamic and must be resolved through hostname configuration, SM59 destinations, or Communication Arrangements.

Best Practice: Use logical destinations (such as SM59 or BTP Destinations) or DNS hostnames instead of raw IP addresses.

Non-Compliant ​

abap
" Anti-pattern: Hardcoded IP address connection
DATA(lo_dest) = cl_http_destination_provider=>create_by_url(
  i_url = 'http://192.168.1.50:8080/api' ).
DATA(lo_client) = cl_web_http_client_manager=>create_by_http_destination( lo_dest ).

Compliant ​

abap
" Clean ABAP: Configuration-based destination (SM59, BTP, or Communication Arrangement)
DATA(lo_dest) = cl_http_destination_provider=>create_by_destination(
  i_destination = 'SKYLINT' ).
DATA(lo_client) = cl_web_http_client_manager=>create_by_http_destination( lo_dest ).

Configuration & Thresholds ​

This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:

Parameter NameData TypeDefault ValueDescription & Guidance
CHECK_IPV4BooleantrueDetect hardcoded IPv4 addresses
CHECK_IPV6BooleantrueDetect hardcoded IPv6 addresses

Suppression ​

To suppress findings for this rule, append the pseudo-comment to the statement:

abap
" Standard pseudo-comment:
... "#EC NO_HARDCODED_IP

" SAP CI_ prefix format:
... "#EC CI_NO_HARDCODED_IP

Technical Details ​

Released under the MIT License.