Welcome to the SAP BusinessObjects Report Query Extraction Script! This Java-based Script is designed to help you log in to a SAP BusinessObjects (BO) server, retrieve queries from reports, and save them to text files. The tool supports both Freehand SQL (FHSQL) and Universe-based reports.
Before you start using this Script, ensure you have the following:
- Java JDK: Installed on your machine.
- Maven/Gradle: For managing dependencies, if not included manually.
- OkHttp: For making HTTP requests.
- JSON & XML: Libraries for JSON/XML processing.
Start by cloning the repository to your local machine:
git clone https://github.com/swapnilyavalkar/SAP-BO-Getting-SQL-Queries-Webi-Reports.git
cd SAP-BO-Getting-SQL-Queries-Webi-ReportsEnsure that your project includes the following dependencies:
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.3</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20211205</version>
</dependency>
</dependencies>Update the MainProgram.java class with your CMS IP, username, password, and report ID:
public static String SOURCE_CMS_IP = "Your_CMS_IP";
public static String SOURCE_CMS_USN = "Your_Username";
public static String SOURCE_CMS_PWD = "Your_Password";
public static String SOURCE_REPORT_ID = "Your_Report_ID"; //You can also mention multiple SI_IDs of the reports as {"760528", "478278"}This Script follows these main steps:
- Log in to the BO Server: Authenticates the user with the BO server and retrieves a session token.
- Retrieve Data Providers: Extracts the list of data providers (queries) from a given report.
- Save Queries to Files: Depending on the data source type (FHSQL or Universe), the corresponding query is saved to a
.txtfile. - Log off from the Server: Logs out from the BO server, invalidating the session token.
The logonServer() method logs you into the BO server and retrieves a session token:
String token = Util.logonServer(SOURCE_CMS_IP, SOURCE_CMS_PWD);Call the getQueries() method with the report ID and session token:
Util.getQueries(SOURCE_REPORT_ID, token, reportName);This will save the queries into text files in the current directory.
Finally, log off from the server:
Util.logoffServer(token);Compile and run the program using your preferred IDE or via the command line:
javac MainProgram.java
java MainProgramlogonServer(String, String): Authenticates the user and returns a session token.getQueries(String, String, String): Retrieves queries from the report and saves them to text files.getFHSQLQuery(String, String, String, String): Handles FHSQL-based queries.getUniverseQuery(String, String, String, String): Handles Universe-based queries.logoffServer(String): Logs out from the BO server.
baseURI: The base URI for the BO server.client: The OkHttp client used for making HTTP requests.mediaType: The media type set to "application/xml".filepath: The directory where queries are saved.
This project is licensed under the MIT License - see the LICENSE file for details.
By following these steps and guidelines, you'll be able to extract queries from your SAP BusinessObjects reports quickly and efficiently. Feel free to contribute to the project or raise any issues on the repository!
Happy coding! 😊