Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Restricting the INSERT from dump

Former Member
0 Kudos
872

Hi,

I am uploading afile into one database table.Whenever a wrong file(which is not the type of the data base table) is uploaded,the program goes for dump at the at the INSERT statement.

Please guide me how to avoid this dump.

Thanks in Advance.

Edited by: Ginger on Jul 2, 2009 6:47 AM

9 REPLIES 9

Former Member
0 Kudos
232

Pleae make sure that the duplicate records are not inserted in database,otheriwse it will lead to dump.

use accepting duplicate key,if requirment there for duplicate records.

Former Member
0 Kudos
232

hi ,

U can catch the Error by using sy-subrc = 0 then Insert.

if sy-subrc = 0.

Insert statment.

elseif .

message type e.

endif.

hope this will help U.

if duplicates are there , then use Delete adjcent duplicate from itab comparing <Field name>.

Regards,

Prakash

Edited by: Abaplover on Jul 2, 2009 12:50 PM

Former Member
0 Kudos
232

Hi,

It always better to validate the records of the uploaded file data before inserting it to the database table. Loop at the uploaded records and validate each fields with respect to database table, maintain a error log table and populate it for invalid records. After validation, if the error log table is initial then go for insert else display error log report.

If you don't any validation in the program then you have to compulsorily maintain proper & validate data in the upload file to match database table field data type and other criteria to avoid short dump.

Thanks,

Muthu

Former Member
0 Kudos
232

Hi,

You may use CATCH......... ENDCATCH for catching the system exceptions,

Regards

Raju chitale

Former Member
0 Kudos
232

Hi Ginger ,

From your problem I feel -

When you upload file to internal table , the internal table must be having same structure of that database table.

If your internal table is not updated properly (check sy-subrc <> 0 ) then you can avoide updating database.

Former Member
0 Kudos
232

Hi,

Never insert or update the database table blindly. You need to validate the data before any updation. Once you upload the data from file, check whether the data uploaded is in correct format. If the data validation is successful, you can insert only those data to database.

Clemenss
Active Contributor
0 Kudos
232

Hi Ginger,

this is good for the addition

FROM TABLE itab [ACCEPTING DUPLICATE KEYS] ...

The SY-SUBRC will tell you if it is OK.

Regards,

Clemens

former_member219399
Active Participant
0 Kudos
232

Hi Ginger,

Can you tell me what is the shortdump says?

May be put this insert statement in a try endtry block. But I t=dont think this will help you.

Try.

insert *******.

catch CX_SY_OPEN_SQL_DB

endtry.

With regards,

Vamsi

Former Member
0 Kudos
232

Check the dump analysis (ST22). If the issue is because of the duplicate records then either remove duplicate entries from your internal table before inserting or use the addition ACCEPTING DUPLICATE KEYS in the insert statement. This will ignore all the duplicate records.

Hope this helps you,

Susanta