# sap4j **Repository Path**: mirrors_jmrozanec/sap4j ## Basic Information - **Project Name**: sap4j - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-22 - **Last Updated**: 2026-01-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # sap4j We make SAP interactions dead easy :) **Download** sap4j is available on [Maven central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.sap4j%22) repository. com.sap4j sap4j 1.0.2 **Features** - Clean and intuitive DSL to describe connections, queries and iterate results. - Maintain multiple SAP connections, query tables and BAPI functions while retrieving all results with same interface. - Includes circuit breaker pattern, to avoid overhelming SAP server when query execution issues arise. - Provide means to define throttling policies for queries execution. **Usage Examples** Properties properties = new Properties(); properties.setProperty("username", "xxx"); properties.setProperty("password", "xxx"); SAPConnection connection = SAPConnectionBuilder.getInstance() .withLanguage(ISO639LanguageCode.EN) .withAsHost("somehost") .withClient("001") .withSysnr("01") .withPoolCapacity(3) .withCredential(SAPCredential.fromProperties(properties)) .build(); // Instantiate executor for given connection SAPQueryExecutor executor = SAPQueryExecutor.forConnection(connection, throttlingPolicy, circuitBreaker); // Write some query SAPQuery query = SAPQueryBuilder.queryFunction("BAPI_MATERIAL_STOCK_REQ_LIST") .withQueryCondition("MATERIAL", "XAEA12") .withQueryCondition("GET_IND_LINES", "X") .fromTable("MRP_IND_LINES").build(); // Execute query Map> results = executor.execute(query); // Retrieve results Iterator rows = results.get("MRP_IND_LINES"); // Iterate and process results while(rows.hasNext()){ StringBuilder builder = new StringBuilder(); Map values = rows.next().getColumnValues(); // process results for(String key : values.keySet()){ builder.append(String.format("'%s', ", values.get(key))); } System.out.println(builder.toString()); } # Limitations At the current stage, the library provides means to read data. Executions to write data into SAP were not developed yet. We do not deal with queries caching: this should be handled [on server side](https://help.sap.com/viewer/bed8c14f9f024763b0777aa72b5436f6/2.0.02/en-US/bc12a173118548e9be8b69f1d62dfae1.html), to ensure data consisenty. # Recommendations To ensure optimal queries, please check query conditions target indexed fields. More details on how to ensure high performance can be found in the following [SAP document](https://help.sap.com/doc/05b8cb60dfd94c82b86828ee77f7e0d9/2.0.04/en-US/SAP_HANA_Performance_Developer_Guide_en.pdf). We specifically advice "Section 5.5: SQL Tuning Guidelines". The rest of the document provides an overview on inner workings of relational DBs, providing details regarding queries optimization, compilation and execution; useful information on how to debug queries performance issues.