Application Development and Automation 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: 
Read only

abap runtime error DBIF_DSQL2_SQL_ERROR

Former Member
0 Likes
2,285

Hi guys,

when I run my program I got this error:

DBIF_DSQL2_SQL_ERROR

Database error text........: "ORA-01400: cannot insert NULL into

("NAPL"."KUPCI"."MSISDN")#"

my code segment looks like this:

.......

LOOP at itab.

EXEC SQL.

INSERT INTO KUPCI (POZIVNI, MSISDN, IME, PREZIME) VALUES

(:itab-poz,

:itab-tel,

:itab-name,

:itab-surname)

ENDEXEC.

ENDLOOP.

......................

KUPCI is oracle db table (with fields pozivni, msisdn, ime, prezime, )

dbcon connection is OK, what could be the problem??

thanks

nihad

18 REPLIES 18
Read only

GauthamV
Active Contributor
0 Likes
2,231

Check these notes.

600141

1035034.

Read only

Former Member
0 Likes
2,231

Nihad,

from the exception it appaers you are passing some null value to one of the table field which has a NOT NULL property in oracle db.

Please check your table in Oracle and figure out which table fileds has NOT NULL properties i.e. it can not accept blank values.

Check in debug in what fileds you are passing NULL and violating table rules.

i hope this will solve your problem.

Read only

0 Likes
2,231

INSERT INTO KUPCI (POZIVNI, MSISDN, IME, PREZIME) VALUES

(:itab-poz,

:itab-tel,

:itab-name,

:itab-surname)

field itab-tel has some value(not null) but again I got same error??

any idea hot to solve this please?

nihad

Read only

0 Likes
2,231

Check,

Other than MSISDN , is there any other field which can not accept not null. Also check your passing primary keys of table properly.

Generally primary keys are not null value.

Edited by: santosh sarda on Mar 25, 2009 2:23 PM

Read only

0 Likes
2,231

Yes, there is one omore field other than MSISDN that is primary key and cannot accept NULL,

how to treat these fields from abap code?

thanks,

nihad

Read only

0 Likes
2,231

Pass value to that field while inserting a record in database from ABAP code.

this will resolve your issue.

Read only

0 Likes
2,231

I pass value itab-tel (not null) to MSISDN, but again error??

nihad

Read only

0 Likes
2,231

Hi,

If it is Primary Key, the value should be Not-Null and unique.

So, ensure that it is not a duplicate.

thanks\

Mahesh

Read only

0 Likes
2,231

Other than MSIDN, which field is not null?

Read only

0 Likes
2,231

Filed POZIVNI is primary key, NOT NULL..

thanks,

nihad

Read only

0 Likes
2,231

Check if your itab-poz has valid value.

Read only

0 Likes
2,231

it has value. thing is that in zbt_bonus I have 8 fields and in oracle KUPCI I have 12 fields

and I do:

select * from zbt_bonus into table itab.

* INSERT THE RECORDS INTO ORACLE DATABASE

LOOP at itab.
EXEC SQL.
INSERT INTO KUPCI (ID_RACUN,..........
..........

so 4 fields in KUPCI should remain empty after I insert record from abap.

these 4 fields are not primary keys...how should I declare them in sap program?

thanks,

nihad

Edited by: nihad omerbegovic on Mar 25, 2009 11:41 AM

Read only

0 Likes
2,231

Declare a type structure contaning all the fileds from KUPCI .


types :  begin of t_kupci,
            field1( 10 ) type c, " Enter actual fileds similar to KUPCI here..
            field2( 10 ) type c,
            field3( 10 ) type c,
            field4( 10 ) type c,
           ....
            filed12(10) type c
             end of type t_kupci.

data : wa_kupci type t_kupci.

LOOP at itab.

wa_kupci - field1 = itab-field1.

*and move curresponding fields from itab to kupci.
*at the end..

insert into KUPCI values wa_kupci. " Check prepoer syntax by F1 on Insert in abap editor.

endloop.

*instead of insert in loop, you can also think of collecting it in internal table and update database table directly from internal table.check the sytax in f1.

endllo.

Read only

0 Likes
2,231

what about 4 fields that are not in itab, but are contained in KUPCI?

i.e. I want to initialize

itab-id_racun = 0. gives syntax error

thanks,

nihad

Edited by: nihad omerbegovic on Mar 25, 2009 12:55 PM

Read only

0 Likes
2,231

if those 4 fileds are not specified as 'NOT NULL' in db , dont worry about them, those will be passed as initial to oracle db.

What is the syntax error you are getting? i guess you need to contact some senior ABAP devloper since it appers you have very limited knowldge of ABAP.

Please allot poits for useful answers.

Read only

Former Member
0 Likes
2,231

It si resolved, error due to uncompatible data types.

Nihad

Read only

Former Member
0 Likes
2,231

Hi guys,

I use dbcon to insert new record to oracle table after sale is done. Let's assume I have 10 sales and I store data in z table but can not insert into oracle table because dbcon is not temporary working. when dbcon is reconnected I want these 10 records (from the moment of last insert) to be inserted into oracle table.

How can I handle this scenario?

Thanks,

Nihad

Read only

Former Member
0 Likes
2,231

have any idea?

thanks

nihad

Edited by: nihad omerbegovic on Mar 31, 2009 12:28 PM