Professional Documents
Culture Documents
Processing Atom
Call SQL
Table of Contents
1 Parameters ............................................................................................................................. 2
1.1 Options for Providing SQL Statements .............................................................................. 5
1.2 Filtering Invalid XML Characters from Database Fields ..................................................... 6
2 Functions ................................................................................................................................ 6
3 Single Processing ................................................................................................................... 8
4 Blocked Processing in Compatibility Mode .............................................................................. 9
5 Blocked Processing in Batch Mode ......................................................................................... 9
6 Optimizing SQL Call for Large SQL Statements .....................................................................11
7 Preventing SQL Injection .......................................................................................................12
Copyrights, Trademarks, and Disclaimers .................................................................................13
Call SQL
In the process flow, use the atom to make SQL calls to a database system.
The Call SQL atom is of simple call type. You do not need a predecessor transformation atom,
if you directly enter statement or statements in the user interface. However, the call SQL atom
provides additional options to define SQL statements in a predecessor transformation atom and
point to the place in the atom either using an XPath statement or a reference to an atom
identifier. For more information, see the 1.1 Options for Providing SQL Statements section.
Use a predecessor atom, for example, to handle large SQL statements.
1 Parameters
Scenario Step Identifier
This is a read-only field. It displays the name of the scenario step for which you develop the
process flow.
Public
2015 SAP SE or an SAP affiliate company.
All rights reserved
Atom Identifier
This is a read-only field. It displays identifier of the atom. The identifier is unique and has the
atom<no> pattern. <no> is a number. The atom identifier enables subsequent atoms to
access data produced by the atom using an XPath expression, for example,
/vpf:Msg/vpf:Body/vpf:Payload[./@id=atom2]/*.
Description
When creating the atom, the integration framework generates a default description. The
description serves as a comment about the task that the atom performs. In the graphical flow
designer, the integration framework displays the text as mouse over. You can change the
default description.
Additionally, you can use the description field to change the default label of the atom displayed
in the graphical flow designer. To provide an individual label, add the label in brackets at the
end of the description. The maximum length of an individual label is ten characters.
Example
The integration framework displays the this is my comment[my Label] string as my
Label for the atom in the graphical flow designer.
SysId
Select the system you want call using SQL. A leading # indicates an explicit value, for example,
#0010000105 calls the system that has the 0010000105 SysId in SLD. If you use an explicit
SysId from SLD, make sure that the system you want to call is identical with the one in SLD at
runtime. Using an explicit value with a leading #, you can use variables and properties.
For more information, click the
button to open the documentation.
Additionally, you have the following options:
B1 System, based on User
Only use the option for scenario steps triggered by HTTP calls or Web services that run in a
session. The HTTP or Web service channel must be associated to a SAP Business One
system through the associatedSrvIP. SLD parameter.
Sender System
Perform the SQL call to the sender system that you have defined in the inbound definition of
the scenario step.
List of database systems in SLD
To calculate the SysId at runtime, do not enter an explicit value, but use an XPath expression
instead. With the XPath expression, you can retrieve a value from the payload generated by the
predecessor transformation atom.
Example
/vpf:Msg/vpf:Body/vpf:Payload[./@id=atom2]/@sysid.
Stop processing if fails
Set the parameter to control the behavior of the integration framework, if an exception occurs
during the SQL call. The default value is false.
Public
2015 SAP SE or an SAP affiliate company.
All rights reserved
If you set the value to false, processing continues, if an exception occurs. You have the
option to introduce an individual error handling in the following XSL transformation atom or
atoms.
If you set the value to true, an exception causes the scenario step processing to fail.
You can display the message in the message log error section with the complete call stack
of the internal processing.
The default error handling of the integration framework restarts the scenario step after one
minute.
The integration framework allows you to provide an individual error handler scenario step in
the scenario package. The scenario step must have the internal queue inbound type. In the
processing phase, define the individual error handling. You can send, for example, an e-mail
to an administrator, or a SAP Business One message to a specific user, insert a message to
a table, and so on. To enable individual error handling for the scenario package, choose
Scenarios Package Design [Definitions] Error Handling and select the error handling
step.
The parameter does not support XPath, variables and properties.
Method
Select the method how the integration framework identifies the SQL method. The following
options are available:
Automatic detection by key word
The integration framework detects the method by the first statement that you enter in the
Default SQL Statement or in the HANA SQL Statement field.
Query statement
If you want to send a query or queries in your SQL call, select Query statement. The
integration framework sets the Processing Mode to Single Processing and the Blocked
Processing Delimiter to a semicolon. You cannot change the settings.
Update statement
If you want to make an update or updates in the database, select Update statement. The
integration framework sets the Processing Mode to Single Processing and the Blocked
Processing Delimiter to a semicolon. You cannot change the settings.
Processing Mode
Select the method how you want to submit the SQL statements to the database. You have the
following options:
Single Processing
Single processing allows you to submit SQL statements call by call to the database. The
integration framework guaranties the order of SQL statements that it submits to the
database.
Blocked Processing in compatibility mode
This option is available to be compatible with older versions of the SQL Call atom. In older
versions, the Blocked Processing checkbox is available. If you select the checkbox, the
integration framework offers same behavior like choosing the Blocked Processing in
compatibility mode option.
NOTE
Do not use this option for new developments.
Public
2015 SAP SE or an SAP affiliate company.
All rights reserved
The XPath points to the <xpath> tag in atom4 that contains the SQL statement. atom4 is an
XSL transformation atom.
In atom4, enter the SQL statement in the following way:
<xpath xmlns="">select ItemCode, ItemName as 'Name' from OITM
where ItemCode = 'A00002'</xpath>
If values in an XPath statement contain a string that starts with ! (exclamation mark) and ends
with _ (underscore), the integration platform (B1iP) interprets it as a variable and the SQL
statement does not work. To avoid errors at runtime, do not enter the XPath statement in the
input field. Instead, enter the transformation atom identifier, for example, #atom4. In the XSL
transformation atom, enter the statement in the <sql> </sql> tag.
To avoid out of memory errors at integration framework runtime, the integration framework in
general reduces SQL statements to 1000 characters in the return payload.
2 Functions
To open documentation, describing the concepts of variables and properties and how to use
them in the context of the process development, click this button.
To save the current parameter definitions of the processing atom, click the button. The
integration framework stores all settings directly in the process flow definition document
(vBIU.bfd). To open the document, click the
icon on the start atom of your flow.
Public
2015 SAP SE or an SAP affiliate company.
All rights reserved
[VarL]
To add, change or delete local variables, click the button. Local variables are valid for the
scenario step for wgich you define them. You can use them in all atoms of the scenario step.
You can assign fixed literals or an XPath that runs against the incoming message at runtime
before the system calls the process flow. In the process flow the value is fixed and you cannot
change it. You can use local variables in XSL coding or in the parameter definition for atoms.
For more information, click the
button
[VarG]
To add, change or delete global variables, click the button. Global variables are valid for the
scenario steps of a scenario package. You can use them in all atoms of the scenario step. You
can assign fixed literals or an XPath that runs against the incoming message at runtime before
the system calls the process flow. Inside the process flow the value is fixed and you cannot
change it. You can use global variables in XSL coding or in the parameter definition for atoms.
For more information, click the
button
[HANA]
To perform a call to the SAP HANA database, click the button.
HANA SQL Statement
Enter the SQL statement or statements for the SAP HANA database.
Note that if a HANA SQL statement contains the table field name, and the table field name
contains lower case characters, enclose the table field name in double quotation marks.
Example
Default SQL Statement: SELECT ItemName FROM OITM WHERE ItemCode=A0001
HANA SQL Statement: SELECT ItemName FROM OITM WHERE ItemCode=A0001
If a database contains special characters that are not Latin, but for example Hebrew in tables,
use the N character in the WHERE clause of an SQL statement to include the special
characters.
Example
SELECT T2.E_MAIL as FromEmail FROM OUSR as T2 WHERE
T2.USER_CODE=N'$userid'
For more information about SAP HANA, in the internet select http://help.sap.com/hana.
[Close]
To close the user interface of the atom, click the button.
Public
2015 SAP SE or an SAP affiliate company.
All rights reserved
3 Single Processing
If you select Single Processing, the integration framework submits each SQL statement in
a transaction to the JDBC adapter. The adapter hands over the statements call by call to the
database. The integration framework guarantees that it hands over the SQL statements and
submits them to the database in the same order as you have entered them. Each call has a
separate payload.
Example
SQL statements:
#select * from tbl1 where [key]='1';select * from tblA;select * from
tblB;update tbl1 set F1='X' where [key]='1';update tbl set F1='Y'
where [key]='2'
The fifth statement leads to an error. <Payload
Result:
<?xml version="1.0" encoding="UTF-8"?>
<Msg>
<Header> ...</Header>
<Body>
...
<Payload Role="C" id="atom5_1" system="0010000108" mode="single" method="Automatic detection
by key word(Automatic detection by key word)" plr="4" dbtype="SQL" blockExecution="false"
compatibilityMode="true" delimiter=";" sql="select * from tbl1 where [key]='1'" disableoutput-escaping="false">
<ResultSet xmlns="urn:com.sap.b1i.adapter:jdbcadapter" rowCount="1">
...
</ResultSet>
</Payload>
<Payload Role="C" id="atom5_2" system="0010000108" mode="single" method="Automatic detection
by key word(Automatic detection by key word)" plr="4" dbtype="SQL" blockExecution="false"
compatibilityMode="true" delimiter=";" sql="select * from tblA" disable-outputescaping="false">
<ResultSet xmlns="urn:com.sap.b1i.adapter:jdbcadapter" rowCount="5">
...
</ResultSet>
</Payload>
<Payload Role="C" id="atom5_3" system="0010000108" mode="single" method="Automatic detection
by key word(Automatic detection by key word)" plr="4" dbtype="SQL" blockExecution="false"
compatibilityMode="true" delimiter=";" sql="select * from tblB" disable-outputescaping="false">
<ResultSet xmlns="urn:com.sap.b1i.adapter:jdbcadapter" rowCount="2">
...
</ResultSet>
</Payload>
<Payload Role="C" id="atom5_4" system="0010000108" mode="single" method="Automatic detection
by key word(Automatic detection by key word)" plr="4" dbtype="SQL" blockExecution="false"
compatibilityMode="true" delimiter=";" sql="update tbl1 set F1='X' where [key]='1'"
disable-output-escaping="false">
<UpdateCount xmlns="urn:com.sap.b1i.adapter:jdbcadapter">1</UpdateCount>
</Payload>
<Payload Role="C" id="atom5_5" system="0010000108" mode="single" method="Automatic detection
by key word(Automatic detection by key word)" plr="4" dbtype="SQL" blockExecution="false"
compatibilityMode="true" delimiter=";" sql="update tbl set F1='Y' where [key]='2'" disableoutput-escaping="false">
<SqlExceptions xmlns="urn:com.sap.b1i.adapter:jdbcadapter">
<SqlException>
<ErrorCode>208</ErrorCode>
<Message>Invalid object name 'tbl'.</Message>
Public
2015 SAP SE or an SAP affiliate company.
All rights reserved
<SqlState>S0002</SqlState>
</SqlException>
</SqlExceptions>
</Payload>
</Body>
</Msg>
The single processing mode is identical with previous Call SQL atom versions where you have
not selected the Blocked Processing checkbox.
10
11
Set result=Field
<ResultSet
<Row>
<Field
<Field
</Row>
<Row>
<Field
<Field
</Row>
.
.
.
xmlns=urn:com:sap:b1i:adapter:jdbcadapter rowCount=3>
label=MenuId name=MenuID>01</Field>
label=Text name=Text>This is a text</Field>
label=MenuId name=MenuID>02</Field>
label=Text name=Text>This is also a text</Field>
Public
2015 SAP SE or an SAP affiliate company.
All rights reserved
12
Public
2015 SAP SE or an SAP affiliate company.
All rights reserved
13