Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using field symbol on export parameter

Former Member
0 Likes
2,968

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,336

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.

5 REPLIES 5
Read only

Former Member
0 Likes
1,336

Hi,

did you try to create a macro (local or in db table TRMAC) ?

Regards,

Klaus

Read only

0 Likes
1,336

HI Klaus,

I think that Macro is obsolete ..

In OO

Regards

Joy

Read only

Former Member
0 Likes
1,337

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.

Read only

0 Likes
1,336

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

Read only

0 Likes
1,336

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