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

update statement

hi all

UPDATE zinv_header SET

run_number = '1000000000' "loc_runnumber

invoice_core = '111111

invoice_created = '111112'

invoice_error = '121111'

username = sy-uname

systemdate = sy-datum

systemtime = sy-uzeit .

the above statement is not working, i don no y.i cannot give where condition , bcoz there r no records in the table., Its a great head ache for me.

YOUR HELP needed.

Regards

karthik

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 05:39 AM

    Hi karthik,

    can you plz explain me your requirement.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi srikanth

      i want to update the z table , those values r coming from my report . thats it , my first field is mandt in the z table. but i debugged after update statement, sy-subrc is always 4. its a big mess ,

      regards

      karthik

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 05:40 AM

    Hi,

    May be record with keyfields doesnot exist inthe table zinv_header .

    If that is the case use INSERT.

    Thanks and Regards,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 05:41 AM

    So for this case.

    U can use modify statement instead of update statement.

    Take all those field in an internal table.

    then modify ztab from itab.

    If it is usefull pls reward pts.

    Regards

    Srimanta

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 05:43 AM

    Hi,

    UPDATE can be used only on the existing records. as your table doesnt contain any data, it will always fails. instead use MODIFY statement.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 05:44 AM

    Hi,

    I don't know if it's mistake in copying but please note

    invoice_core = '111111

    it should be

    invoice_core = '111111'

    Regards,

    Mohaiyuddin

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 05:52 AM

    Hi karthik.

    use modify statement always instead of update. If any records are there in your table this will update or insert new record.

    Suku

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 06:34 AM

    Hi karthikeyan,

    The statement UPDATE changes the content of one or more lines of the database table specified in target. The entries in source determine which columns of which lines are changed, and how they are changed.

    The statement UPDATE sets the values of the system fields sy-subrc and sy-dbcnt.

    effect on sy-subrc :

    0 At least one line has been changed.

    4 At least one line was not able to be changed, either because no appropriate line was found, or because the change would generate a line that leads to double entries in the primary key or a unique secondary index in the database table.

    The statement UPDATE sets sy-dbcnt to the number of changed lines.

    The changes are definitively copied to the database with the next database commit. Until that point, they can still be undone using a database rollback.

    may be you dont have any rows in your table so its not getting reflected on the table try using modify statement.

    plz reward if helpful,

    get back to me for further queries.

    thanks and regards,

    srikanth tulasi,

    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.