Integration ERROR [S1000] [SAP AG][LIBODBCHDB DLL][HDBODBC] General error;339 invalid number:

Integration ERROR [S1000] [SAP AG][LIBODBCHDB DLL][HDBODBC] General error;339 invalid number:

****************************** INTERNAL ARTICLE *******************************

Product version

 6.6 integrated with Sap B1

Purpose

The purpose of this document is to resolve the error in SAP B1 Integration for HANA.


Problem statement 

Record stucked  on Integration Failure Monitor with error message
ERROR [S1000] [SAP AG][LIBODBCHDB DLL][HDBODBC] General error;339 invalid number: not a valid number string ''1280cbb6-025e-45e2-b2a1-5e75c4090d39''
  from SAP to iVend

Cause

The DataType of IVendID column in IntegrationMapping table of CXSINTEGRATION database is BIGINT.

Comments:

HANA version (less than 2.0) does not support changing the datatype of a column from BIGINT to NVARCHAR.  


Proposed solution

Require  to change data type through sql query. 


Steps 

Execute the below steps on CXSINTEGRATION database.


Create the backup table:
 
CREATE TABLE "CXSINTEGRATION"."IntegrationMapping_Backup"

(

   "ObjectID" int NOT NULL,

   "IVendID" nvarchar(500) NOT NULL,

   "SBOID" int NOT NULL,

   "DBName" nvarchar(100) NOT NULL,

   PRIMARY KEY ("ObjectID", "SBOID", "DBName")

);

 Save the data into backup table:
 

INSERT INTO "CXSINTEGRATION"."IntegrationMapping_Backup"

(SELECT * FROM "CXSINTEGRATION"."IntegrationMapping");

Create the Store Procedure:
CREATE PROCEDURE "CXSINTEGRATION"."CHNAGETYPE_BIGINT_TO_VARCHAR"()

AS
BEGIN
 DECLARE  ColumnCount INT:=0;
SELECT COUNT("SCHEMA_NAME")  INTO ColumnCount
FROM SYS.COLUMNS
WHERE  "COLUMN_NAME"='IVendID' AND "SCHEMA_NAME"='CXSINTEGRATION'
AND "DATA_TYPE_NAME" ='BIGINT';

IF :ColumnCount>0 THEN

  CREATE TABLE "CXSINTEGRATION"."IntegrationMapping_New"

          (

                 "ObjectID" int NOT NULL,

                 "IVendID" nvarchar(500) NOT NULL,

                 "SBOID" int NOT NULL,

                 "DBName" nvarchar(100) NOT NULL,

                 PRIMARY KEY ( "ObjectID" ,"SBOID" ,"DBName")

           );   

           
INSERT INTO "CXSINTEGRATION"."IntegrationMapping_New"

          (SELECT * FROM "CXSINTEGRATION"."IntegrationMapping");

           DROP TABLE "CXSINTEGRATION"."IntegrationMapping";

           CREATE TABLE "CXSINTEGRATION"."IntegrationMapping"

          (

                 "ObjectID" int NOT NULL,

                 "IVendID" nvarchar(500) NOT NULL,

                 "SBOID" int NOT NULL,

                 "DBName" nvarchar(100) NOT NULL,

                 PRIMARY KEY ( "ObjectID", "SBOID", "DBName")

          );    

           INSERT INTO "CXSINTEGRATION"."IntegrationMapping"

          (SELECT * FROM "CXSINTEGRATION"."IntegrationMapping_New");

           DROP TABLE "CXSINTEGRATION"."IntegrationMapping_New";

   END IF;

END;

Execute the Store Procedure:
 
CALL "CXSINTEGRATION"."CHNAGETYPE_BIGINT_TO_VARCHAR"();

Constraints / scenarios 

 Not Applicable