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

Re: Runtime error for updating z table

Former Member
0 Likes
1,856

Hi all,

I have a Z table ZABC with 2 following fields

REC1 type PERSNO length 8

+REC2 type STRING length 1000 +

In my program I declared an internal table like this

ITAB  TYPE TABLE OF ZABC WITH HEADER LINE.

At the end of the program, when I have the new info, I passed them into ITAB, and loop at it to update the Z table

LOOP AT ITAB.
    INSERT ZABC FROM ITAB.
  ENDLOOP.

Then I got run time error saying

Runtime Errors DBIF_RSQL_INVALID_RS

Exceptn CX_SY_OPEN_SQL_DB

An exception occurred. This exception will be dealt with in more detail

below. The exception, assigned to the class 'CX_SY_OPEN_SQL_DB', was not

caught, which

led to a runtime error. The reason for this exception is:

The maximum length of the long field of the specified table is defined

in the ABAP Dictionary. The current length of the long field corresponds

to the value of the preceding field, which consequently

must be numeric.

In this case, the value in this field was greater than the maximum value

defined for the long field in the ABAP Dictionary.

The term "long field" refers to all fields that are created in the ABAP

Dictionary with the data type STRING, RAWSTRING, LCHR, or LRAW.

The problem is at this position

LOOP AT ITAB.
   INSERT ZABC FROM ITAB.
  ENDLOOP.

I know something wrong with the string type but I need to update the whole string structure for the whole record type (rather than updating field by field). need help! thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,539

hi,

the syntax would be as follows:

INSERT ZABC FROM TABLE ITAB ACCEPTING DUPLICATE KEYS.

This will discard the duplicate records & append all the other records from table itab into zabc.

LOOP ....... ENDLOOP statements are not required.

Regards,

Jignesh.

Hi all,

I have a Z table ZABC with 2 following fields

REC1 type PERSNO length 8

+REC2 type STRING length 1000 +

In my program I declared an internal table like this

ITAB  TYPE TABLE OF ZABC WITH HEADER LINE.

At the end of the program, when I have the new info, I passed them into ITAB, and loop at it to update the Z table

LOOP AT ITAB.
    INSERT ZABC FROM ITAB.
  ENDLOOP.

Then I got run time error saying

Runtime Errors DBIF_RSQL_INVALID_RS

Exceptn CX_SY_OPEN_SQL_DB

An exception occurred. This exception will be dealt with in more detail

below. The exception, assigned to the class 'CX_SY_OPEN_SQL_DB', was not

caught, which

led to a runtime error. The reason for this exception is:

The maximum length of the long field of the specified table is defined

in the ABAP Dictionary. The current length of the long field corresponds

to the value of the preceding field, which consequently

must be numeric.

In this case, the value in this field was greater than the maximum value

defined for the long field in the ABAP Dictionary.

The term "long field" refers to all fields that are created in the ABAP

Dictionary with the data type STRING, RAWSTRING, LCHR, or LRAW.

The problem is at this position

LOOP AT ITAB.
   INSERT ZABC FROM ITAB.
  ENDLOOP.

I know something wrong with the string type but I need to update the whole string structure for the whole record type (rather than updating field by field). need help! thanks!

12 REPLIES 12
Read only

Former Member
0 Likes
1,539

instead of loop endloop

try

INSERT ZABC FROM table ITAB.

Read only

Former Member
0 Likes
1,539

Hi,

make sure that the data in itab must be in a proper format

if u just want to update the string field only then syntax be like this.

INSERT INTO dbtab VALUES wa.

when u use..........

INSERT INTO dbtab from itab

by default it trys to insert in the first column first.

Thanks & Regards

Ruchi Tiwari

Read only

0 Likes
1,539

Thanks, I will try insert ZABC from TABLE itab.

@Ruchi, I'm not sure what wa is, can you be more specific? thanks for your reply

Read only

Former Member
0 Likes
1,539

Hi Ben,

Dont use Loop Endloop. Just use the statement.


INSERT ZABC FROM ITAB.

This will work.

Thanks,

Chidanand

Read only

0 Likes
1,539

Hi Chidanand, thanks for your reply.

Since itab has many records in it, to make sure they all update my ztable, I think I should have to loop thru it. Please correct me if I'm wrong, thanks!

Read only

0 Likes
1,539

hi ,

i am not sure that you are declaring a field in ztable of type string with lenth 1000 is correct .

still try to isert your data into database table in a single shot by the below statement .

INSERT database table FROM TABLE itab ACCEPTING DUPLICATE KEYS .

because without ACCEPTING DUPLICATE KEYS it can produce a dump found any duplicate key .

thanks and regards .

Read only

0 Likes
1,539

HI Ben,

In that case you need to put a loop Endloop and update the database table by the header of the internal table accepting duplicate keys....

Thanks,

Chidanand

Read only

Former Member
0 Likes
1,540

hi,

the syntax would be as follows:

INSERT ZABC FROM TABLE ITAB ACCEPTING DUPLICATE KEYS.

This will discard the duplicate records & append all the other records from table itab into zabc.

LOOP ....... ENDLOOP statements are not required.

Regards,

Jignesh.

Read only

0 Likes
1,539

Thanks all, I will try it out and let you guys know...

Read only

0 Likes
1,539

Hi guys, I'm still getting the runtime error, same reason, the thing is the Z table is blank now, so it should not be the duplicate problem..

Any suggestion?

Read only

Former Member
0 Likes
1,539

Hi all,

I have figured it out, and now it works, the problem is string type of rec2 in ztable, I changed it to rawstring..

Thanks all, any contribution rewarded..

Read only

Former Member
0 Likes
1,539

string type in ztable