How to fetch tables and columns from SAP BO universe Data Source? - sap

I am able to get folders of a particular universe by using REST API of SAP BO Universe semantic layer.
Now I need to get the main tables from underneath data source of the universe. I've found out that COM SDK of SAP should be used for this, however they say it is deprecated now.
Is there any possibility to fetch the above stuff from SAP BO to my Java application?
Thanks in Advance.

Did you try SAP BI Semantic Layer Java SDK API? It contains getTables() method which seems to do exactly what you need:
Returns the value of the 'Tables' containment reference list. The list contents are of type Table. It is bidirectional and its opposite is 'Data Foundation'.
This represents the list of the table names of the data foundation.
Returns:
the value of the 'Tables' containment reference list.
If you have Webi, you can get data provider info by the means of RESTful Webi API. Data provider is universe in your case.
First of all you should get dataproviders and their IDs
Then you get query plan of your universe by this API
GET /documents/<documentID>/dataproviders/<dataProviderID>/queryplan
and receive all the SQL statements along with table names and columns that were used in this universe
<queryplan custom="false" editable="true">
<union>
<fullOuterJoin>
<statement index="1">SELECT 'FY' || to_char(SALES.invoice_date,'yy'),
count(distinct SALES.inv_id) FROM SALES GROUP BY 'FY' ||
to_char(SALES.invoice_date,'yy')</statement>
<statement index="2">SELECT 'FY' || to_char(SALES.invoice_date,'yy'),
sum(INVOICE_LINE.nb_guests) FROM SALES, INVOICE_LINE, SERVICE_LINE,
SERVICE WHERE (SALES.INV_ID=INVOICE_LINE.INV_ID) AND
(INVOICE_LINE.SERVICE_ID=SERVICE.SERVICE_ID) AND
(SERVICE.SL_ID=SERVICE_LINE.SL_ID) AND
(SERVICE_LINE.service_line ='Accommodation')
GROUP BY 'FY' || to_char(SALES.invoice_date,'yy')</statement>
</fullOuterJoin>
<fullOuterJoin>
<statement index="3">...</statement>
<statement index="4">...</statement>
</fullOuterJoin>
<intersect>
<fullOuterJoin>
<statement index="5">...</statement>
<statement index="6">...</statement>
</fullOuterJoin>
<fullOuterJoin>
<statement index="7">...</statement>
<statement index="8">...</statement>
</fullOuterJoin>
<minus>
<fullOuterJoin>
<statement index="9">...</statement>
<statement index="10">...</statement>
</fullOuterJoin>
<fullOuterJoin>
<statement index="11">...</statement>
<statement index="12">...</statement>
</fullOuterJoin>
</minus>
</intersect>
</union>
</queryplan>
Here is also a Developer guide for RESTful API. For example, this can be done with PowerShell.

Related

Podio API query

I have podio data with more number of column, but we need to fetch 5-6 column data through API. I attached column name screenshot. If we need only for example order id, city, country then how to write API query?
/item/app/{app_id}/filter/
If it is right, how to write query with selected column name with GET/POST.
The filter endpoint uses a POST body to filter which records to return, not which fields/columns to return. It is not possible to specify which fields/columns to return with an API call according to this SO thread from an old Podio support person.
If you are looking to remove fields from the query to reduce your datasource size within Klipfolio, I would recommend returning the API call in CSV format instead of JSON. Klipfolio support documents how to do this HERE by performing a GET operation and adding /csv to the end of the URL.
https://api.podio.com/item/app/Your-APP-ID/csv/

Most queried and highest billable BigQuery tables

