08-06-2004 11:38 AM
I am creating a Class and in the this class I want a method that returns a table.
Class: ZTEST_CLASS
Method: GET_PATCHES
Parameters: DATA Returning TYPE /SDF/CHAR300
method.
CALL FUNCTION '/SDF/OCS_GET_INFO'
TABLES
TT_PATCH = DATA.
endmethod.
I get nothing but errors about how DATA is not an internal table.
If I change it to make an internal table:
method.
DATA: itab TYPE TABLE OF /SDF/CHAR300.
CALL FUNCTION '/SDF/OCS_GET_INFO' DESTINATION rfcdest
TABLES
TT_PATCH = ITAB.
endmethod.
This works, or at least it doesn't give any errors however I'm still not clear on how I can get that ot hte DATA returning parameter?
08-06-2004 1:32 PM
If you define your attribute table in the Public Section of your class, you can reference to it as you wrote.
08-06-2004 12:30 PM
Hi,
You can define a table type which has /SDF/CHAR300 as its line type and define your returning parameter using this definition.
Regards,
Sükrü
08-06-2004 12:38 PM
Sorry, but where do I define the table type in order for my returning parameter to get it?
08-06-2004 12:50 PM
Hi,
If your class is a local class, then you can define it in your in top include of your report of function group. But if it is global class that you are creating with the transaction SE24, then you define it in the DDIC. For example(for local class case)
Report XYZ.
types: gtyt_sdf_300 type standard table of /SDF/CHAR300.
.....
class lcl_test_class definition.
public section.
methods : get_patches
returning value(rt_patches) type gtyt_sdf_300.
endclass.
.....
Regards,
Sükrü
08-06-2004 12:56 PM
I am making a global class so I will need to create a new Dictionary Table?
I will try that now and see what happens.
08-06-2004 1:00 PM
08-06-2004 1:16 PM
I must be doing something completely wrong.
I defined a new table and defined my DATA parameter to the type of the new table. But still no luck I get ""DATA" is not an internal table - the "OCCURS n" specification is missing"
Thanks for the help but I will do this another way.
I get my table inside the method but when I try to give it to the method parameter it just complains
Thanks again.
08-06-2004 1:21 PM
Hi Craig,
You had to create a Table type not a new DB table. Table types are also created using transaction SE11(Using radiobutton Data type and then selectiong table type as the data type to be created).
08-06-2004 1:25 PM
I have options for
Database table
View
Data tyoe
Tyoe Group
Domain
Search help
Lock object
However, I think I might have got it now - just one question.
In the class I have a attribute defined for DATA (the table but not as a returning parameter on the method) is it possible that the method could update this table? If so how would I then access this attribute of the class?
I think I have it...
DATA: itab TYPE ZSC_PATCHES.
DATA: obj TYPE REF TO ZSC_GENERAL_METHODS.
CREATE OBJECT obj.
obj->GET_SYSTEM_PATCHES( rfcdest = 'TT1' ).
itab = obj->DATA.
The method runs the CALL FUNCTION and then moves the table info from itab to DATA then I have the data from DATA available
Sound about right?
Message was edited by: Craig Cmehil
08-06-2004 2:56 PM
08-06-2004 9:42 PM
08-11-2004 12:10 PM
08-06-2004 1:32 PM
If you define your attribute table in the Public Section of your class, you can reference to it as you wrote.
08-06-2004 1:36 PM