Skip to Content
author's profile photo Former Member
Former Member

Insert statement is returning sy-subrc 4

I have genereated a table maintenance for a custom table and maintaining values using the table maintenance.

The below code is quto generated.

INSERT ZCSC_EAP_BTI .

When I check in debug it returns sy-subrc = 4. But the values are not in the table.

What can be issue.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Dec 04, 2007 at 11:02 AM

    <b>Insert (into database) is valid in this format, but obsolete</b>

    Read the ABAP help for the keyword INSERT, and you'll see that sy-subrc = 4 means:

    <i>At least one row could not be inserted, because the database table already contains a row with the same primary key or a unique secondary index.</i>

    You should be able to use UPDATE rather than INSERT. Or just use MODIFY.

    matt

    Add a comment
    10|10000 characters needed characters exceeded

    • The issue is that you are trying to create a record with the same key as a record already in the table.

      >Read the ABAP help for the keyword INSERT, and you'll

      >see that sy-subrc = 4 means:

      <b>>At least one row could not be inserted, because the

      >database table already contains a row with the same

      >primary key or a unique secondary index.</b>

      matt

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 10:42 AM

    Hi

    SY-SUBRC = 4 means that stament not executed successfully

    if it equals to zero then only that table fileds will be update d

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 10:43 AM

    Use syntax.

    Insert ZCSC_EAP_BTI from <work area>.
    commit work.

    Regards,

    Satish

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 04, 2007 at 10:43 AM

    Hi,

    Try like this

    INSERT INTO dbtab VALUES dbtab. OR

    INSERT INTO scustom VALUES wa

    Regards,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 10:48 AM

    hi

    the syntax for insert is :

    INSERT INTO dbtab VALUES WA.

    n if it sy-subrc returns any value other than '0' then the statement has not executed correctly.

    regards,

    sohi

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.