‎2007 May 31 11:47 AM
Hi all,
Can we declare a variable using Generic type CLIKE???? If so how can we do that? Please explain me with an Example.....
Its urgent!!!!
will award points if useful....
regards,
arvish...
‎2007 May 31 12:07 PM
Hi Arvish,
You can use the generic type CLIKE only with field-symbols and formal parameters. You might have noticed that during the syntax-check. So I guess, its better to go for field-symbols if you need a generic variable.
Can you elaborate a bit more on why you really need to go for a generic type??
Regards
Anil Madhavan
‎2007 May 31 11:54 AM
hi arvish
plz refer to the link below for ur query
example
comibining parallel processing (CALL FUNCTION STARTING NEW TASK) with the ABAP OO concept of events.
Here you can find a simple report.
REPORT zcra_parallel2.
----
CLASS receiver_class DEFINITION
----
*
----
CLASS receiver_class DEFINITION.
PUBLIC SECTION.
METHODS:
start IMPORTING value(i_taskname) TYPE char8,
<b>receiver1 IMPORTING value(p_task) TYPE clike.</b>
<b>EVENTS:
finished.</b>
ENDCLASS. "receiver_class DEFINITION
----
CLASS receiver_class IMPLEMENTATION
----
*
----
CLASS receiver_class IMPLEMENTATION.
METHOD start.
CALL FUNCTION 'ZZ_CRA1' STARTING NEW TASK i_taskname
CALLING me->receiver1 ON END OF TASK
EXPORTING
mytask = i_taskname.
IF sy-subrc = 0.
WRITE: /, i_taskname, ' TASK started...'.
ENDIF.
ENDMETHOD. "start
METHOD receiver1.
DATA:
myinfo TYPE TABLE OF zcra1.
RECEIVE RESULTS FROM FUNCTION 'ZZ_CRA1'
TABLES my_itab = myinfo.
<b>RAISE EVENT finished.</b>
ENDMETHOD. "receiver1
ENDCLASS. "receiver_class IMPLEMENTATION
----
CLASS x DEFINITION
----
*
----
CLASS caller DEFINITION.
PUBLIC SECTION.
DATA:
y_ref TYPE REF TO receiver_class,
z_ref TYPE REF TO receiver_class.
METHODS:
constructor,
<b>result FOR EVENT finished OF receiver_class.</b>
ENDCLASS. "callerx DEFINITION
----
CLASS callerx IMPLEMENTATION
----
*
----
CLASS caller IMPLEMENTATION.
METHOD constructor.
SET HANDLER: me->result FOR ALL INSTANCES.
CREATE OBJECT: y_ref, z_ref.
CALL METHOD y_ref->start( 'WAIT1' ).
CALL METHOD z_ref->start( 'WAIT2' ).
ENDMETHOD. "constructor
<b>METHOD result.
WRITE: /, 'EVENT TRIGGERD!'.
ENDMETHOD.</b> "result
ENDCLASS. "callerx IMPLEMENTATION
DATA:
mycaller TYPE REF TO caller.
START-OF-SELECTION.
CREATE OBJECT mycaller.
regards
ravish
<b>plz dont forget to reward points if helpful</b>
Message was edited by:
ravish goyal
‎2007 May 31 12:07 PM
Hi Arvish,
You can use the generic type CLIKE only with field-symbols and formal parameters. You might have noticed that during the syntax-check. So I guess, its better to go for field-symbols if you need a generic variable.
Can you elaborate a bit more on why you really need to go for a generic type??
Regards
Anil Madhavan
‎2009 Jul 01 7:01 PM