SAP S/4HANA Connector Extension
A Visual Studio Code extension that enables seamless connection and interaction with SAP S/4HANA systems. This extension automatically detects and uses existing SAP GUI for Java connection configurations, making it easy to connect to your SAP systems without re-entering connection details.
Features
🔌 Smart Connection Management
- Auto-detect SAP GUI Connections: Automatically finds and parses existing SAP GUI for Java connection files
- Multiple Connection Sources: Supports SAPlogon.ini files and SAP shortcut (.sap) files
- Cross-Platform Support: Works on Windows, macOS, and Linux
- Fallback Manual Entry: Manual connection option when SAP GUI configs aren't available
- Secure Authentication: Uses existing SAP GUI connection details with secure credential handling
📊 OData Integration
- OData Query Execution: Execute OData queries against SAP S/4HANA services
- Query Builder Support: Support for $filter, $select, $top, $skip, and $orderby operations
- JSON Response Viewer: View query results in formatted JSON in a new VS Code tab
- Service Discovery: Explore available OData services in your SAP system
🖥️ Visual Studio Code Integration
- Activity Bar Integration: Dedicated SAP S/4HANA activity bar with custom views
- Command Palette: Quick access to all SAP operations via Command Palette
- Status Indicators: Real-time connection status and feedback
- Output Channel: Detailed logging and debugging information
Getting Started
Prerequisites
- Visual Studio Code 1.105.0 or higher
- SAP GUI for Java installed (with existing connection configurations)
- Access to an SAP S/4HANA system with OData services
- Valid SAP user credentials
The extension supports both traditional INI format and modern XML format:
- Modern SAP GUI for Java: Uses XML-based configuration
- Location:
~/Library/Preferences/SAP/SAPGUILandscape.xml (macOS)
- Features: Supports routers, message servers, and advanced connection settings
- Classic SAP GUI: Uses INI-based configuration
- Cross-platform: Works on Windows, macOS, and Linux
- Simple format: Easy to read and edit manually
Supported SAP GUI Configuration Locations
The extension automatically searches for SAP GUI configuration files in these locations:
Windows
%APPDATA%\SAP\Common\SAPlogon.ini
%USERPROFILE%\AppData\Roaming\SAP\Common\SAPlogon.ini
C:\Users\Public\SAP\Common\SAPlogon.ini
macOS
~/Library/Preferences/SAP/SAPGUILandscape.xml ⭐ XML Format
~/Library/Preferences/SAP/Common/SAPlogon.ini
~/.sap/saplogon.ini
/Applications/SAP Clients/SAPGUI for JAVA/config/SAPlogon.ini
Linux
~/.sap/saplogon.ini
~/.sapgui/saplogon.ini
/opt/sap/sapgui/config/SAPlogon.ini
Configuration
Configure additional settings in VS Code settings:
{
"sap-s4hana.customSAPGUIConfigPath": "~/Library/Preferences/SAP/SAPGUILandscape.xml",
"sap-s4hana.preferSAPGUI": true,
"sap-s4hana.defaultClient": "100",
"sap-s4hana.timeout": 30000,
"sap-s4hana.enableLogging": true
}
Usage
Connecting to SAP S/4HANA
Method 1: Auto-detect SAP GUI Connections (Recommended)
- Using Command Palette:
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Type "SAP S/4HANA: Connect (Auto-detect SAP GUI)"
- Select from detected SAP GUI connections
- Enter your username and password
- Connect automatically
Method 2: Manual Connection
- Using Command Palette:
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Type "SAP S/4HANA: Connect Manually"
- Follow the prompts to enter connection details manually
Method 3: Activity Bar
- Click the SAP S/4HANA icon in the Activity Bar
- Open the "Connection Manager" view
- Choose from available connection options
Connection Selection Interface
When auto-detecting SAP GUI connections, you'll see a quick-pick menu showing:
- Connection Name: From SAP GUI configuration
- Host:Port (Client): Connection details
- Description: SAP GUI connection description
- File Location: Source configuration file
Executing OData Queries
- Ensure you're connected to an SAP S/4HANA system
- Use Command Palette: "SAP S/4HANA: Execute OData Query"
- Enter the service name (e.g.,
API_MATERIAL_SRV)
- Enter the entity set name (e.g.,
A_Material)
- Optionally add filters and query options
- View results in a new JSON document
Example OData Query
- Service:
API_MATERIAL_SRV
- Entity Set:
A_Material
- Filter:
MaterialType eq 'FERT'
- Top:
10
Available Commands
| Command |
Description |
SAP S/4HANA: Connect (Auto-detect SAP GUI) |
Auto-detect and connect using SAP GUI configurations |
SAP S/4HANA: Connect Manually |
Connect with manually entered details |
SAP S/4HANA: Disconnect |
Disconnect from the current system |
SAP S/4HANA: Connection Manager |
Open the connection manager interface |
SAP S/4HANA: Execute OData Query |
Execute an OData query against connected system |
SAP S/4HANA: Test XML Parser (Debug) |
Test and view parsed SAP GUI connections (debugging) |
Extension Settings
| Setting |
Type |
Default |
Description |
sap-s4hana.customSAPGUIConfigPath |
string |
"~/Library/Preferences/SAP/SAPGUILandscape.xml" |
Custom path to SAP GUI configuration file |
sap-s4hana.preferSAPGUI |
boolean |
true |
Prefer SAP GUI connections over manual entry |
sap-s4hana.defaultClient |
string |
"100" |
Default SAP client number |
sap-s4hana.defaultHost |
string |
"" |
Default host for manual connections |
sap-s4hana.timeout |
number |
30000 |
Connection timeout in milliseconds |
sap-s4hana.enableLogging |
boolean |
false |
Enable detailed logging for debugging |
The extension supports the modern SAP GUI for Java XML configuration format:
<?xml version="1.0" encoding="UTF-8"?>
<Landscape version="1" generator="SAP GUI for Java">
<Services>
<Service uuid="..." name="My SAP System"
client="100"
server="sap-server.company.com:3200"
user="myuser"
language="en"
type="SAPGUI"/>
</Services>
</Landscape>
The extension also supports standard SAP GUI configuration files (SAPlogon.ini) with the following format:
[Connection Name]
Description=My SAP System
Hostname=sap-server.company.com
Port=3200
Client=100
SystemID=DEV
Language=EN
[Another Connection]
Description=Production System
Hostname=sap-prod.company.com
Port=3200
Client=100
SystemID=PRD
Architecture
Components
- SAPGUIParser: Automatically detects and parses SAP GUI configuration files
- SAPConnectionManager: Core connection handling and OData query execution with SAP GUI integration
- SAPConnectionWebviewProvider: Web-based UI for connection management
- Types: TypeScript interfaces for SAP GUI connections and configuration
- Extension: Main extension activation and command registration
Security Considerations
- SAP GUI connection details are read but not stored by the extension
- Passwords are prompted for each connection and not saved
- HTTPS support for encrypted connections
- Connection credentials are not logged when debug logging is enabled
Development
Building from Source
- Clone the repository
- Install dependencies:
npm install
- Compile the extension:
npm run compile
- Run tests:
npm test
Development Setup
- Open the project in VS Code
- Press
F5 to launch a new Extension Development Host window
- The extension will be loaded automatically for testing
Project Structure
├── src/
│ ├── extension.ts # Main extension file
│ ├── sapConnectionManager.ts # SAP connection handling
│ ├── sapGuiParser.ts # SAP GUI configuration parser
│ ├── webviewProvider.ts # Webview UI provider
│ ├── types.ts # TypeScript interfaces
│ └── test/
│ └── extension.test.ts # Extension tests
├── package.json # Extension manifest
├── tsconfig.json # TypeScript configuration
├── webpack.config.js # Webpack configuration
└── README.md # This file
Troubleshooting
Common Issues
No SAP GUI Connections Found:
- Verify SAP GUI for Java is installed and configured
- Check if configuration files exist in expected locations
- Use the custom path setting for non-standard locations
- Fall back to manual connection entry
Connection Fails:
- Verify host URL and port are correct in SAP GUI configuration
- Check if HTTPS is required for your SAP system
- Ensure your user has appropriate permissions
- Verify the SAP client number
OData Query Fails:
- Check if the service name is correct and available
- Verify entity set exists in the service
- Ensure proper OData filter syntax
- Check user permissions for the service
Debug Mode
Enable logging in settings and check the "SAP S/4HANA Connector" output channel for detailed information about:
- SAP GUI file detection and parsing
- Connection attempts and responses
- OData query execution
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
See CHANGELOG.md for details about each release.
Support
For issues and feature requests, please create an issue in the project repository.
Note: This extension is not officially affiliated with SAP SE. SAP, S/4HANA, and SAP GUI are trademarks of SAP SE.