‎2007 Feb 16 10:36 AM
Hi,
The following code;
*************************************************
DATA: BEGIN OF str_insert,
a(3) TYPE c,
b(3) TYPE c,
END OF str_insert.
EXEC SQL.
SET CONNECTION DEFAULT
ENDEXEC.
str_insert-a = 'a'.
str_insert-b = 'b'.
EXEC SQL.
INSERT INTO ZSAP VALUES :str_insert
ENDEXEC.
****************************************************
The Structure of the ZSAP table (There is no data in ZSAP);
A CHAR 3 (Primary Key)
B CHAR 3
I cannot instert a record to this table it throughs the following error;
Runtime Errors DBIF_DSQL2_SQL_ERROR
Exceptn CX_SY_NATIVE_SQL_ERROR
How could use a structure to insert values into ZSAP?
Thanks,
Kishan
‎2007 Feb 16 10:44 AM
Hi ,
Follow this example for referance.
DATA: exc_ref TYPE REF TO cx_sy_native_sql_error,
error_text TYPE string.
TRY.
EXEC SQL.
INSERT INTO scarr
(MANDT, CARRID, CARRNAME, CURRCODE, URL)
VALUES ('000', 'FF', 'Funny Flyers', 'EUR',
'http://www.ff.com');
INSERT INTO scarr
(MANDT, CARRID, CARRNAME, CURRCODE, URL)
VALUES ('000', 'EF', 'Easy Flyers', 'EUR',
'http://www.ef.com');
ENDEXEC.
CATCH cx_sy_native_sql_error INTO exc_ref.
error_text = exc_ref->get_text( ).
MESSAGE error_text TYPE 'I'.
ENDTRY.
Regards,
Ravi
‎2007 Feb 16 10:38 AM
‎2007 Feb 16 10:44 AM
Hi ,
Follow this example for referance.
DATA: exc_ref TYPE REF TO cx_sy_native_sql_error,
error_text TYPE string.
TRY.
EXEC SQL.
INSERT INTO scarr
(MANDT, CARRID, CARRNAME, CURRCODE, URL)
VALUES ('000', 'FF', 'Funny Flyers', 'EUR',
'http://www.ff.com');
INSERT INTO scarr
(MANDT, CARRID, CARRNAME, CURRCODE, URL)
VALUES ('000', 'EF', 'Easy Flyers', 'EUR',
'http://www.ef.com');
ENDEXEC.
CATCH cx_sy_native_sql_error INTO exc_ref.
error_text = exc_ref->get_text( ).
MESSAGE error_text TYPE 'I'.
ENDTRY.
Regards,
Ravi
‎2007 Feb 16 11:11 AM
‎2007 May 11 6:04 PM
Hello..
loop at T_PC.
loop at T_PCD .
at new NUMREFERENCIA.
exec sql.
INSERT INTO tblPolizaContableR3
(LibroMayor, PeriodoContable, Prefijo, NumReferencia,
Fecha, FuenteDiario, ComentarioPoliza, Moneda,
TipoCambio, RefExternaID1, RefExternaID2, RefExterna1,
RefExterna2, DescRefExterna)
VALUES (:T_PC-LIBROMAYOR, :T_PC-PERIODOCONTABLE,
:T_PC-PREFIJO, :T_PC-NUMREFERENCIA, :T_PC-FECHA,
:T_PC-FUENTEDIARIO, :T_PC-COMENTARIOPLIZA, :T_PC-MONEDA,
:T_PC-TIPOCAMBIO, :T_PC-REFEXTARNAID1, :T_PC-REFEXTERNAID2,
:T_PC-REFEXTERNA1, :T_PC-REFEXTERNA2, :T_PC-DESCREFEXTERNA)
endexec.
endat.
exec sql.
INSERT INTO tblPolizaContableDetR3
(LibroMayor, PeriodoContable, Prefijo, NumReferencia,
Partida, Cuenta, CuentaIMSA, CCostoIMSA,
Cargo, Abono, ComentarioPartida)
VALUES (:T_PCD-LIBROMAYOR, :T_PCD-PERIODOCONTABLE,
:T_PCD-PREFIJO, :T_PCD-NUMREFERENCIA, :T_PCD-PARTIDA,
:T_PCD-CUENTA, :T_PCD-CUENTAIMSA, :T_PCD-CCOSTOIMSA,
:T_PCD-CARGO, :T_PCD-ABONO, :T_PCD-COMENPARTIDA)
endexec.
endloop.
Hope this help you.
Regards, Gustavo Estrada