10-07-2014 8:30 AM
Is it possible to use MODIFY statement on an internal table with no entries?
Modify itab index 1 from wa1.
Above statement is not populating itab even though entries r there in wa1.
Thanks,
Tanvi
10-07-2014 11:22 AM
The MODIFY statement changes an existing row in the internal table (like an UPDATE SQL statement). Please check the ABAP help.
http://help.sap.com/saphelp_erp60_sp/helpdata/en/fc/eb35eb358411d1829f0000e829fbfe/content.htm
https://help.sap.com/saphelp_45b/helpdata/en/34/8e72f96df74873e10000009b38f9b8/content.htm
In order to insert a new row in your table, use INSERT or APPEND statements.
10-07-2014 11:38 AM
Hi,
The given statement will not work because the index 1 doesn't exist in an empty internal table.
And I'm wondering why this statement didn't cause any dump, as you are trying to access/modify a location that does not exist.
And we can modify an internal table with respect to a key or index. But in an empty internal table there is no key/index available to compare and modify.
If we want to know the internal table is empty or not, we can read the table with index 1 or key( if you want to check the existence of a particular entry .) Then perform the further processing according to the value of sy-subrc.
Regards
Jesse Owens K
10-07-2014 11:48 AM
It does not create a dump because it simply sets sy-subrc to 4 if it cannot find the specified table line. To better test if the table is empty, we can either use:
itab[] IS INITIAL
or
lines( itab ) = 0
BR,
Serban
10-09-2014 8:47 AM
Hi,
You internal table is empty and you are trying to modify internal table with work area. As the table is empty, it should add records to internal table from work area. It is not populating any record to internal table because you are using 'Index' clasue in modify statement. Here, there is no index as internal table is initial. Try to remove 'Index' from that statement.