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

Data Extraction Using Structure

Former Member
0 Likes
2,569

Hi All,

How can i extract data using structure,

for example,

take structure RC29L,

how can i declare this as a internal table and how can i get data from this one,(strucutre contains just a row, but i need to extract all the data which are all in DB).

Regards

Hema

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,289

Hi,

U cann't extract data from the Structure.It holds data at runtime only.

So, you can pick the data from respective tables of structure.

But,you can declare a internal table with respect to the structure.

data:Begin of itab,

include sturecture rc29l.

end of itab.

Regards,

Shiva Kumar.

13 REPLIES 13
Read only

Former Member
0 Likes
2,289

Hi,

You are right. Stracture has one row . So what you ca do is to create an internal tal tabl having line type of the structure.

Snytax is

DATA

ITAB like standard table of RC29L.

for detail check the link

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb367a358411d1829f0000e829fbfe/content.htm

Regards,

anirban

Read only

former_member673464
Active Contributor
0 Likes
2,289

hi,

Structure does not have any data. It will contain data only at run time. Structure gets data from some other table at run time. So check for the corresponding table where it is fetching it.

Regards,

Veeresh

Read only

Former Member
0 Likes
2,290

Hi,

U cann't extract data from the Structure.It holds data at runtime only.

So, you can pick the data from respective tables of structure.

But,you can declare a internal table with respect to the structure.

data:Begin of itab,

include sturecture rc29l.

end of itab.

Regards,

Shiva Kumar.

Read only

0 Likes
2,289

Hi,

DATA: BEGIN OF itab.

INCLUDE STRUCTURE rc29l.

DATA: END OF itab.

SELECT data FROM rc29l INTO itab.

LOOP AT itab INTO wa.

WRITE:/ wa-matnr, wa_idnrk.

ENDLOOP.

if i write like this, im gettin err mesg like 'rc29l is not defined in data dictionary', what can i do.

Read only

0 Likes
2,289

That is a structure. Structure does not contain data. It is just a reference. You cant select data from a structure. The main table is populated somewhere for which this structure is used. Better find that database table to select data.

Regards,

Shailaja

Read only

0 Likes
2,289

Hi Hema,

Select staement can work on tables.It cann't work on Structure.This structure does not hold data physically.At runtime only ,you can place into this structure.

This is wrong:

SELECT data FROM rc29l INTO itab.

Instaed of rc29l,use the table from where these values are coming.

Regards,

Shiva Kumar

Read only

0 Likes
2,289

So How can i find the,

1. DB Tables for a particular structure and

2. Relation betwn the Tables.

Hema

Read only

0 Likes
2,289

hello,

u dont have to always map tables with structures to declare your internal tables...... instead u can create

1) data : int_tab type DBtablename.

or else

2) create your own structure consisting of wat ever fields u require like

data : begin of int_tab occurs 0,

Filed1 type BDtable-field1,

Filed2 type BDtable-field2,

Filed3 type BDtable-field3,

.........

End of int_tab.

Read only

0 Likes
2,289

Hi,

Go through this link to find the relation:

Regards,

Shailaja

Read only

former_member217544
Active Contributor
0 Likes
2,289

Hi Hema,

Structure means it is just a template which we can use as a table also with the following declaration:

DATA : IT_RC2NL type table of RC2NL.

Now if you write a select query and you can pass teh values in to this internal table IT_RC2NL which holds all teh records.

Hope this will help you.

Regards,

Swarna Munukoti.

Read only

Former Member
0 Likes
2,289

Hi,

Declare the internal table like this:

data: itab type table of RC29L,
          wa type RC29L.

select data from table into table itab.

loop at itab into wa.
perform process_data.
endloop.

Regards,

Shailaja

Read only

rajesh_akarte2
Active Participant
0 Likes
2,289

Hi,

You can never get data from a structure as data is not stored in the structure.To get the desired tables

you can of a structure you can go in se11 there you pass your structure name and click on Display object list.There u go in DB area menu .You will get the tables used.

Regareds,

Rajesh Akarte

Read only

Former Member
0 Likes
2,289

hello,

data : int_RC29L like RC29L occurs 0 with header line....