You have an ABSL Script that execute a query to search for specific instance of current or another BO. You provide some parameters to the query, execute it and now value was returned, even if there is an instance that match the parameters used. You take the same parameters and execute the query directly on C4C/ByD frontend or on Repository Explorer and a valid result returned.
All Versions of SAP Hybris Cloud for Customer
All Versions of SAP Business ByDesign
Reproducing the Issue
1. Execute ABSL Script that execute query
2. Query executed and no value was returned
3. Execute the same query with same parameters on frontend or on Repository Explorer
4. Query return value
Depending on the specific parameters that you are using, some additional treatment should be performed on the parameters values before execution of the query on ABSL Script. When using elements with Data Type ID or any other Data Type similar, you need to make sure that the value used is the correct value and remove any non-relevant data, otherwise query may not work. Elements with DataType ID are handle as "String" data, so you need to be careful when using/passing integers values as search parameters of the query.
E.g.: You read an integer value from frontend or another retrieve process (Association, Web Service, Query) and the value received is "0000000001234567". If you pass this value directly to query as search parameter value for a element with data type ID or similar, query will look for instance with value "0000000001234567".
When assigning Integer value to String type data, system automatically convert all memory allocated of this Integer to an Array of characters (String). As usually we don't use the full memory of the Integer element, during the conversion to String some additional 0 could appear on the final value of the String variable/element.
In case this additional zeros need to be removed to properly use the data for Queries, Functions and others methods, we can use the method ".RemoveLeadingZeros", that will remove all non-relevant zeros on the left.
E.g.: Value received was "00000098765432". After using ".RemoveleadingZeros" we have "98765432".
Kindly adapt your ABSL Script to use the method ".RemoveleadingZeros" before passing Numerical and/or Characters-Based Identifiers to query parameters. This way you avoid any kind of value mismatch during query preparation.
Check the SAP Cloud Application Studio Help Document at https://help.sap.com/viewer/p/SAP_CLOUD_APPLICATIONS_STUDIO on Section "18.104.22.168 - Built-In Functions for Identifiers"
Query; ABSL; Script; No value; No Return; RemoveLeadingZeros; , KBA , AP-RC-BDS-SCR , ByDesign Studio Scripting (ABSL) , Problem