Quantcast
Channel: SAP / .NET Interoperability » SAP R/3
Viewing all articles
Browse latest Browse all 5

How To Use The New SQL-Like Query Language XtractQL To Retrieve SAP Business Data

0
0

Theobald Software released a new product suite called ERPConnect Services for SharePoint 2010. The product contains a new kind of query language named XtractQL to query SAP business data in a SQL-like manner. XtractQL or XQL is a combination of SQL and ABAP language syntax statements to simplify querying SAP systems.

XtractQL allows querying SAP objects like tables, BW-Cubes and SAP Queries. In addition XtractQL executes function modules (BAPIs) and returns metadata for objects. It can even execute MDX statements. Each XQL query is returning a data table object as result set. In case of the execution function modules the caller must define the returning table explicitly. XtractQL is very useful in situations where you want or need to handle dynamic statements.

ERPConnect Services for SharePoint 2010 (ECS) provides an additional tool, the XtractQL Explorer (see screenshot below), to learn more about the query language and to test XQL queries. You can use this tool independent of SharePoint 2010, but you need access to a SAP system.


The screenshot shows different samples of XQL queries. The following list shows a couple of other samples of XQL queries you can use in your SharePoint applications:

SELECT TOP 5 * FROM T001W WHERE FABKL = ‘US’

This query selects the top 5 records of the SAP table T001W where the field FABKL equals the value US.

SELECT * FROM MARA WITH-OPTIONS(CUSTOMFUNCTIONNAME = ‘Z_XTRACT_IS_TABLE’)

This query selects all records and fields of the SAP table MARA using a custom SAP function module to retrieve the data called Z_XTRACT_IS_TABLE.

SELECT MAKTX AS [ShortDesc], MANDT, SPRAS AS Language FROM MAKT

This query selects all records of the SAP table MAKT. The result set will contains three fields named ShortDesc, MANDT and Language.

SELECT TOP 30 LIPS-LFIMG, LIPS-MATNR, TEXT_LIKP_KUNNR AS CustomerID

    FROM QUERY ‘S|ZTHEO02|ZLIKP’

    WHERE SP$00002 BT ’0080011000′AND ’0080011999′

This statement executes the SAP Query “S|ZTHEO02|ZLIKP” (name includes the workspace, user group and the query name). As you can see XtractQL extends the SQL syntax with ABAP or SAP specific syntax elements. This way you can define fields using the LIPS-MATNR format and SAP-like where clauses like “SP$00002 BT ’0080011000′AND ’0080011999′”.

SELECT * FROM BWQUERY ’0D_DECU/VARDEMO01′

WHERE MAT03 EQ ‘M03′, SALESORG BT ’1000′ AND ’3000

This query executes a query against a specific SAP BW cube using a where clause.

DESCRIBE FUNCTION ‘SD_RFC_CUSTOMER_GET’ GET EXPORTS

This query returns metadata about the export parameters of the SAP function module.

DESCRIBE QUERY ‘G|ZTHEO1|ZTHEOSQUERY’ GET FIELDS

This query returns metadata about the defined SQP Query.

EXECUTE FUNCTION ‘SD_RFC_CUSTOMER_GET’

    EXPORTS KUNNR=’0000003340′

    TABLES CUSTOMER_T INTO @RETVAL;

This query executes the SAP function module SD_RFC_CUSTOMER_GET and returns as result the table CUSTOMER_T (defined as @RETVAL).

ERPConnect Services runtime provides three kind of libraries to integrate with your application: Silverlight, Desktop and SharePoint client library. See product documentation for more information.

Here an example of how to use the libraries in code, e.g. within a web part project:

using ERPConnectServices;


ERPConnectServiceClient client = new ERPConnectServiceClient();

DataTable dt = client.ExecuteXQL(“SELECT TOP 50 * FROM MAKT”);

The ExecuteXQL method call of the ERPConnect Service Application in SharePoint will execute the XtractQL command against the defined SAP system.

There is also another way to use XtractQL. ERPConnect Services for SharePoint 2010 includes a Visual Studio 2010 Designer plugin. Similar to the LINQ to SQL designer, the ECS designer creates automatically code for you, see screenshot below:


You will find more information about the XtractQL syntax and ERPConnect Services for SharePoint 2010 product itself at the website of Theobald Software. There is also an evaluation version available.

http://www.theobald-software.com/de/products/erpconnectservices.htm



Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images