Avoid Hardcoded IPv4 and IPv6 Addresses in Source Code
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
" 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
" 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 Name | Data Type | Default Value | Description & Guidance |
|---|---|---|---|
CHECK_IPV4 | Boolean | true | Detect hardcoded IPv4 addresses |
CHECK_IPV6 | Boolean | true | Detect hardcoded IPv6 addresses |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
" Standard pseudo-comment:
... "#EC NO_HARDCODED_IP
" SAP CI_ prefix format:
... "#EC CI_NO_HARDCODED_IPRelated Rules
- Avoid Hardcoded HTTP, HTTPS, and FTP URLs in Source Code —
#EC NO_HARDCODED_URL - Avoid Hardcoding System & Tenant Environment Checks (sy-sysid, sy-mandt) —
#EC NO_HARDCODED_ENV
Technical Details
- Native ATC Class:
ZCL_SKYLINT_NO_HARDCODED_IP - Implementation File: zcl_skylint_no_hardcoded_ip.clas.abap