Use Data Services SDK libraries to construct an AWTableMetadata in a Java application
If you have a Java application that returns a table and you are planning to use this as a source of information for SAP Data Services, the best way is to return a table with the same data type as the Data Services Template table “AWTableMetadata”. I will explain how to easily do that in this article.
First you need to go to the libraries folder inside your SAP BusinessObjects installation (…SAP BusinessObjectsData Serviceslib). From this folder we have to import the following libraries to our Eclipse Java project.
- Acta_Adapter_sdk.jar
- Acta_broker_client.jar
- Acta_Tool.jar
The easiest way is to put these libraries inside your Java ext libraries folder so your application will import it automatically. Also if you’re planning to deploy this application on a server you need to place this library inside the server library folder too.
- ….Javajdk1.7.0jrelibext
- …..Javajre7libext
- …..SAP BusinessObjectsTomcat6lib
Import these libraries inside the project:
Import com.acta.metadata.AWAttribute;
Import com.acta.metadata.AWColumn;
Import com.acta.metadata.AWTableMetadata;
Once we have our libraries imported inside our Java project we have to assign the return value for the function in charge of constructing the table as the same data type for the table.
Public static AWTableMetadata createAWTable () throws Exception {…]
Then we are ready to construct our table. To do so we have to:
- Declare the table:
- AWTableMetadata awTable = new AWTableMetadata () ;
- awTable.setTableName("……");
- Assign the rows and columns
- AWAttribute [] attributes = new AWAttribute [2000] ;
- AWColumn [] columns = new AWColumn [2000] ;
- Assign the Attributes and columns to our table:
- awTable.setColumns(columns);
- awTable.setAttributes(attributes);
Finally we have to make the return statement as “return awTable”.
In conclusion, once we have our function done we will be able to communicate and exchange data with data services through our application in this case with a table and be able to use our application as a Data Source.
If you have any doubts or suggestions, please leave a comment below.