Application Development 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: 

populating a table which is content of field of an internal table

Former Member
0 Kudos
180

Hi All,

I have one internal table which contains a field which has names of different tables. I want to populate data from these tables.

I am giving an example to make my point clear.

suppose 'it_test' is an internal table having a field 'tabname'. This field has contents suppose ekko, ekpo etc. So I want to show all the fields of the table ekko,ekpo in my output.

Can anybody suggest me something how to populate this?

Thanks in advance.

Amol

1 ACCEPTED SOLUTION

Former Member
0 Kudos
105

Hi,

Do this way :

Select ...

from (it_test-tabname)

where...

This should work.

If there are more than one value then you can loop your table.

Thanks,

Lalit Kabra

9 REPLIES 9

Former Member
0 Kudos
105

Hi,

Check the thread below:

Regards

Kannaiah

0 Kudos
105

Hi Kannaiah,

Thanks for your reply.

I tried your code which you posted in reply to but it is giving me a short dump 'LOAD_PROGRAM_NOT_FOUND' with exception 'CX_SY_PROGRAM_NOT_FOUND'. Can you please suggest something to solve this problem.

Thanks in advance.

Former Member
0 Kudos
106

Hi,

Do this way :

Select ...

from (it_test-tabname)

where...

This should work.

If there are more than one value then you can loop your table.

Thanks,

Lalit Kabra

Former Member
0 Kudos
105

hi

good

your query is bit confusing.

if you want to display the internal table table in an output from the content of an standard table than you can use the select statemetnt to select the required data from the EKKO AND EKPO table and put it into an internal table and than you can display that.

if you want to join both the table EKKO and EKPO and you can use the JOIN statement with the select query to display the required data.

thanks

mrutyun^

Former Member
0 Kudos
105

hi,

You can use the FM 'NAMETAB_GET' .

data: itab type dntab.

loop at it_test.

CALL FUNCTION 'NAMETAB_GET'

EXPORTING

langu = sy-langu

tabname = it_test-tabnam

TABLES

nametab = itab

EXCEPTIONS

no_texts_found = 1.

endloop.

loop at itab.

write : itab-fieldname.

endloop.

Thanks,

Kasiraman R

Former Member
0 Kudos
105

Hi,

Put internal table loop for the function module: DD_GET_NAMETAB .

Purpose of this fm is : We can find no of columns in a table and column position , decimals..accordingly

If we provide any table as input parameter then fm returns how many columns are there.Just cross verifying field names and positions before updating datbase tables.

Please reward if its useful.

Thanks

Sivaparvathi

0 Kudos
105

Hi,

Thanks for your replies.

Actually I want the contents of those fields, not only the field names.

The requirement is that:

we do some changes in Development system which gets transported to Production system and the difference between before and after changes is seen by looking at the tables which stores the changes line by line or stores every object which is getting changed in development. These tables are present in both Development and production system. So I want to compare both these tables. These table names I am getting from two other tables using join. So these table names are generated at runtime. So I want contents of each table stored in an internal table which can be compared with that of production system.

It might be a bit confusing but my basic requirement is to get contents of fields of the tables.

Thanks again for your help.

Amol

Former Member
0 Kudos
105

hi amol,

you said that you want to see the contents of ekko and ekpo.But these are header and transaction tables by relation. Both of them has many fieldnames which are same. then why you need whole fields,rather you should try to have such line item which has some meaning.

You can create a view. here you can select the desired fields which you want to display out of these tables. You can actually declare an itab like structure of this view.

then you can fire a select query into corresponding fields of itab.

and then display.

Otherwise if you are sticking to your requirement of having all the fields of ekko and ekpo then you can imagine how many fields it contains and it is so clumsy thing to handle.

Be specific about ur requirement and reply soon

Gaurav

0 Kudos
105

Hi

Thanks for your reply.

Actually my requirement is not populating standard tables. I just gave it as an example. If you look at my previous post you can get what my requirement is.

To make it more clear you can refer to following link which I received as a reply.

Amol