query_hana_direct
Execute read-only SQL SELECT directly against SAP Business One HANA database, bypassing Service Layer when unavailable or when complex joins and aggregations are needed.
Instructions
Run a read-only SQL SELECT directly against a SAP B1 HANA database, bypassing Service Layer entirely. Use this when Service Layer is unavailable/misconfigured, or when a question needs a join/aggregation across tables that's awkward via OData. Requires HANA_HOST, HANA_PORT, HANA_USER, HANA_PASSWORD (and HANA_TENANT for a multi-tenant/MDC system) to be set in this connector's environment — if not configured, this tool will error saying so. This is a single tenant-DB connection that can see every company's schema — table names MUST be fully qualified as "SCHEMA_NAME"."TABLE_NAME" (HANA identifiers are double-quoted and case-sensitive), e.g. SELECT * FROM "JKL_LIVEDB"."OCRD". If you don't already know the exact schema name for a company, call list_hana_schemas first rather than guessing. Only SELECT statements are allowed; anything else is rejected.
SAP Business One key tables (T-SQL / MSSQL):
SALES & QUOTATIONS: OQUT(DocEntry,DocNum,CardCode,CardName,SlpCode,DocDate,DocDueDate,DocTotal,GrossProfit,DocStatus,Comments) QUT1(DocEntry,LineNum,ItemCode,Dscription,Quantity,Price,LineTotal,WhsCode,GrssProfit) ORDR(DocEntry,DocNum,CardCode,CardName,SlpCode,DocDate,DocDueDate,DocTotal,GrossProfit,DocStatus,Comments) RDR1(DocEntry,LineNum,ItemCode,Dscription,Quantity,Price,LineTotal,WhsCode,GrssProfit)
AR INVOICES & DELIVERY: OINV(DocEntry,DocNum,CardCode,CardName,SlpCode,DocDate,DocDueDate,DocTotal,GrossProfit,PaidToDate,DocStatus) INV1(DocEntry,LineNum,ItemCode,Dscription,Quantity,Price,LineTotal,WhsCode,GrssProfit) ODLN(DocEntry,DocNum,CardCode,CardName,DocDate,DocTotal,DocStatus) DLN1(DocEntry,LineNum,ItemCode,Dscription,Quantity,Price,LineTotal,WhsCode) ORIN(DocEntry,DocNum,CardCode,CardName,DocDate,DocTotal,DocStatus) RIN1(DocEntry,LineNum,ItemCode,Dscription,Quantity,LineTotal,WhsCode)
PURCHASING: OPQT(DocEntry,DocNum,CardCode,CardName,DocDate,DocTotal,DocStatus) PQT1(DocEntry,LineNum,ItemCode,Dscription,Quantity,Price,LineTotal,WhsCode) OPOR(DocEntry,DocNum,CardCode,CardName,DocDate,DocDueDate,DocTotal,DocStatus) POR1(DocEntry,LineNum,ItemCode,Dscription,Quantity,Price,LineTotal,WhsCode) OPDN(DocEntry,DocNum,CardCode,CardName,DocDate,DocTotal,DocStatus) PDN1(DocEntry,LineNum,ItemCode,Dscription,Quantity,Price,LineTotal,WhsCode) OPCH(DocEntry,DocNum,CardCode,CardName,DocDate,DocDueDate,DocTotal,DocStatus) PCH1(DocEntry,LineNum,ItemCode,Dscription,Quantity,Price,LineTotal,WhsCode)
INVENTORY: OITM(ItemCode,ItemName,ItmsGrpCod,InvntItem,SellItem,PrchseItem,OnHand,IsCommited,OnOrder,LastPurPrc,AvgPrice) OITW(ItemCode,WhsCode,OnHand,IsCommited,OnOrder) OWHS(WhsCode,WhsName,Street,City) OITB(ItmsGrpCod,ItmsGrpNam)
BUSINESS PARTNERS: OCRD(CardCode,CardName,CardType,GroupCode,Phone1,E_Mail,CntctPrsn,Balance,SlpCode,Territory) OSLP(SlpCode,SlpName,Memo,Commission,Phone,Email) OCRG(GroupCode,GroupName,GroupType)
FINANCE: OJDT(TransId,TransType,RefDate,Memo,Ref1,Ref2,Ref3,CreatedBy) JDT1(TransId,Line_ID,Account,Debit,Credit,SYSDebit,SYSCredit,FCDebit,FCCredit,RefDate,LineMemo,ContraAct) OACT(AcctCode,AcctName,GroupMask,ActType,Blocked,CurrTotal,LocTotal)
STATUS CODES: DocStatus = 'O' (Open) | 'C' (Closed) | 'W' (Cancelled) CardType: 'C' (Customer) | 'S' (Supplier) | 'L' (Lead)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | A single SQL SELECT statement with fully schema-qualified table names, e.g. SELECT TOP 5 "CardCode","CardName" FROM "JKL_LIVEDB"."OCRD" |