Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

MATNR push as BIGINT to SQL table

Former Member
0 Likes
565

Hi,

My requiremnet is to update a SQL table .

SQL table has field with BIGINT.they are not willing change type to VARCHAR

I wrote a custom code to push the data.I am using DBCO for this process.

I am getting a dump when i push this data.

below is the source code.

Any ideas ?

DATA: BEGIN OF itab OCCURS 0,

matnr like marc-matnr,

maktx LIKE makt-maktx,

werks LIKE marc-werks,

bismt LIKE mara-bismt,

END OF itab.

EXEC SQL.

CONNECT TO 'TEST' AS 'V'

ENDEXEC.

EXEC SQL.

SET CONNECTION 'V'

ENDEXEC.

loop at itab.

shift itab-matnr left deleting leading '0'.

EXEC SQL.

INSERT INTO SapProducts

( ProductID<bigint>, ProductName)

VALUES

(:ITAB-MATNR, :ITAB-MAKTX)

ENDEXEC.

endloop.

Database error text........: "Error converting data type nvarchar to bigint."

Database error code........: 8114

Triggering SQL statement...: "INSERT INTO SapProducts ( ProductID, ProductName

) VALUES ( ? , ? )"

Internal call code.........: "[DBDS/NEW DSQL]"

Please check the entries in the system log (Transaction SM21).

If the error occures in a non-modified SAP program, you may be able to

find an interim solution in an SAP Note.

If you have access to SAP Notes, carry out a search with the following

keywords:

"DBIF_DSQL2_SQL_ERROR" "CX_SY_NATIVE_SQL_ERROR"

"ZCMP_SHELF_UPDATE" or "ZCMP_SHELF_UPDATE"

Edited by: PRAVEEN s on Feb 28, 2008 10:14 PM

Hi,

My requiremnet is to update a SQL table .

SQL table has field with BIGINT.they are not willing change type to VARCHAR

I wrote a custom code to push the data.I am using DBCO for this process.

I am getting a dump when i push this data.

below is the source code.

Any ideas ?

DATA: BEGIN OF itab OCCURS 0,

matnr like marc-matnr,

maktx LIKE makt-maktx,

werks LIKE marc-werks,

bismt LIKE mara-bismt,

END OF itab.

EXEC SQL.

CONNECT TO 'TEST' AS 'V'

ENDEXEC.

EXEC SQL.

SET CONNECTION 'V'

ENDEXEC.

loop at itab.

shift itab-matnr left deleting leading '0'.

EXEC SQL.

INSERT INTO SapProducts

( ProductID<bigint>, ProductName)

VALUES

(:ITAB-MATNR, :ITAB-MAKTX)

ENDEXEC.

endloop.

Database error text........: "Error converting data type nvarchar to bigint."

Database error code........: 8114

Triggering SQL statement...: "INSERT INTO SapProducts ( ProductID, ProductName

) VALUES ( ? , ? )"

Internal call code.........: "[DBDS/NEW DSQL]"

Please check the entries in the system log (Transaction SM21).

If the error occures in a non-modified SAP program, you may be able to

find an interim solution in an SAP Note.

If you have access to SAP Notes, carry out a search with the following

keywords:

"DBIF_DSQL2_SQL_ERROR" "CX_SY_NATIVE_SQL_ERROR"

"ZCMP_SHELF_UPDATE" or "ZCMP_SHELF_UPDATE"

Edited by: PRAVEEN s on Feb 28, 2008 10:14 PM

1 REPLY 1
Read only

murat_kaya
Participant
0 Likes
484

Hi Praveen,

For BIGINT type variables you can use SAP's INTEGER64 data element. Create a variable and assign MATNR value to this variable when inserting to table.

Just don't forget that MATNR field is CHAR18 field and may contain non-numerical values. If there are non-numerical MATNR values, there is nothing you can do to insert those records to a table with BIGINT Material Code field.

Regards,

Murat Kaya