We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

RE:[sap-dev] How to Update a Database Table Field (Type Integer) Using NATIVE SQL

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Reply from Pierre_Richer on Jan 23 at 11:48 AM
Hi andchi,

Here is an example on how I use Native SQL with SQL Server.

1 - Define the SQL DB in table DBCON
2 - Be sure that your SAP Server can access the SQL Server
3 - Define a user + pw on SQL Server DB to be use with DBCON
4 - Be sure you have the right component on you SAP server that can handle
a connection with SQL Server (???.dll if you are on Windows) check with
you Basis.
5 - Don't forget your commit. I don't remember if there is an implicit
one at the end of the program with Native SQL

How to connect

method connect
try.
EXEC SQL.
CONNECT TO 'MSSQL-TEST' AS :HANDLE
ENDEXEC.

EXEC SQL.
SET CONNECTION :HANDLE
ENDEXEC.

connect_status = connected.

catch cx_sy_native_sql_error.
connect_status = not_connected.
endtry.
endmethod.



Update Code snipet
if connect_status = connected.
EXEC SQL.
UPDATE tblHU SET tblHU.STATUS = :IM_STATUS, tblHU.ERDAT = :ls_hu-
erdat, tblHU.ERZET = :ls_hu-erzet
WHERE tblHU.EXIDV = :IM_EXIDV
ENDEXEC.

EXEC SQL.
commit
ENDEXEC.
endif.

---------------Original Message---------------
From: andchi
Sent: Wednesday, January 23, 2013 11:02 AM
Subject: How to Update a Database Table Field (Type Integer) Using NATIVE SQL

Hi Horacio
Thanks for the reply.
All the cases mentioned are okay .
1. the database server is Microsoft sql server.
2. I am connecting to the database via excec sql
3. yes,the user i use has the rights to update
4. yes the database table has update right granted for the user
5. the value i want exists .
6. There is no other exec sql statement after this update

So,i still have problem.

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2013 Ziff Davis, Inc. and message author.
Ziff Davis, Inc. 28 E 28th Street New York, NY 10016
Pierre_Richer  

Senior SAP System Analyst
achievements
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Have an SAP Question? Ask Your Peers at Toolbox for IT

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language