on 2021 Jan 11 10:25 AM
Hi All,
i have a problem with Insert from SAP to Sql Server
EXEC SQL.
open dbcursor for
INSERT INTO table_name
()
VALUES ()
Error Message
KERNEL_ERRID DBIF_DSQL2_SQL_ERROR
SQLCODE 7392
SQLMSG Unable to start a transaction for OLE DB provider "" of linked server "".ENDEXEC.
Hello Mohamed Aziz,
Pls. find below the code snipped - Inserting values from SAP to SQL/Oracle server vide Native SQL.
This worked for me.
REPORT ZSAMPLE.
data:
it_tab TYPE TABLE OF ZPRODUCT,
wa_tab TYPE ZPRODUCT,
lv_flag TYPE c.
*BREAK-POINT.
SELECT * from ZPRODUCT into TABLE it_tab.
EXEC SQL.
connect to 'ORCL' as 'ORA_DB'
ENDEXEC.
EXEC SQL.
set connection 'ORA_DB'
ENDEXEC.
* if sy-subrc eq 0.
*
* MESSAGE 'Testing Ok ' TYPE 'S'.
* endif.
loop at it_tab into wa_tab.
try.
EXEC SQL.
INSERT INTO CWORKS VALUES ( :wa_tab-PROD_ID,
:wa_tab-PROD_NAME,
:wa_tab-PROD_QTY,
:wa_tab-PROD_UOM,
:wa_tab-PROD_PRICE )
ENDEXEC.
ENDTRY.
if sy-subrc eq 0.
lv_flag = 'X'.
endif.
clear:wa_tab.
endloop.
if lv_flag = 'X'.
MESSAGE 'Record Inserted Successfully' TYPE 'S'.
endif.
Thanks
Sathish Kumar Sidhaiyan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
8 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.