Declaring Field Symbols in Public Section of class
Dear All,
I am working with class and hav declared some field symbols in one of the method.
Now I want to move these declaration in Public section of the class so that this field symbol declaration can be used by other methods of the class but I am not able to do the same.
Can anyone help me in finding as what I am doing wrong here.
Regards,
Lalit Kabra
What you are trying to do is define an attribute. I doubt you can use field symbol as a class attribute. Consider using a data object instead.
Data : dref type ref to data.
This can later be deferenced in the individual methods.
Hope this helps.
Here's an example for the same:
REPORT z_class_001 .
* CLASS lcl_class1 DEFINITION
CLASS lcl_class1 DEFINITION.
PUBLIC SECTION.
DATA dref TYPE REF TO data.
METHODS : constructor IMPORTING i_type TYPE char20,
meth1 IMPORTING value TYPE i.
ENDCLASS. "lcl_class1 DEFINITION
* CLASS lcl_class1 IMPLEMENTATION
CLASS lcl_class1 IMPLEMENTATION.
METHOD constructor.
CREATE DATA dref TYPE (i_type).
ENDMETHOD. "constructor
METHOD meth1.
FIELD-SYMBOLS <fs> TYPE ANY.
ASSIGN dref->* TO <fs>.
WRITE: 'Value is ' ,value.
ASSIGN value TO <fs>.
WRITE: 'Field symbol is ', <fs>.
ENDMETHOD. "meth1
ENDCLASS. "lcl_class1 IMPLEMENTATION
START-OF-SELECTION.
DATA ref_class TYPE REF TO lcl_class1.
CREATE OBJECT ref_class EXPORTING i_type = 'I'.
CALL METHOD ref_class->meth1
EXPORTING
value = 3.
BR,
Advait
Edited by: Advait Gode on Sep 16, 2009 9:44 AM
Similar Messages
-
Right way to declare field symbols
i am new to field symbols, pls help
i want to know which is the right way of declaration ?
types: begin of typ_tab,
vbeln type vbap-vbeln,
posnr type vbap-posnr,
matnr type vbap-matnr,
end of typ_tab.
data: itab type standard table of typ_tab,
wa type typ_tab.
field-symbols: <f_t> type standard table,
<f_w> type any, or <f_w> like line of typ_tab, ??
<f_s> type any.
select vbeln posnr ....... into itab......
assign itab to <f_t>.
assign wa to <f_w>.
loop at <f_t> assigning <f_w>.
assign component 'vbeln' of structure <f_w> to <f_s>.
write : / <f_s>.
endloop.
OR
loop at itab assigning <f_w>.
write: / <f_w>-vbeln.
endloop.
r these 2 statements correctt ? if so then which one to use, pls show with an example. wats the diff btwn above 2 types of looping statements ? how to use read statement on this ?Hello Saurajit,
Both the way are correct. And it depends on the requirement, which one to use.
<f_w> TYPE ty_tab - is TYPED field symbol - if you know TYPE before runtime you can use this. It will just work like a static work area.
<f_w> TYPE any - is not TYPED and structure of this field symbol is defined during runtime using ASSIGN statement. And fields of the structure is read by ASSIGN COMPONENT <<field name>> statement. -
Field symbol as import parameter in class method ???
Hi everyone,
is it possible to pass a field symbol as an import parameter to a method in a class? If yes, how do I define the data type of the import parameter? I'm trying to work with field symbols as the program doesn't know what kind of structure the program parameter p_srcdso has. Coding example would be something like this:
PARAMETERS: p_srcdso TYPE rsdodsobject DEFAULT '/BIC/AKVI0001'.
DATA: lr_srcpkg TYPE REF TO data.
FIELD-SYMBOLS: <fs_table> TYPE ANY TABLE.
CREATE DATA lr_srcpkg TYPE TABLE OF (p_srcdso).
ASSIGN lr_srcpkg->* TO <fs_table>.
SELECT *
FROM (p_srcdso)
INTO TABLE <fs_table>.
CALL METHOD cl_ref->create_somethign
EXPORTING
i_source_package = <fs_table>.
Thanks,
AlexHalo Alexander,
You can use TYPE REF TO DATA( say the parameter name is i_data) as the importing parameter of the method create_somethign and inside the method you need to dereference it using data reference variable again.
data: dref type ref to data.
field-symbols: <fs_table> type table.
create data dref like i_data.
assign dref->* to <fs_table>.
Regards
Arshad -
Declaring Field Symbols in a work area
Hi all!
I'm triying to learn the use of FieldSymbols, and I wrote in my code this:
REPORT zpractica01.
Types
TYPES: BEGIN OF ty_tabla,
name(25) TYPE c,
address(60) TYPE c,
monto(3) TYPE p decimals 2,
END OF ty_tabla.
Internal Table
DATA: t_tabla TYPE STANDARD TABLE OF ty_tabla.
*Work Area
DATA: vl_variable TYPE c LENGTH 512.
Field Symbols
FIELD-SYMBOLS <linea> STRUCTURE st_tabla DEFAULT vl_variable.
If I try to activate the code I see this error:
In the Unicode context, the structure <LINEA> typed using STRUCTURE can only contain character-type components (type C,N,D,T).
I can see that the problem begins when I use a type P inside the structure, but I need to have a type P, so I would like to know how can i use it.
Could you please teach me how I should declare my field symbols in order to use as an structure with a type P field within a loop at - endloop?
I'll really appreciate your help.
Best regards!
Gaby
Edited by: gpsoria on Aug 24, 2009 4:30 PMHello Gaby,
You are getting the error because the structure st_tabla & variable vl_variable are not mutually convertible in a Unicode environment.
Just change the definition of vl_variable & you code will activate.
REPORT zpractica01.
* Types
TYPES: BEGIN OF ty_tabla,
name(25) TYPE c,
address(60) TYPE c,
monto(3) TYPE p decimals 2,
END OF ty_tabla.
* Internal Table
DATA: t_tabla TYPE STANDARD TABLE OF ty_tabla.
*Work Area
DATA: st_tabla TYPE ty_tabla. "--> Add this line
DATA: vl_variable TYPE ty_tabla. "c LENGTH 512.
* Field Symbols
FIELD-SYMBOLS <linea> STRUCTURE st_tabla DEFAULT vl_variable.
*I will suggest decalre like this:
FIELD-SYMBOLS <linea1> TYPE ty_tabla.
Hope i am clear.
BR,
Suhas -
Hello,
Is it possible to use field-symbols in classes?
When I try to declare field-symbol in class like other variable, appears an error.
Or may be it is possible to use something instead of field-symbols?
Great thanx in advance!Hi
You can use field symbols in classes.
Sample code is given below:
CLASS c1 DEFINITION.
PUBLIC SECTION.
METHODS m1 IMPORTING oref TYPE REF TO object
attr TYPE string.
ENDCLASS.
CLASS c1 IMPLEMENTATION.
METHOD m1.
FIELD-SYMBOLS <attr> TYPE ANY.
ASSIGN oref->(attr) TO <attr>.
WRITE <attr> ...
ENDMETHOD.
ENDCLASS.
Thanks
Khushboo -
Is it possible to declare field symbols inside classes?
Thanks in advance.
Hema
Moderator message: please search for information and try yourself before asking.
Edited by: Thomas Zloch on Dec 23, 2010 10:55 AMHi Hemalatha,
We can use Field Symbols in classes.
local field_symbols within methods are allowed.
you can only use field-symbols within method (locally), not as direct class attribute (globally).
U can check with this sample code.
Sample code is given below:
CLASS c1 DEFINITION.
PUBLIC SECTION.
METHODS m1 IMPORTING oref TYPE REF TO object attr TYPE string.
ENDCLASS.
CLASS c1 IMPLEMENTATION.
METHOD m1.
FIELD-SYMBOLS <attr> TYPE ANY.
ASSIGN oref->(attr) TO <attr>.
WRITE <attr> ...
ENDMETHOD.
ENDCLASS.
I hope u got this ..... -
Field symbols as Class Attributes
Hello Gurus,
Is anybody able to say to me if it is possible to declare field symbols as class attributes? As I can understand until now, this is not possible and we need to use some attribute with the "TYPE REF TO Data" to get the information we need. Correct?
Thanks,
Daniel.Ok, let me see if someone can give me some idea on how to improve my method:
Method: PREPARE_PTOOL_DATA
Parameters specification:
Parameter Type Typing Reference Type
PF_ANALYSIS Importing Type /SYM/SC_PT_ID_ANALYSIS_D
PF_ANAL_DESC Importing Type /SYM/SC_NM_DESC_ANALYSIS
PF_LOGIC Importing Type CHAR01
PF_MATERIAL Importing Type MATNR
PF_MAKTX Importing Type MAKTX
PT_DATA_COMPA Exporting Type /SYM/SC_TAB_PT_RESULT_CP
PT_CALC_ANALY Exporting Type /SYM/SC_TAB_PT_RESULT_CA
PT_DATA_MATERIAL1 Changing Type /SYM/SC_TAB_PROC_ALLERG_RESULT
PT_DATA_MATERIAL2 Changing Type /SYM/SC_TAB_PROC_ALLERG_RESULT
Source code:
From the /SYM/SC_CL_PROCESS_ALLERG_GEN class
Old version (but it is working)
METHOD prepare_ptool_data.
DATA: ls_data_material1 TYPE /sym/sc_s_proc_allerg_result,
ls_data_material2 TYPE /sym/sc_s_proc_allerg_result,
lf_index_material1 TYPE sy-tabix,
lf_index_material2 TYPE sy-tabix,
ls_result_cp TYPE /sym/sc_pt_result_cp,
ls_result_ca TYPE /sym/sc_pt_result_ca.
Prepare data for Data Comparison step
IF pt_data_compa IS REQUESTED.
LOOP AT pt_data_material1 INTO ls_data_material1.
lf_index_material1 = sy-tabix.
CLEAR ls_result_cp.
MOVE pf_analysis TO ls_result_cp-analysis.
MOVE pf_anal_desc TO ls_result_cp-desc_analysis.
MOVE ls_data_material1-algbe TO ls_result_cp-desc_property.
If Logic 'A', move the text from ls_data_material1 to original
material status
IF pf_logic EQ c_logic_a.
MOVE ls_data_material1-agsbe TO ls_result_cp-val_orig_matnr.
If Logic 'B', move the text from ls_data_material1 to "toy"
material status
ELSEIF pf_logic EQ c_logic_b.
MOVE ls_data_material1-agsbe TO ls_result_cp-val_toy_matnr.
ENDIF. " IF pf_logic EQ c_logic_a.
Read the lt_data_toy by the Allergen ID (ALGEN)
CLEAR ls_data_material2.
READ TABLE pt_data_material2 INTO ls_data_material2
WITH KEY algen = ls_data_material1-algen BINARY SEARCH.
IF sy-subrc EQ 0.
lf_index_material2 = sy-tabix.
If Logic 'A', move the text from ls_data_material2 to "toy°
material status
IF pf_logic EQ c_logic_a.
MOVE ls_data_material2-agsbe TO ls_result_cp-val_toy_matnr.
If Logic 'B', move the text from ls_data_material2 to original
material status
ELSEIF pf_logic EQ c_logic_b.
MOVE ls_data_material2-agsbe TO ls_result_cp-val_orig_matnr.
ENDIF. " IF pf_logic EQ c_a.
Delete record from lt_data_toy, index lf_index_toy
DELETE pt_data_material2 INDEX lf_index_material2.
ENDIF. " IF sy-subrc EQ 0.
APPEND ls_result_cp TO pt_data_compa.
Delete record from lt_data_orig, index lf_index_orig
DELETE pt_data_material1 INDEX lf_index_material1.
ENDLOOP. " LOOP AT lt_data_material1 INTO ls_data_material1.
ENDIF. " IF pt_data_compa IS REQUESTED.
Prepare data for Calculation Analysis step
IF pt_calc_analy IS REQUESTED.
LOOP AT pt_data_material1 INTO ls_data_material1.
lf_index_material1 = sy-tabix.
CLEAR ls_result_ca.
MOVE pf_material TO ls_result_ca-matnr.
MOVE pf_maktx TO ls_result_ca-maktx.
MOVE pf_analysis TO ls_result_ca-analysis.
MOVE pf_anal_desc TO ls_result_ca-desc_analysis.
MOVE ls_data_material1-algbe TO ls_result_ca-desc_property.
If Logic 'A', move the text from ls_data_material1 to original
material status
IF pf_logic EQ c_logic_a.
MOVE ls_data_material1-agsbe TO ls_result_ca-val_curr_stat.
If Logic 'B', move the text from ls_data_material1 to "toy"
material status
ELSEIF pf_logic EQ c_logic_b.
MOVE ls_data_material1-agsbe TO ls_result_ca-val_simul_stat.
ENDIF. " IF pf_logic EQ c_logic_a.
Read the lt_data_toy by the Allergen ID (ALGEN)
CLEAR ls_data_material2.
READ TABLE pt_data_material2 INTO ls_data_material2
WITH KEY algen = ls_data_material1-algen BINARY SEARCH.
IF sy-subrc EQ 0.
lf_index_material2 = sy-tabix.
If Logic 'A', move the text from ls_data_material2 to "toy°
material status
IF pf_logic EQ c_logic_a.
MOVE ls_data_material2-agsbe TO ls_result_ca-val_simul_stat.
If Logic 'B', move the text from ls_data_material2 to original
material status
ELSEIF pf_logic EQ c_logic_b.
MOVE ls_data_material2-agsbe TO ls_result_ca-val_curr_stat.
ENDIF. " IF pf_logic EQ c_a.
Delete record from lt_data_toy, index lf_index_toy
DELETE pt_data_material2 INDEX lf_index_material2.
ENDIF. " IF sy-subrc EQ 0.
APPEND ls_result_ca TO pt_calc_analy.
Delete record from lt_data_orig, index lf_index_orig
DELETE pt_data_material1 INDEX lf_index_material1.
ENDLOOP. " LOOP AT lt_data_material1 INTO ls_data_material1.
ENDIF. " IF pt_calc_analy IS REQUESTED.
ENDMETHOD.
As you can see, I am repeating almost the same code, just changing some items. I am not sure if I can use new parameters (ANY or ANY TABLE) but, my first idea to improve it was to use the field-symbols (and it works ok). The issue is that I have to repeat the assignment lines every same named method of the classes I am changing (I would like to do the assignment into a new method of the superclass). Do you think it is possible or should I give up and proceed with the assignments locally, for each same named method of each class?
Thanks,
Daniel. -
Perform setting OOP ALV for multiple reports using Field Symbols
Hi, Abapers ... i try to write a programme which using ONE oop ALV but 2 different structure internal table. the last result should be 2 radio button. first button is r_wbs and 2ns r_kpi. r_wbs will display 4 column answer and r_kpi will display 10 columns answer with different column name. i successfully implemented using FIELDS SYMBOLS but the problems i failed to perform customized setting forALV (report's tittle, column name, different layout etc) for 2 different reports. this is the programme. Please Give Opinion, simple example will be more helpful. Thanks You Very Much
*&this report experimental how to print into ONE alv
*&with 2 diffrent structure internal table
REPORT zfiroopalv.
SELECTION-SCREEN BEGIN OF BLOCK mode WITH FRAME TITLE text-002.
PARAMETERS r_wbs RADIOBUTTON GROUP mode DEFAULT 'X'.
PARAMETERS r_kpi RADIOBUTTON GROUP mode.
SELECTION-SCREEN END OF BLOCK mode.
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
CLASS-DATA: md_wbs TYPE c LENGTH 1.
METHODS: process,
write.
DATA: mdo_data TYPE REF TO data.
TYPES: BEGIN OF st_wbs,
rsnum TYPE zmeime002a-rsnum,
rspos TYPE zmeime002a-rspos,
a TYPE zmmgitab01-menge,
b TYPE zmeime002a-bdmng,
c TYPE zmeime002a-bdmng,
d TYPE zmeime002a-bdmng,
e TYPE zmeime002a-bdmng,
f TYPE zmmgitab01-menge,
g TYPE zmmgitab01-menge,
END OF st_wbs.
TYPES: BEGIN OF st_kpi,
regio TYPE zmeime002a-regio,
gsber TYPE zmeime002a-gsber,
gtext TYPE zmeime002a-gtext,
x TYPE zmmgitab01-menge,
y TYPE zmmgitab01-menge,
z TYPE zmmgitab01-menge,
END OF st_kpi.
CLASS-DATA: it_wbs TYPE TABLE OF st_wbs,
wa_wbs LIKE LINE OF it_wbs.
CLASS-DATA: it_kpi TYPE TABLE OF st_kpi,
wa_kpi LIKE LINE OF it_kpi.
PRIVATE SECTION.
DATA: set_display_setting TYPE REF TO cl_salv_table.
DATA: display_settings TYPE REF TO cl_salv_display_settings.
DATA: salv_table TYPE REF TO cl_salv_table.
DATA: error TYPE REF TO cx_root.
DATA: errtext TYPE string.
ENDCLASS.
CLASS lcl_kpi DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: process_kpi.
PRIVATE SECTION.
ENDCLASS.
* C.L.A.S.S lcl_main D.E.F.I.N.I.T.I.O.N
CLASS lcl_wbs DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: process_wbs.
PRIVATE SECTION.
ENDCLASS.
* m.a.i.n. .p.r.o.g.r.a.m.
START-OF-SELECTION.
DATA: o_main TYPE REF TO lcl_main.
DATA: p_wbs TYPE c.
CREATE OBJECT o_main.
CASE 'X'.
WHEN r_wbs.
o_main->md_wbs = 'X'.
WHEN r_kpi.
o_main->md_wbs = ' '.
ENDCASE.
o_main->process( ).
o_main->write( ).
CLASS lcl_main IMPLEMENTATION.
*ENDMETHOD.
METHOD process. " NOTE: public method
DATA: o_main TYPE REF TO lcl_main,
o_wbs TYPE REF TO lcl_wbs,
o_kpi TYPE REF TO lcl_kpi.
CREATE OBJECT: o_wbs,o_kpi.
IF ( me->md_wbs = 'X' ).
CALL METHOD o_wbs->process_wbs( ). " NOTE: private method
GET REFERENCE OF me->it_wbs INTO me->mdo_data.
ELSE.
CALL METHOD o_kpi->process_kpi( ). " NOTE: private method
GET REFERENCE OF me->it_kpi INTO me->mdo_data.
ENDIF.
ENDMETHOD.
METHOD write.
FIELD-SYMBOLS:
<lt_outtab> TYPE table.
ASSIGN me->mdo_data->* TO <lt_outtab>.
cl_salv_table=>factory(
EXPORTING
list_display = if_salv_c_bool_sap=>false
IMPORTING
r_salv_table = salv_table
CHANGING
t_table = <lt_outtab>
salv_table->display( ).
ENDMETHOD.
ENDCLASS.
CLASS lcl_kpi IMPLEMENTATION.
METHOD process_kpi.
*********** run some select statement into it_kpi*******
ENDMETHOD.
ENDCLASS.
CLASS lcl_wbs IMPLEMENTATION.
METHOD process_wbs.
*********** run some select statement into it_wbs*******
ENDMETHOD.
ENDCLASS.Hi,
I had similar requirement wherein I was supposed to display different data using 2 different internal tables on a subscreen area.
The screen consists of two parts: 1) selection-screen with few input fields and two buttons 2) Subscreen area where the report need to be displayed. This report is displayed based on the button that the user is selecting. For this I have done the following things:
1. Capture the sy-ucomm when user is clicking on any of the two buttons in PAI. Then perform data fetch operation.
MODULE USER_COMMAND_9003 INPUT.
CASE OK_CODE.
WHEN 'DETAIL'.
GV_RPT = OK_CODE.
PERFORM F_GET_DETAIL_DATA.
WHEN 'REPORT'.
GV_RPT = OK_CODE.
PERFORM F_GET_REPT_DATA.
ENDCASE.
ENDMODULE. " USER_COMMAND_9003 INPUT
2. Declare two different ALV's with the fieldcat similar to 2 internal tables respectively. Use the above sy-ucomm PBO to call appropriate ALV.
MODULE DISPLAY_ALV OUTPUT.
IF GV_RPT EQ 'DETAIL'.
PERFORM F_FIELDCAT_DETAIL.
PERFORM F_LAYOUT_DETAIL.
PERFORM F_EXCLUDE_TOOLBAR_DETAIL.
PERFORM F_DISPLAY_ALV_DETAIL.
ELSEIF GV_RPT EQ 'REPORT'.
PERFORM F_FIELDCAT_REPT.
PERFORM F_LAYOUT_REPT.
PERFORM F_EXCLUDE_TOOLBAR_REPT.
PERFORM F_DISPLAY_ALV_REPT.
ENDIF.
ENDMODULE. " DISPLAY_ALV OUTPUT
3. Before displaying ALV you need to free the container and ALV.
FORM F_DISPLAY_ALV_DETAIL .
IF GC_CONTAINER_ES IS NOT INITIAL.
CALL METHOD GC_CONTAINER_ES->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF GC_ALV_GRID_ES IS NOT INITIAL.
CALL METHOD GC_ALV_GRID_ES->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF GC_CONTAINER_TB IS NOT INITIAL.
CALL METHOD GC_CONTAINER_TB->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF GC_ALV_GRID_TB IS NOT INITIAL.
CALL METHOD GC_ALV_GRID_TB->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CREATE OBJECT GC_CONTAINER_ES
EXPORTING
CONTAINER_NAME = 'CC_9003'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6.
CREATE OBJECT GC_ALV_GRID_ES
EXPORTING
I_PARENT = GC_CONTAINER_ES
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
CALL METHOD GC_ALV_GRID_ES->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = GS_LAYOUT_ES
IT_TOOLBAR_EXCLUDING = GT_TOOLBAR_ES
CHANGING
IT_OUTTAB = GT_ES_REPT
IT_FIELDCATALOG = GT_FIELDCAT_ES
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
ENDFORM. " F_DISPLAY_ALV_DETAIL
Similarly define the FORM F_DISPLAY_ALV_REPT.
Hope this will be useful for you. If you have any more queries let me know. -
How to use Field-symbol with dynamic select query
Can anybody tell me, how to use field-symbols in the dynamic select query.
FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
1. ... typing
2. ... STRUCTURE struc DEFAULT dobj
The FIELD-SYMBOLS statement declares a field symbol <fs>. The name conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.
After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.
eg.
FIELD-SYMBOLS <fs> TYPE ANY.
DATA: BEGIN OF line,
string1(10) VALUE '0123456789',
string2(10) VALUE 'abcdefghij',
END OF line.
WRITE / line-string1+5.
ASSIGN line-string1+5(*) TO <fs>.
WRITE / <fs>.
output:
56789
56789
reward if helpful
anju -
What are field symbols and field groups.? Have you used "component idx of structure" clause with field groups?
Hi
this will help you
reward if usefull
<b><u>FIELD-SYMBOLS</u></b>
<u>Syntax</u>
FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
Extras:
1. ... typing
2. ... STRUCTURE struc DEFAULT dobj
The FIELD-SYMBOLS statement declares a field symbol <fs>. The name conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.
After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.
<b><u>FIELD-GROUPS</u></b>
<u>Syntax</u>
FIELD-GROUPS { header | field_group }.
Declaration of a field group for the extract dataset of the program. Each field group represents the name of a line structure of the extract dataset. You can create as many field groups as you wish in a program. You define the actual components of a field group with the statement INSERT.
The denominator of a field group is either the predefined name header or any name field_group. If you declare a field group header, it automatically becomes the beginning part of all remaining field groups of the program and its components constitute the standard sort key of the extract dataset for the statement SORT.
The statement FIELD-GROUPS is possible in the global declaration-part of an ABAP program, as well as in the subprograms and function modules. Field groups that are declared in procedures are visible only there.
As you can only define global data objects as components of field groups with the statement INSERT, we recommend to declare field groups only in the global declaration part as well. -
Field Symbols, Field String, and Field Group.
Hi,
Can you differentiate between filed symbols, field strings and field groups,
With regards,
Bharath Mohan BHi,
Field Symbols
Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
Field symbols provide greater flexibility when you address data objects:
If you want to process sections of fields, you can specify the offset and length of the field dynamically.
You can assign one field symbol to another, which allows you to address parts of fields.
Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
You can also force a field symbol to take different technical attributes from those of the field assigned to it.
The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
check the below links u will get the answers for your questions
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
Syntax Diagram
FIELD-SYMBOLS
Basic form
FIELD-SYMBOLS <fs>.
Extras:
1. ... TYPE type
2. ... TYPE REF TO cif
3. ... TYPE REF TO DATA
4. ... TYPE LINE OF type
5. ... LIKE s
6. ... LIKE LINE OF s
7. ... TYPE tabkind
8. ... STRUCTURE s DEFAULT wa
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
Effect
This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
You can only use one of the additions.
Example
Output aircraft type from the table SFLIGHT using a field symbol:
FIELD-SYMBOLS <PT> TYPE ANY.
DATA SFLIGHT_WA TYPE SFLIGHT.
ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
WRITE <PT>.
Addition 1
... TYPE type
Addition 2
... TYPE REF TO cif
Addition 3
... TYPE REF TO DATA
Addition 4
... TYPE LINE OF type
Addition 5
... LIKE s
Addition 6
... LIKE LINE OF s
Addition 7
... TYPE tabkind
Effect
You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
Effect
Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
Example
Address components of the flight bookings table SBOOK using a field symbol:
DATA SBOOK_WA LIKE SBOOK.
FIELD-SYMBOLS <SB> STRUCTURE SBOOK
DEFAULT SBOOK_WA.
WRITE: <SB>-BOOKID, <SB>-FLDATE.
Related
ASSIGN, DATA
Additional help
Declaring Field Symbols
FIELD GROUPS
are used to hold/handle large amount of data when the internal table are not useful
we use EXTRACT statement, HEADER structure in them
see the example
REPORT demo_extract.
NODES: spfli, sflight.
FIELD-GROUPS: header, flight_info, flight_date.
START-OF-SELECTION.
INSERT: spfli-carrid spfli-connid sflight-fldate
INTO header,
spfli-cityfrom spfli-cityto
INTO flight_info.
GET spfli.
EXTRACT flight_info.
GET sflight.
EXTRACT flight_date.
END-OF-SELECTION.
SORT STABLE.
LOOP.
AT FIRST.
WRITE / 'Flight list'.
ULINE.
ENDAT.
AT flight_info WITH flight_date.
WRITE: / spfli-carrid , spfli-connid, sflight-fldate,
spfli-cityfrom, spfli-cityto.
ENDAT.
AT flight_date.
WRITE: / spfli-carrid , spfli-connid, sflight-fldate.
ENDAT.
AT LAST.
ULINE.
WRITE: cnt(spfli-carrid), 'Airlines'.
ULINE.
ENDAT.
ENDLOOP.
FIELD STRING is nothing but a string with one row of records.
Reward points if useful
regards
Anji -
Re: field symbols and interna table
hi,
here is field symbol which is table type
FIELD-SYMBOLS: <gt_pos_data> TYPE table.
there is one internal table it_data.
how can move <gt_pos_data> to it_data.
please help me.
rgdsHi
You can assign field wise:
like
<gt_pos_data>- field to to it_data-field.
Field Symbols
Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
Field symbols provide greater flexibility when you address data objects:
If you want to process sections of fields, you can specify the offset and length of the field dynamically.
You can assign one field symbol to another, which allows you to address parts of fields.
Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
You can also force a field symbol to take different technical attributes from those of the field assigned to it.
The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
check the below links u will get the answers for your questions
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
Syntax Diagram
FIELD-SYMBOLS
Basic form
FIELD-SYMBOLS <fs>.
Extras:
1. ... TYPE type
2. ... TYPE REF TO cif
3. ... TYPE REF TO DATA
4. ... TYPE LINE OF type
5. ... LIKE s
6. ... LIKE LINE OF s
7. ... TYPE tabkind
8. ... STRUCTURE s DEFAULT wa
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
Effect
This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
You can only use one of the additions.
Example
Output aircraft type from the table SFLIGHT using a field symbol:
FIELD-SYMBOLS <PT> TYPE ANY.
DATA SFLIGHT_WA TYPE SFLIGHT.
ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
WRITE <PT>.
Addition 1
... TYPE type
Addition 2
... TYPE REF TO cif
Addition 3
... TYPE REF TO DATA
Addition 4
... TYPE LINE OF type
Addition 5
... LIKE s
Addition 6
... LIKE LINE OF s
Addition 7
... TYPE tabkind
Effect
You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
Effect
Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
Example
Address components of the flight bookings table SBOOK using a field symbol:
DATA SBOOK_WA LIKE SBOOK.
FIELD-SYMBOLS <SB> STRUCTURE SBOOK
DEFAULT SBOOK_WA.
WRITE: <SB>-BOOKID, <SB>-FLDATE.
Related
ASSIGN, DATA
Additional help
Declaring Field Symbols
Reward points if useful
Regards
Anji -
Field-Symbols as Method Parameter
Hi all,
is there a way to create a field symbol within a method and export this field-symbol directly as a method parameter?
The problem is that we can't pass a field symbol as method parameter unless it's assigned, but we would like to assign the field symbol within a method and give the result back to the calling program.
We have managed to create a field symbol within the method and give back the result as a reference (we used the type ANY).
We would like to pass the result field-symbol directly as a Method parameter.
Any ideas?
Best regards DominikHi all,
thanks for you help. I managed to do the method calls with reference parameters but I'd like to do it with fieldsymbols instead.
Your suggentions for field-symbold worked, but I could use them only with primitive datatypes.
In my requirements the table must be created within the method, so the caller doesn't know the tablestructure.
If a dummy table is assigned to the field-symbol before the call, the error "Two internal tables are neither compatible nor convertible" is produced.
Is there a solution?
Thanks in advance
Dominik
class ZZX0_CL_TEST definition
public
final
create public .
public section.
class-methods FIELD_SYMBOLS_TAB_TEST
changing
!FS type ANY .
METHOD FIELD_SYMBOLS_TAB_TEST .
DATA: it_t000 TYPE TABLE OF t000.
FIELD-SYMBOLS <field_symbol> TYPE ANY TABLE.
ASSIGN it_t000 TO <field_symbol>.
fs = <field_symbol>.
EXIT.
ENDMETHOD.
REPORT zzx0_mini.
DATA: it_mara TYPE TABLE OF mara.
START-OF-SELECTION.
* Tabellen test
FIELD-SYMBOLS: <fs> TYPE STANDARD TABLE.
ASSIGN it_mara TO <fs>.
* ASSIGN it_t000 TO <fs>.
CALL METHOD zzx0_cl_test=>field_symbols_tab_test
CHANGING
fs = <fs>.
EXIT. -
Can any one explain me about Field symbols in Genral Reports?
Can any one explain me about Field symbols in Genral Reports?
If possible, plz explain me with the code to explain me about the field symbols.
Regards,
Krishna ChaitanyaSyntax
FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
Extras:
1. ... typing
2. ... STRUCTURE struc DEFAULT dobj
Effect
The FIELD-SYMBOLS statement declares a field symbol <fs>. The naming conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.
After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.
Addition 1
... typing
Effect
You can use the addition typing to type the field symbol. The syntax of typing is described under Syntax of Typing. The typing specifies which memory areas can be assigned to the field symbol (see Checking the Typing) and in which operand positions it can be used.
Note
You can omit the addition typing outside of methods. In this case, the field symbol has the complete generic type any and is implicitly assigned the predefined constant space during the declaration.
Addition 2
... STRUCTURE struc DEFAULT dobj
Effect
If you specify the addition STRUCTURE instead of typing for a field symbol, and struc is a local program structure (a data object, not a data type) or a flat structure from the ABAP Dictionary, this structure is cast for the field symbol <fs>. You have to specify a data object dobj that is initially assigned to the field symbol.
The field symbol copies the technical attributes of structure struc as if it were completely typed. When you assign a data object using the addition DEFAULT, or later using ASSIGN, its complete data type is not checked in non- Unicode programs. Instead, the system merely checks whether it has at least the length of the structure and its alignment.
In Unicode programs, we differentiate between structured and elementary data objects. For a structured data object dobj, its Unicode fragment view has to match the one of struc. In the case of an elementary data object, the object must be character-type and flat, and struc must be purely character-type. The same applies to assignments of data objects to field symbols typed using STRUCTURE when using the ASSIGN statement.
Note
Field symbols declared using the addition STRUCTURE are a mixture of typed field symbols and a utility for casting structured data types. You should use the additions TYPE or LIKE for the FIELD-SYMBOLS statement to type field symbols, while the addition CASTING of the ASSIGN statement is used for casting.
Example
The first example shows the obsolete usage of the addition STRUCTURE.
DATA wa1 TYPE c LENGTH 512.
FIELD-SYMBOLS <scarr1> STRUCTURE scarr DEFAULT wa1.
<scarr1>-carrid = '...'.
The second example shows the replacement of STRUCTURE with the additions TYPE and CASTING.
DATA wa2 TYPE c LENGTH 512.
FIELD-SYMBOLS <scarr2> TYPE scarr.
ASSIGN wa2 TO <scarr2> CASTING.
<scarr2>-carrid = '...'.
Also,
Field Symbols
Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
Field symbols provide greater flexibility when you address data objects:
If you want to process sections of fields, you can specify the offset and length of the field dynamically.
You can assign one field symbol to another, which allows you to address parts of fields.
Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
You can also force a field symbol to take different technical attributes from those of the field assigned to it.
The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
check the below links u will get the answers for your questions
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
Syntax Diagram
FIELD-SYMBOLS
Basic form
FIELD-SYMBOLS <fs>.
Extras:
1. ... TYPE type
2. ... TYPE REF TO cif
3. ... TYPE REF TO DATA
4. ... TYPE LINE OF type
5. ... LIKE s
6. ... LIKE LINE OF s
7. ... TYPE tabkind
8. ... STRUCTURE s DEFAULT wa
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
Effect
This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
You can only use one of the additions.
Example
Output aircraft type from the table SFLIGHT using a field symbol:
FIELD-SYMBOLS <PT> TYPE ANY.
DATA SFLIGHT_WA TYPE SFLIGHT.
ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
WRITE <PT>.
Addition 1
... TYPE type
Addition 2
... TYPE REF TO cif
Addition 3
... TYPE REF TO DATA
Addition 4
... TYPE LINE OF type
Addition 5
... LIKE s
Addition 6
... LIKE LINE OF s
Addition 7
... TYPE tabkind
Effect
You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
Effect
Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
Example
Address components of the flight bookings table SBOOK using a field symbol:
DATA SBOOK_WA LIKE SBOOK.
FIELD-SYMBOLS <SB> STRUCTURE SBOOK
DEFAULT SBOOK_WA.
WRITE: <SB>-BOOKID, <SB>-FLDATE.
Related
ASSIGN, DATA
Additional help
Declaring Field Symbols -
Using field symbol on export parameter
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
JoyHi,
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
Maybe you are looking for
-
Crystal report .dll files required on server.
Hi. I'm new to Crystal Report and I have a "small" problem. I'm developing an windows app. that should be accesed from a Windows Server 2003 R2 Standard x64 Edition. When I run my app. om the server and want to see a report created with Crystal Repor
-
I have Firefox Sync running on my laptop, my desktop and on my smartphone too. If someone stole my phone... how can I stop Firefox Sync only on that device, from my laptop or desktop? I only know how to disable firefox sync on the device I want to di
-
Hi I have installed wsus 3 sp2 on a win 2008 R2 Sp1 before the installation , I have updated the windows I can open easily browse internet , but when I try to configure synchronization .but it fails. No firewall , no proxy ............. I am behind a
-
Dear All, I am trying to restore my quality server using the <b>nt back up</b> because os is corrupted, I had installed the advance server and after that tried to restore every thing from the ntbackup, all the data is restore however, i guess
-
Service named restart error in the dns
Friends... OS: OEL 6.3 64 bit. i am setting up the dns for my oracle 11gR2 rac. but i am facing this error...i dont know where i am making mistake. errors..... [root@mydns named]# service named restart Stopping named: [ OK ] Starting name