I need to check the most queried BQ tables, the most expensive billable BQ tables and also the highest slot usage and the associated users.
Anyone could provide the simplest way (query) to do this in BiqQuery?
You can try exploring table INFORMATION_SCHEMA.JOBS_BY_*. This table contains details on jobs that were executed (query, total_bytes_billed, etc.) see jobs metadata documentation for more details per field.
Based on your requirements, you might want to try the query below. Feel free to tweak the query as needed.
select
parent.user_email,
sum(parent.total_bytes_billed) as sum_total_bytes_billed,
count(ref.table_id) as query_table_count,
ref.table_id,
sum(parent.total_slot_ms) as slot_usage
from `region-us`.INFORMATION_SCHEMA.JOBS_BY_USER as parent, unnest(referenced_tables) as ref
group by ref.table_id,parent.user_email
order by sum_total_bytes_billed desc
Output:
NOTE: This was tested on my test project, hence a small sample size and there are no other users that query on this project.

How to retrieve Square orderIds for Call to BatchRetrieveORders

I want to retrieve a list of orders using the Square API. The call to retrieve orders is a POST call with a String array of order_ids however I'm not sure where I can get this information. In the docs they said I can use the ListTransactions endpoint to get this information but I'm not able to find the order_id within the response.
The documentation to retrieve Orders located at: https://docs.connect.squareup.com/api/connect/v2#endpoint-batchretrieveorders
see sample response of ListTransactions: https://docs.connect.squareup.com/api/connect/v2#endpoint-listtransactions
The Orders API does not support listing of orders. To access order
details, you will need to fetch the order's ID by querying
transactions using the ListTransactions and RetrieveTransaction
endpoints, and then fetching the order using the BatchRetrieveOrders
endpoint
Reference: https://docs.connect.squareup.com/articles/orders-api-overview
The goal is to get a list of recent transactions/orders that list out exactly what was purchased. The Transactions model doesn't contain Items whereas the Orders model does.
The Transaction object will include an order_id field if you included it during the Charge request. If you did not pass the order_id to the Charge request, then it will not show up.
Furthermore - just for clarity's sake, if you use Square Point of Sale, or if you haven't included the order_id previously but still would like to view itemizations for transactions, please look at V1 ListPayments which will include it even if there's no order_id.
References:
https://docs.connect.squareup.com/api/connect/v2#type-transaction
https://docs.connect.squareup.com/api/connect/v1#get-payments

Use dynamic values in CDS access control

How can I compare a cds element to a return value of an ABAP function?
As an example:
An employee is assigned to a company and the company has orders from customers. These orders are displayed in a table and employees should only see orders for the company they are working for.
If employee A was working for Company B, the role would be something like this:
grant select on ConsumptionViewName
where company = ‚B‘;
I now want to make this hardcoded 'B' dynamic and there is an ABAP helper function that returns the employer of an employee which should be used. There aren't any authorization objects that have a field for the company, is it possible to do it without one?
There is no way you can supply your dynamic values for the CDS DCL.
If no suitable authority object is found, either you define your own one and let DCL do its job. Alternatively you can filter the result at Gateway layer (methods in ...DPC_EXT class) by filtering the result with the ABAP helper function.

How to work with map property in RQL (Oracle's ATG Web Commerce)

We use Oracle's ATG Web Commerce for our project. And currently we need construct RQL query which obtain products which SKU's tacticalTradeStatuses contains certain status and ordered by status value.
I briefly describe the relationship between entities: Product item descriptor contains list of SKUs. Each SKU contains map tacticalTradeStatuses (key - tactical trade status, value - sequense)
For example, how to obtain all products which SKU's tacticalTradeStatuses property contains key 'BEST_SELLER' and ordered by value associated with key 'BEST_SELLER'.
Key by which we want to select products we want to pass as RQL parameter.
i have two ways to doing that
1) first create a query which fetches all the product based on map key BEST_SELLER
2) Now pass it to foreach droplet and add sort properties. which help to sort the result based on your requirements
for sorting please refer to below link
http://docs.oracle.com/cd/E23095_01/Platform.93/PageDevGuide/html/s1316foreach01.html
2 way i think is to use query options in RQLStatement.. which work same as sort properties in for each
If you provide some XML Repository structure that will be good..hope it will help you