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

Reading data from structures

Former Member
0 Likes
7,603

Hi,

Can anyone tell me how to read data from a structure? I want to read STR_SUPPL1 and STR_SUPPL2 from structure ADDR1_DATA. It is not the way i read data from a table rght?

Please help me with a code snippet.

Thanks in advance,

Thushara.

5 REPLIES 5
Read only

Former Member
0 Likes
2,472

first thing you wont be having any data in the strucutre which is mentioned.

If you wish to retrive the data of the fields that you have menitoend you can find them in the table ADRC and using the addrnumber from your master data (customer, vendor or user) u can retrive the data

Cheers

Read only

Former Member
0 Likes
2,472

Hi Thushara,

Structured types describe the structure and functions of any structured data objects, that is of data structures with components of any type.

A component can be a field with an elementary type or can itself be a structure. A table can also be used as a component in a structure.

A database table always has a structure and is therefore implicitly a structured type. However, the fields of a database table can only have an elementary type.

First of all u have to declare an internal table of type ADDR1_DATA and then add the rows to that internal table. And then try to read the data from that.

See this code :

data : itab type table of addr1_data with header line.

itab-str_suppl1 = 'THIS IS A TEST PROGRAM'.

itab-str_suppl2 = 'THIS IS A TEST1 PROGRAM'.

append itab.

loop at itab.

write : / itab-str_suppl1, itab-str_suppl2.

endloop.

Hope u got my point.

If found helpful, please do reward.

Read only

Former Member
0 Likes
2,472

hi

good

go through these links

http://www.sappoint.com/abap/files.pdf

http://72.14.235.104/search?q=cache:_PlsGTs5V3kJ:www-rcf.usc.edu/~anthonyb/itp320/ABAP.pptREADDATAFROMASTRUCTURE,+ABAP&hl=en&gl=in&ct=clnk&cd=27

thanks

mrutyun

Read only

venkat_o
Active Contributor
0 Likes
2,472

Hi Thushara,

<b>1</b>.

Structure contains Fields.Does not contain any data .At runtime only it contains data .It is like Header or Work area .

<b>2</b>.

If you are populating ADDR1_DATA from STR_SUPPL1 and STR_SUPPL2 at runtime use as below

Move-corresponding:

STR_SUPPL1 to ADDR1_DATA,

STR_SUPPL2 to ADDR1_DATA.

<b>Thanks,

Venkat.O</b>

Read only

Former Member
0 Likes
2,472

Hi,

Structure contains no data and hence you can not read the data from structure.

You will have to read the data from underlying transperant tables. In your case, the table is ADRC.

ex.

select single * from ADRC into WA_ADRC where ADRNR = KNA1-ADRNR.

Hope it helps.

Regards,

Shashank