‎2009 Jul 30 4:58 PM
Hi,
I have created one structure in a program and filling values to the struture. At first loop, the values are getting properly, at the second loop, though new values are assigning to the structure fields, once it comes out of the loop, it has only old values. How to update the structure with new values?
For internal tables we use modify statement. Like that, what is for structure?
Ezhil
‎2009 Jul 30 5:04 PM
Hi,
You dont have to write something like a modify to update entries in a structure once new entries are moved in a structure they over write old entries . This could be a problen when you ahve same structure defined twice like in case of a subroutine call if you have a structure defined in a subroutine and inside that you are again calling a subroutine both of whihc have the same structure declared separately then even if you change the value in the innser subroutine when the control comes out of that subroutine the structure would again have the same values.
Regards,
Himanshu
‎2009 Jul 30 5:26 PM
Hi,
Just before the ENDLOOP clear the values of the structure.
LOOP AT itab.
.
.
CLEAR wa_structure. " ----->this will clear the structure old values.
ENDLOOP.Regards
Bala Krishna
‎2009 Jul 30 7:39 PM
first thing: Internal tables need modify, structures do not. as structure is just one line data. not a set of lines.
so structure donot need any modify statement,
______________________________________________
_______|__________|________________|__________| ==> this is a structure
______________________________________________ =======>this is a table
_______|__________|________________|__________|
_______|__________|________________|__________|
_______|__________|________________|__________|so structure donot need any modify statement,
-
now, as we dont know the exact purpose of your loop, what i can suggest you is before passing values to your structure always clear them.
please post your code,so that we can check.
Edited by: soumya prakash mishra on Jul 30, 2009 8:40 PM
‎2009 Jul 31 2:26 PM
Thank you all of you....your information was useful...I solved the problem