2009 Nov 23 10:12 AM
Hi Friends,
I am getting the CX_SY_OPEN_SQL_DB type of exception quit offen.
There is no duplicate records in the table. still i am gettin the
exception.
TRY.
INSERT ZSC_FOUNDRY_RECS FROM TABLE IT_VAL_FOUNDRY_RECS.
CATCH CX_SY_OPEN_SQL_DB.
ROLLBACK WORK.
MESSAGE I234. "Error occured while inserting record into ZSC_FOUNDRY_RECS table
ENDTRY.
Could any one tel mem, what could be the reason for this?
Hi,
Check if you have the MANDT field in your internal table.
2009 Nov 23 10:15 AM
Dont check the database table , check the internal table content from which the records are inserted and also consider blank values of field while doing so.
2009 Nov 23 10:19 AM
I have checked bot the Internal table and the Database table.
Another thing is I dont want to modify the record. If the record is already present, then i should not insert into the database.
2009 Nov 23 10:25 AM
Hi,
Check if you have the MANDT field in your internal table.
2009 Nov 23 10:27 AM
>
> Another thing is I dont want to modify the record. If the record is already present, then i should not insert into the database.
Hello,
This means that you must use INSERT statement only. UPDATE & MODIFY are not to be used.
Also FYI if you try to insert a record with the same key which exists in the DB you will get the exception DBIF_RSQL_KEY_ALREADY_EXISTS of class CX_SY_OPEN_SQL_DB.
May be you can get the text of this exception & check what is the error you are getting:
data OREF type ref to CX_ROOT.
data TEXT type STRING.
CATCH CX_SY_OPEN_SQL_DB into OREF.
TEXT = OREF->GET_TEXT( ).BR,
Suhas
Edited by: Suhas Saha on Nov 23, 2009 11:37 AM
2009 Nov 23 10:15 AM
change it as
MODIFY ZSC_FOUNDRY_RECS FROM TABLE IT_VAL_FOUNDRY_RECS
2009 Nov 23 10:18 AM
change it as
MODIFY ZSC_FOUNDRY_RECS FROM TABLE IT_VAL_FOUNDRY_RECS.
i hope the IT_VAL_FOUNDRY_RECS structure is same as of ZSC_FOUNDRY_RECS
2009 Nov 23 10:27 AM
Hi,
Try these things:
1) Use COMMIT WORK AND WAIT after Insert and update statement to release the lock.Check for sy-subrc = 0.
2) Use Select single for update instead of Select single.
3) Rollback if insert statement fails.
4) Try to catch the exception by inserting exception block.
Thanks & Regards
Rocky.
2009 Nov 23 10:40 AM
I have a question, Is there a possibility that, i have inserted records from internal table. I have not used the commit work statement. then i am having another insert statement, where i am trying to update the DB from another internal table.
Wheter, any exeception will be raised?
2009 Nov 23 10:43 AM
Hi,
Yes, exception will be raised, if within a loop you are trying to insert a data and without committing trying to update or read the data in the next loop pass.
Thanks & Regards
Rocky
2009 Nov 23 10:52 AM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |