‎2009 Nov 18 4:22 AM
Dear experts,
I am looking a way out by which i provide a single value as a parameter to a method .Assume single value is N.
and which could return me an internal table.I read it is not possible with returning.Any other way ?.
Also,What is returning then used for ?.It will be great if ii could get some examples.I could not see any example where
any internal table is returned.To pass though looks possible using parameter-tab.
‎2009 Nov 18 6:08 AM
Hi,
Please refer to the below link.
Hope this will be useful.
Regards,
Dhanalakshmi L
‎2009 Nov 18 4:47 AM
Dear experts,
If i compare with java, if i use
Vector x;
public Vector method(int x)
{
return(Vector)
}
main()
{
x = method(1);
// I will expect x getting values in Vector
Isn;t this concept applicable in java using method and returning internal table.If no what is OO abap made for ?
‎2009 Nov 18 6:08 AM
Hi,
Please refer to the below link.
Hope this will be useful.
Regards,
Dhanalakshmi L
‎2009 Nov 18 6:20 AM
I dont know gentleman dhanlakshmi what u mean by asking me to visit this link.
However,i tried to find forums of same issue.I got solution saying one.
Hi urjose,
Here is the solution.
Just follow these steps.
1)In the main program, you have defined your internal table as:
data: begin of itab occurs 0.
include structure kna1.
data: end of itab.
2) After creating and initializing the object , call the method of the class as:
call emp->get_table exporting int_table = itab.
3) Go to se11, create a table type of kna1 say ztabtype.
3) In se24, in the methods section, define the method get_table . In the parameters section,give
int_table importing type ztabtype.Give some description.
4) In the implementation, for accessing the values,
do as follows.
method get_table.
data: wa_itab type kna1.
loop at int_table into wa_itab.
now u can access the contents using wa_itab.
endmethod.
This co-mensurates to many view i got to my current problem.
All i need to say that if programming in OO- abap is that bit ugly that every type has to be defined in your dictionary.
I was much-much happy using traditional approach.I am surprised that if i want to return an internal table of structure mseg,that
means i goto dictionary and create some ZMSEG and give each and every entry creating duplicate mseg !!!!!!.Ins't this creating
junk in your dictionary.Further what is the guarantee that tomorrow , i migrate from SAP 4.7 to ECC 6.0 ,all Z Objects will be
taken care of !!! .This is complete **** !!.
‎2009 Nov 18 6:26 AM
Plz plz plz experts, i am desperately waiting for your views as today may become a significant day in my life which will be
rolling back to my original approach which has been tradiitonal so long.Also ,as i have not worked on netweaver,do they use same principles !! ??
‎2009 Nov 18 6:27 AM
‎2009 Nov 18 6:36 AM
Hi!
As i understand u need to get something like this:
program zjdtest.
types: begin of ty_s_vector,
a type c,
b type c,
* ....
end of ty_s_vector,
ty_t_vector type standard table of ty_s_vector
with default key.
data: lt_vector type ty_t_vector.
class lcl_report definition.
public section.
class-methods: method1 importing id_parameter type i
returning value(rt_vector) type ty_t_vector.
endclass.
class lcl_report implementation.
method method1.
* rt_vector = " something that have been calculated.
endmethod.
endclass.
start-of-selection.
lt_vector = lcl_report=>method1( 1 ).Edited by: Petr.Plenkov on Nov 18, 2009 7:36 AM
‎2009 Nov 18 6:40 AM
no petr,i quoted Vector just as an example from Java - OO perspective. I simply want to return an internal table from
a method.Moreover opinions say that for every internal table you return make a Z table in your dictionary.This is not
acceptable to us.
‎2009 Nov 18 6:48 AM
>
> I simply want to return an internal table from a method.Moreover opinions say that for every internal table you return make a Z table in your dictionary.
Where do u see any Ztype declaration in the code above? Here is local table type ty_t_vector and a method returning internal table of this type. i haven't expected u are even not able to read the simpliest abap code
‎2009 Nov 18 6:48 AM
‎2009 Nov 18 6:51 AM
Sorry petr, i give it a try .Believe me i got a little disturbed.
‎2009 Nov 18 7:36 AM
Thanx petr your techniqe has worked.This means lot of misconception is there between consultants who have been guiding each other in a way like creating Z objects on SE11.
I am sorry for my comments which were dipped in ignorance.
Petr you deserve full marks here.