‎2006 Jun 28 4:02 AM
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.
‎2006 Jun 28 4:28 AM
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
‎2006 Jun 28 4:33 AM
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.
‎2006 Jun 28 4:46 AM
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
‎2006 Jun 28 7:44 AM
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>
‎2006 Jun 28 7:53 AM
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