Skip to Content

modify insert or update statement not working for multiple records

Hi All,

I am trying to insert some data into a custom data. This table has no primary key ( except MANDT ).

I tried using modify, insert and update statement , but it is not working.

Only the last record in updated in the table.

Please let me know how this can be corrected ?

1. MODIFY zifrsadj FROM TABLE it_tc1.

COMMIT WORK.


2.

LOOP AT it_tc INTO wa_tc.

wa_tc1-fyear = p_year.

wa_tc1-period = p_period.

wa_tc1-hkont = wa_tc-hkont.

* INSERT INTO zmonthadj VALUES wa_tc1.

MODIFY zmonthadj FROM wa_tc1.

CLEAR : wa_tc, wa_tc1.

ENDLOOP.


3.

LOOP AT it_tc INTO wa_tc.

wa_tc1-fyear = p_year.

wa_tc1-period = p_period.

wa_tc1-hkont = wa_tc-hkont.

* INSERT INTO zmonthadj VALUES wa_tc1.

CLEAR : wa_tc, wa_tc1.

ENDLOOP.





Regards

Meenakshi

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jul 27, 2016 at 05:44 AM

    If "This table has no primary key ( except MANDT )." then it can only contain one record per client. Your program is working absolutely correctly.

    This is very basic - I think you should re-read your course notes on data dictionary and ABAP programming.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 27, 2016 at 05:52 AM

    Hi,

    Try to define Primary key fields along with MANDT.

    Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 27, 2016 at 05:52 AM

    This message was moderated.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 27, 2016 at 06:17 AM

    The table include just 1 row which there are not any primary key ( expect MANDT ),

    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.