‎2009 Jul 03 10:47 AM
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
‎2009 Jul 03 10:53 AM
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.
‎2009 Jul 03 10:51 AM
maybe you can workaround with satement
Loop at component of structure.
endloop.
‎2009 Jul 03 10:54 AM
>
> 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.
‎2009 Jul 03 10:53 AM
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.
‎2009 Jul 03 10:57 AM
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
‎2009 Jul 03 11:06 AM
>
> 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.
‎2009 Jul 03 11:09 AM
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
‎2009 Jul 03 11:10 AM
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.
‎2009 Jul 03 11:14 AM
Florian, he wants to have the type definition from report a in report b!
‎2009 Jul 03 11:20 AM
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.
‎2009 Jul 03 11:28 AM
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
‎2009 Jul 03 11:32 AM
‎2009 Jul 03 11:35 AM
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.
‎2009 Jul 03 11:43 AM
Actually i am developing a tool which will automatically fetches the structure of data from any program(given as input)..
‎2009 Jul 03 11:14 AM
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.
‎2009 Jul 03 11:22 AM
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.