‎2007 May 14 7:42 AM
HI,ALL :
LOOP AT it_rbkp.
SELECT SINGLE name1 INTO it_rbkp-name1
FROM lfa1
WHERE lifnr = it_rbkp-lifnr.
MODIFY IT_RBKP.
CLEAR IT_RBKP.
ENDLOOP.
why can use "MODIFY IT_RBKP" without "index sy-tabix"?
‎2007 May 14 7:46 AM
hi,
it will compare the key fields in the work area and will modify the correponding record in in itab with the same key.
so index is not needed.
or us can use the below procedure.
data : ind type sy-tabix.
LOOP AT it_rbkp.
ind = sy-tabix.
SELECT SINGLE name1 INTO it_rbkp-name1
FROM lfa1
WHERE lifnr = it_rbkp-lifnr.
MODIFY IT_RBKP index ind..
CLEAR IT_RBKP.
ENDLOOPRegards
Reshma
‎2008 Jun 26 1:21 PM
Hi Reshma,
Good Logic yaar.
I leant one thing don't high always,think of bacics also.
Regards,
Sunil
‎2007 May 14 7:49 AM
hi,
MODIFY IT_RBKP. statement is inside loop...endloop
so it refers to the pqarticular loop pass.
Present record in the internal table headerline is modified in the internal table.
‎2007 May 14 8:00 AM
Hi
Modify statement,as it name indicates it modifies the internal table to the changes made.for the example you mentioned,
modify statement fetches the required record from lfa1 and append it into the name 1 field of it_rbkp.
so when you open the it_rbkp again it will be modified.
REWARD IT PLEASE...!!!
‎2008 Jun 27 2:51 PM
hi
You r writing the MODIFY Statement inside the LOOP ENDLOOP statement.
The Processor executes This Statement just after processing SELECT SINGLE statement.
Unless the execution reaches the ENDLOOP statement the sy-tabix holds its value so there is no need for INDEX option.
Hope this will Help.
Reward if Useful.
Sumit Agarwal
‎2008 Jun 28 5:49 AM
Hi,
After Fetching Records From Database table into Internal table You Are modyfying the Table.
Here The Index is Index of current loop pass i.e sy-tabix.
So No Need to mention Index explicitly.
internal table is modified for Every loop pass.
If You want then you can also mention it explicitly but effcet is same.
To change a line using its index, use the following statement:
MODIFY <itab> FROM <wa> [INDEX <idx>] [TRANSPORTING <f1> <f 2> ... ].
Here The TRANSPORTING addition allows you to specify the fields that you want to change explicitly in a list. See also Changing Table Entries. If you change a sorted table, you may only specify non-key fields.
Again You can change lines of standard tables using the following statement:
WRITE <f> TO <itab> INDEX <idx>.
Regards,
Sujit
Edited by: Sujit Pal on Jun 28, 2008 6:49 AM