2022 Feb 15 2:02 AM
Hi ,
I have some trouble about adding record to Z's Database table.
I created a new table and it include a four key parameter and several parameter in this table.
Also i have a internal table and i added new record to this internal table in program.
I want to , add record to this db table from internal table. But when i added new record db table modify specific row, not added new row.
How can i do; when every new row added in my internal table also added my db table like new row ?
Best regards.
2022 Feb 15 9:40 AM
By definition, the "Primary Key" of a database table means that each line is UNIQUE (values of all columns of the key).
If you want to have "several lines with same key", you must add a dummy column to the key that you increment (1, 2, 3...) It will make each line unique.
2022 Feb 15 2:52 AM
You may check the ABAP keyword Documentation for the Modify Statement(Press F1 with your Cursor on Modify).. Below code should ideally work for all records except if there are duplicate key records.. In case you have any specific problem you may edit and add additional details to your question..
MODIFY <ZTABLE> FROM TABLE <your internal table>.
2022 Feb 15 5:54 AM
Hi,
When i use this code. İt doesn't work.
It updates the most recent record while asking it to enter the value I just entered. Can't I add the records again even if they are the same?
2022 Feb 15 7:53 AM
Hello myilmaz03
Check out the SAP Help page on Open SQL - Write Accesses
Best regards
Dominik Tylczynski
2022 Feb 15 9:26 AM
Hi,
1.Check weather it is appending / looping properly or not .
2.check below code if it may helpful.
IF InternalTableXX is not initial.
Modify tableXX from table InternalTableXX.
IF SY-SUBRC = 0.
commit work and wait.
Message 'Data Inserted Successfully' type 'S'.
ENDIF.
ENDIF.
2022 Feb 15 9:40 AM
By definition, the "Primary Key" of a database table means that each line is UNIQUE (values of all columns of the key).
If you want to have "several lines with same key", you must add a dummy column to the key that you increment (1, 2, 3...) It will make each line unique.