06-18-2008 11:38 AM
Hello,
I've got a following problem.
I want to pass a value of type RANGE OF to a method declared in
an interface (the interface is built using Class Builder). I don't know
how to do that and I did not manage to find a solution using both
SAP help and google.
Did anybody have the same problem before?
--
Best regards
Pawel
06-18-2008 1:41 PM
Hi,
see my posting .
You can specify such a table type in DDIC.
Regards Rudi
06-18-2008 11:40 AM
Hi,
Can u tell me the method name and class name to which u want to pass the range values.
Regards,
Ruby
06-18-2008 11:43 AM
The method and parameter names are irrelevant, so
I don't understand your request.
06-18-2008 11:42 AM
HI I did it for the function module...i had passed the ranges for the function module
in the tables devlare the fields like this.
r_matnr like RANGE_WERKS
06-18-2008 11:44 AM
Yes, it works for a function module but for a method TABLES
statement is not allowed. I would still like to know how to do
that using a method.
06-18-2008 12:20 PM
Ok, I find a workaround. Maybe it will be useful for somebody in the future.
Declare the parameter type as ANY TABLE and then cast it to the expected type
in the body of the method.
So for example.
Parameter Type Typing Method Associated Type
I_RNG_DATUM Importing Type ANY TABLE
In the body of the method.
TYPES:
erdat_range TYPE RANGE OF erdat.
FIELD-SYMBOLS:
<l_fs_rng_erdat> TYPE erdat_range.
DATA:
l_ref_to_range TYPE REF TO data.
GET REFERENCE OF i_rng_datum INTO l_ref_to_range.
ASSIGN l_ref_to_range->* TO <l_fs_rng_erdat> CASTING.
However, if somebody know how to pass type RANGE OF
explicitely, the right answer is still welcome.
Best regards
Pawel
06-18-2008 12:41 PM
06-18-2008 1:03 PM
When I try to pass SELECT-OPTIONS variable to a method with a parameter type declared
as TYPE RSELOPTION I got compile error "S_ERDAT" is not type-compatible with formal parameter "I_RNG_DATUM".
S_ERDAT definition:
DATA: g_erdat TYPE erdat.
SELECT-OPTIONS: s_erdat FOR g_erdat.
Parameter of my method looks like that right now:
I_RNG_DATUM Importing Type RSELOPTION.
Best regards
Pawel
Edited by: Pawel Jagus on Jun 18, 2008 2:03 PM
06-18-2008 1:38 PM
what you are saying is that you declared a variable of type RSELOPTION as the importing parameter of a method.
and within the method how you are using that variable?
is it with a select stt? if yes can you post the select stt code here.
where is select-option coming here.
Regards
Raja
06-18-2008 1:50 PM
No, you got me wrong. I am talking about method invocation.
I turns out that I cannot pass SELECT-OPTIONS directly to the method as
type RSELOPTION because they are not type compatible.
I have to first loop at SELECT-OPTIONS and move corresponding
fields to a RSELOPTION working area then append it to a RSELOPTION
table.
After that I am able to pass the parameter to the method.
I cannot pass SELECT-OPTIONS directly.
Best regards
Pawel
Edited by: Pawel Jagus on Jun 18, 2008 2:51 PM
Edited by: Pawel Jagus on Jun 18, 2008 2:51 PM
06-18-2008 2:08 PM
Hi,
you have to pass the select-option with brackets [], because a select-option is a table type with header line. If you do not use the brackets then just the header line is passed to the method. And sure, this is not type compatible to RSELOPTION.
o_mail->add_receiver( it_sel = so_range[] ).
Regards Rudi
06-18-2008 2:32 PM
Rudi, in my opinion your solution is the best.
I applied it and everything is now as I expected
it to be.
Thank you all very much for the support.
I am closing this topic as answered.
Best regards
Paweł
06-18-2008 1:41 PM
Hi,
see my posting .
You can specify such a table type in DDIC.
Regards Rudi
06-18-2008 1:45 PM
Hi,
data:
w_matid TYPE matnr,
Range table for matid
rt_matid LIKE RANGE OF w_matid,
Workarea for matid
wa_matid LIKE LINE OF rt_matid.
Thanks,
Rajinikanth G