Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Modify structure values

Former Member
0 Likes
3,073

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

4 REPLIES 4
Read only

Former Member
0 Likes
1,247

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

Read only

former_member585060
Active Contributor
0 Likes
1,247

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

Read only

Former Member
0 Likes
1,247

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

Read only

0 Likes
1,247

Thank you all of you....your information was useful...I solved the problem