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

Get field structure dynamically

Former Member
0 Likes
600

Hi,

i want in ABAP to loop for all fields of a structure.

Thanks for help.

Cheers

4 REPLIES 4
Read only

Former Member
0 Likes
469
Read only

former_member758419
Active Participant
0 Likes
469

Hi

Create an internal table of the required stucture and loop through it.

Example:

data: itl_demo type zstructure occurs 0 with header line.

Loop at itl_demo.

---

---

---

Endloop.

Pls mark helpful answers.

Read only

Former Member
Read only

Former Member
0 Likes
469

Hi tafkap ,

the code would be like this...here intab and itab are internal table.

FIELD-SYMBOLS : <fs> TYPE ANY.

loop at intab.

do.

assign component sy-index of structure intab to <fs>.

  • here <fs> will hold the value of column

itab-field = <fs>.

enddo.

append itab.

clear itab.

endloop.

hope this answers your question.

Reward useful answers.

Regards,

Shrita Sharma.