‎2008 Aug 07 2:47 AM
Dear All
I have a problem in ABAP connect SQL,Below is my code snippet sentence.
CONCATENATE 'Insert Into [timportcortrol]'
'(zucode,zstate,zdate,zkind) Values('''
VG_PCID ''','''
'1'','''
SY-DATUM ''','''
'1' ''')'
INTO SQL.
CALL METHOD OF REC 'Execute'
EXPORTING #1 = SQL
#2 = CON
#3 = '1'.
IF NOT SY-SUBRC = 0.
MESSAGE I000 WITH 'Download to [timportcortrol] failure,Please Check the SQL Connect!!! '.
EXIT.
ENDIF.
*******************************************************************
"Con:is the connect SQL String ,the connect SQL is Okay.
I debug this code,when I used u2018Select u2026sentenceu2019,the program can work.if I use u2018insert intou2019 then canu2019t work,but I copied the SQL of the u2018inset Into sentenceu2026u2019run it into SQL server then it can work also.
And I found the SY-SUBRC eq u20182u2019.whatu2019s mean about of the sy-subrc eq u20182u2019.
I think the insert into sentence in abap I have write the wrong ,but I canu2019t assurance.
The Insert Into Sentence is:u2019 Insert Into [timportcortrol](zucode,zstate,zdate,zkind) Values('20080807094713','1','20080807','1')u2019
Could you give me some advice for this issue?
Thanks of all
Sun.
‎2008 Aug 07 4:56 AM
Hi
I think the problem is with the date format "20080807094713". You should know first how the date is stored in the underlying database. In that format we have to pass the date in the SQL DML statements.
Try "07-Aug-2008' for example and check.
Hope it helps.
Murthy
‎2008 Aug 07 9:10 AM
hi,Murthy
Thanks for your help.
But the field in SQL database is not date format ,is char.so i think is not the format wrong.
Thanks
Sun
‎2008 Aug 15 4:40 AM
‎2008 Sep 09 9:34 AM
Hi can you just help out for the procedure to connect SAP TO SQL SERVER is there any Bapi for the same .
Regards
Shankar