2008 Oct 29 10:47 PM
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!
2008 Oct 30 11:51 AM
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!
2008 Oct 29 11:27 PM
2008 Oct 30 2:56 AM
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
2008 Oct 30 3:00 AM
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
2008 Oct 30 3:06 AM
Hi Ben,
Dont use Loop Endloop. Just use the statement.
INSERT ZABC FROM ITAB.
This will work.
Thanks,
Chidanand
2008 Oct 30 3:44 AM
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!
2008 Oct 30 5:11 AM
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 .
2008 Oct 30 5:14 AM
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
2008 Oct 30 11:51 AM
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.
2008 Oct 30 12:51 PM
2008 Oct 30 8:24 PM
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?
2008 Oct 30 8:45 PM
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..
2008 Oct 30 8:45 PM