2007 Dec 10 2:28 PM
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
2007 Dec 10 3:00 PM
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
2007 Dec 10 2:33 PM
2007 Dec 11 12:11 PM
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.
2007 Dec 10 3:00 PM
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
2007 Dec 10 3:14 PM
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^
2007 Dec 10 3:22 PM
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
2007 Dec 10 3:23 PM
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
2007 Dec 11 6:04 AM
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
2007 Dec 11 6:17 AM
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
2007 Dec 11 6:30 AM