Skip to Content
0

The local variable return NaN value in B1if sqlCall

Mar 02 at 06:42 AM

84

avatar image
Former Member

Experts,

1. I create a sqlCall ATOM to a step, with below SQL script:

#SELECT DocEntry, CardCode, CardName, DocDate, DocTotal FROM $TableName WHERE DocStatus = '$DocStatus' OR '$DocStatus' = ''

2. Then I add two local variables as below picture:

3. This is Inbound - Channel

Result: This is the debug result, the values of "TableName" and "DocStatus" are blank.

Any suggestion?

Best Regards!

Robin Feng

2018.3.2

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member
Mar 02 at 05:25 PM
0

Hello,

you've defined that the values of the two variables are taken from the sender/test message ($msg/...).

It's seems your sender/test message is either not defined or you didn't handover values for the given paths.

How does your sender/test message look like?

Best regards

Bastian

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hello Bastian,

This is the sender/test message:

<?xml version="1.0" encoding="UTF-8"?>
<GetDocList xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms" xmlns="http://tempuri.org/">
  <TableName>ORDR</TableName>
  <DocStatus>O</DocStatus>
</GetDocList>

Best Regards

Robin

0
Former Member

Hello,

I made a further attempt.

I change the sender/test message like this:

<?xml version="1.0" encoding="UTF-8"?>
<GetDocList>
  <TableName>ORDR</TableName>
  <DocStatus>O</DocStatus>
</GetDocList><br>

The 2 variables have values, but the $TableName of SQL statement is still NaN, and the $DocStatus is fine.

0
Former Member

To avoid cross-site scripting, the integration framework checks variables in an SQL statement of an SQL call atom at runtime. If the variable is set in quotations marks (apostrophe), the integration framework handles it as a string, otherwise as a number. If the variable is not in quotation marks and not a number, the integration framework replaces the value withNaN. If you use a variable, for example, for a table name, you can avoid this behavior by explicitly type-casting the variable to a string using $string(variable-name).

1
Former Member

Hello Bastian,

Thanks a lot.

The "NaN" issue was fixed, after I use this SQL script:

#SELECT DocEntry, CardCode, CardName, DocDate, DocTotal FROM $string(TableName)
WHERE DocStatus = '$DocStatus'  OR '$DocStatus' = ''
0