‎2008 Feb 07 11:18 AM
Hi,
I need to modify the DB. I have an internal table without header line. I checked with the threads posted though informatory but not useful for this scenario.
Scenario.
DB : 25 fields
Internal table 4 fields
tried with the checking the F1 syntax didnt work out.
Please provide your valuable inputs.
Thanks
Mohinder Singh Chauhan
‎2008 Feb 07 11:21 AM
Hi Mohinder,
When modifying or performing any operation on DB table using an internal table, the structure of the internal table should be EXACTLY the same as the DB table.
Hence here, you would need to declare another internal table with the 25 fields in DB table and then move contents from source internal table into new internal table and modify DB table from new internal table.
Cheers,
Aditya
‎2008 Feb 07 11:20 AM
Hi
You can use update using Set
or modify statement
but it wont modify the primary key fields
Regards
Shiva
‎2008 Feb 07 11:21 AM
Hi Mohinder,
When modifying or performing any operation on DB table using an internal table, the structure of the internal table should be EXACTLY the same as the DB table.
Hence here, you would need to declare another internal table with the 25 fields in DB table and then move contents from source internal table into new internal table and modify DB table from new internal table.
Cheers,
Aditya
‎2008 Feb 07 11:26 AM
Hi,
Check this simple program
TABLES:MARA.
DATA:ITAB LIKE MARA OCCURS 0 .
DATA:WA LIKE MARA.
START-OF-SELECTION.
WA-MATNR = '123ABCDAB'. .
WA-MBRSH = 'C'.
WA-MTART = 'FERT' .
WA-MEINS = 'KG' .
APPEND WA TO ITAB.
WA-MATNR = '123ABCDBB'. .
WA-MBRSH = 'C'.
WA-MTART = 'FERT' .
WA-MEINS = 'KG' .
APPEND WA TO ITAB.
LOOP AT ITAB INTO WA.
INSERT MARA FROM WA.
MODIFY MARA .
ENDLOOP.
‎2008 Feb 07 11:37 AM
Hi Mohinder,
Would suggest not to use Modify or Update statement directly on the DB table. Find a BAPI instead.
IF still using always have to pass the Primary key and use Transporting. In othercase if you donot pass all the fields then the remaining fields will be modified and left empty.
-- Pass all the key fields to avoid data redundancy and loss,
Jayant Sahu.
‎2008 Feb 14 7:42 AM