07-24-2019 12:06 PM
I want to export data from excel sheet into a database and display it in an ALV with an additional field which will show the status whether every entry is saved successfully or not.
Here, I have a field 'Id' which is a primary key. When I am copying data from excel into an internal table consisting of the same id then the values from excel are getting overwritten into the internal table.
Can somebody tell me how can I print a message in this 'Status' field to show if data is successfully saved or not without getting it overwritten into the database?
07-24-2019 1:59 PM
Data in the ALV will not be written to the database without explicit update logic. Changes made to the internal table that is used to display the ALV list will not change the database unless you write the procedure to update the database (Call Transaction, BAPI, IDoc, BusObject, etc).
"Viewer" is the key word in the name "ABAP List Viewer".
07-24-2019 4:27 PM
You are talking about memory and database operations, altogether mixed-up, that don't make sense to me. Can you elaborate? (and "separate the concerns" if possible)
07-25-2019 9:00 AM
How can I validate duplicate records while exporting data from excel to the database and display a field in ALV which shows a status whether data is saved or not in the database?
07-25-2019 9:27 AM
"Elaborate" doesn't mean "give an abstract"... 🙂
Sorry, I really don't understand your question. Or your question is about a so-complex topic that nobody knows the answer.
07-25-2019 12:33 PM
You can use one of those FM to take data from excel file into an internal table -
1. ALSM_EXCEL_TO_INTERNAL_TABLE
Then insert the data of internal table to database table by sorting the internal table, deleting adjacent records as per your condition using below syntax -
SORT itab BY <field1> <field2> <field3>.DELETE ADJANCEMENT DUPLICATES from itab COMPARING <field1> <field2> <field3>.
Now using simple insert syntax, enter data to database table and on success, popup a Message (Type 'I' showing that the records has been updated in db successfully) and show the ALV using that internal table.
07-26-2019 6:25 AM
Can you check this article: https://gocoding.org/abap-excel-upload/
Here, the uploading excel is explained. What apart from the content mentioned here you want to know?
07-26-2019 7:11 AM
here I am trying to display contents of excel sheet in an ALV with an additional field 'Status' which will show duplicate entries are not saved and unique ones are saved. My actual problem is validating duplicate entries.
Ps: thank you for everyone's help I am able to export data from excel to z table. Now I just want to validate it.
07-27-2019 11:45 AM
Before showing your internal table data, you can sort the internal table and delete duplicate entries as I mentioned in below answer. Please check.