‎2011 Oct 05 12:44 PM
HI All,
I am using this logic In few methods of mine and I wonder if there is option the create one method
and every time that I need it just call it.
The issue is that <lt_output> is not assign yet (this need to happen in the method itself )so And I need to export it
and if I am creating method with exporting field type any I put the field symbol there I am getting dump.
Any idea ?
ASSIGN COMPONENT lv_table_out
OF STRUCTURE is_response TO <lt_output>.
IF sy-subrc <> 0.
READ TABLE it_map INTO ls_map INDEX 1.
lv_out = ls_map-left.
ASSIGN COMPONENT lv_out
OF STRUCTURE is_response TO <lt_output>.
ENDIF.Best regards
Joy
‎2011 Oct 05 1:16 PM
Hi Joy,
Why would you need to export a field symbol that is not assigned yet?
In my opinion only the component name (lv_table_out) and structure name (is_response) have to be passed...
Kr,
m.
‎2011 Oct 05 1:15 PM
Hi,
did you try to create a macro (local or in db table TRMAC) ?
Regards,
Klaus
‎2011 Oct 05 1:20 PM
‎2011 Oct 05 1:16 PM
Hi Joy,
Why would you need to export a field symbol that is not assigned yet?
In my opinion only the component name (lv_table_out) and structure name (is_response) have to be passed...
Kr,
m.
‎2011 Oct 05 1:22 PM
HI Manu,
The issue is that the the only thing that I need to use after i call to this method is <lt_output> ...
Thanks,
Joy
‎2011 Oct 05 1:38 PM
Hi,
Ok, then you will have to use a data object to reference your field symbol and use a returning parameter I guess:
DATA: lo_data TYPE REF TO data.
FIELD-SYMBOLS: <lt_output> TYPE ANY.
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: get RETURNING value(r_val) TYPE REF TO data.
ENDCLASS.
CLASS lcl_main IMPLEMENTATION.
METHOD get.
FIELD-SYMBOLS <fs> TYPE ANY.
ASSIGN COMPONENT 1 OF STRUCTURE is_response TO <fs>.
GET REFERENCE OF <fs> INTO r_val.
ENDMETHOD. "get
ENDCLASS.
START-OF-SELECTION.
lo_data = lcl_main=>get( ).
ASSIGN lo_data->* TO <lt_output>.
Kr,
m.
Edited by: Manu D'Haeyer on Oct 5, 2011 2:42 PM