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

fetching internal table structure

SreekanthKrishn
Contributor
0 Likes
1,699

Hi all,

My requirement is to fetch the structure of the internal table declared in a program from another program.

For Eg:

Program Pgm1 has internal table which has fields(f1 , f2).

In another program Pgm2, I nede to get the fields f1 and f2 if I give the program name and the internal table name as inout.

i have tried cl_abap_typedescr=>describe_by_data, but it returns only the structure inside the same program..

The FM GET_GLOBAL_SYMBOLS can be used to fetch the internal tables from another program.

Is there any way to retrive the structure of an internal table from another program???

Thnks,

Sreekanth

1 ACCEPTED SOLUTION
Read only

rainer_hbenthal
Active Contributor
0 Likes
1,667

You only can read in the source text and analyze this... i dont think this will really work. run time analysis will work inside a program frame (global, funciton module and methods) only.

15 REPLIES 15
Read only

Former Member
0 Likes
1,667

maybe you can workaround with satement


Loop at component of structure.

endloop.

Read only

0 Likes
1,667

>

> maybe you can workaround with satement

>

>


> Loop at component of structure.
> 
> endloop.
> 

That will not work to get the structure defined internally in report a into report b.

Read only

rainer_hbenthal
Active Contributor
0 Likes
1,668

You only can read in the source text and analyze this... i dont think this will really work. run time analysis will work inside a program frame (global, funciton module and methods) only.

Read only

0 Likes
1,667

Florian,

I am not so sure of loop.. of statement.

can u pls provide the syntax..

thanks,

Sreekanth

Rainer,

I want the structure of the variables in an active program..

I dont want to fetch data from it..

Thanks,

Sreekanth

Read only

0 Likes
1,667

>

> Rainer,

> I want the structure of the variables in an active program..

> I dont want to fetch data from it..

>

> Thanks,

> Sreekanth

I know that you dont want to fetch content but structiure. Thats what my answer was about.

Read only

0 Likes
1,667

Rainer,

Can u explain a bit about the process on reading the source text..

Do we need to use read report here??

Edited by: Sreekanth Krishnan on Jul 3, 2009 12:10 PM

Read only

0 Likes
1,667

well the statement


Loop at component of structure XXX.

endloop.

loops over the fields of the structure, one by one.

sure it doesnt help you to determine of which structure your structure is, but you can skim through it field by field.

maybe a runtimetypeanalysis works for your single field then. that was my though on this.

Read only

0 Likes
1,667

Florian, he wants to have the type definition from report a in report b!

Read only

0 Likes
1,667

yeah i got his requirement, but if he can go through the structure field by field,

and getting the types of this field, he can easily rebuild the structure in report b.

Read only

0 Likes
1,667

Hi Vin, Florian, Rainer,

thanks for reply..

My requiremnt is:

Suppose there ia a program with an internal table.

say:: ZTEST1

TYPES: BEGIN OF typ_mara.

  • employeeid TYPE i,

  • empname TYPE c,

INCLUDE STRUCTURE mara.

TYPES: END OF typ_mara.

DATA: wa_mara TYPE typ_mara.

Now say I have Program ZTEST2.

i have called FM "GET_COMPONENT_LIST" to get the field names "wa_mara".

now I want the fields in the structure "wa_mara" in this program thru some statement...

Thanks,

Sreekanth

Read only

0 Likes
1,667

I dont think it is possible!...

Read only

0 Likes
1,667

so your TYP_MARA can change?

is it somewhat dynamical?

if not, why dont you just use a dictonary structure for it? this would be available in report2 as well.

Read only

0 Likes
1,667

Actually i am developing a tool which will automatically fetches the structure of data from any program(given as input)..

Read only

former_member212005
Active Contributor
0 Likes
1,667

Sreekanth...try to do it in reverse manner....instead of trying to get structure by calling the program passing internal table name and program name....

Rather try to get the structure itself...

i.e. Call the second program to get structure....

This is how you should do..call the second program passing internal table name and program name...calculate the structure inside the second program and get the structure in program 1....Use the Export and Import statement for this!

Can you explain...or write codes...of how you are doing it...

May be I am not clear on your requirement.

Read only

Former Member
0 Likes
1,667

you handeles SDN quite niceley and only posted where you ran into problems. Thank you for that.

But in your case it really would be nice to know what you are aiming, or why you need to do such.

maybe there is an easier way to achieve what you need than to insist on that solution.