Application Development 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: 

modify insert or update statement not working for multiple records

meenakshi_raina
Advisor
Advisor
0 Kudos

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

4 REPLIES 4

matt
Active Contributor
0 Kudos

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.

0 Kudos

Hi,

Try to define Primary key fields along with MANDT.

Thanks.

former_member194965
Active Participant
0 Kudos

This message was moderated.

0 Kudos

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