Application Development 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: 

alv runtime error

Former Member
0 Kudos

Hallow I do a simple alv report that I take from se 83 example

And I have RUNTIME ERROR what it can be

What I doing wrong mybe I forget somtihg .

<b>This is the

Error analysis</b>

You attempted to access an unassigned field symbol

(data segment 32820).

This error may occur if

- You address a typed field symbol before it has been set with

ASSIGN

- You address a field symbol that pointed to the line of an

internal table that was deleted

- You address a field symbol that was previously reset using

UNASSIGN or that pointed to a local field that no

longer exists

- You address a global function interface, although the

respective function module is not active - that is, is

not in the list of active calls. The list of active calls

can be taken from this short dump.

<b>This is Source Code Extract</b>

macro_cell_data_get

<ls_fcat>

<ls_data>

<l_field_value>

ls_lvc_data-value.

new API

if ir_salv_adapter is bound.

clear ls_lvc_data-style.

or

if g_gui_type ne 1.

if <ls_fcat>-key eq abap_true.

ls_lvc_data-style = alv_style_color_int_key.

elseif l_style_color is initial

and ( <ls_fcat>-emphasize is initial or

<ls_fcat>-emphasize = '$' ).

if <ls_stin>-counter is initial.

ls_lvc_data-style = alv_style_color_normal.

else.

. <b>this is my definition in the program</b>

&----


*& Module PBO OUTPUT

&----


  • text

----


MODULE pbo OUTPUT.

SET PF-STATUS 'MAIN100'.

IF g_custom_container IS INITIAL.

CREATE OBJECT g_custom_container

EXPORTING container_name = g_container.

CREATE OBJECT grid1

EXPORTING i_parent = g_custom_container.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

i_structure_name = 'YHR_EX_TEKEN_STR'

CHANGING

it_outtab = teken_itab.

ENDIF.

ENDMODULE. " PBO OUTPUT

&----


*& Module PAI INPUT

&----


  • text

----


MODULE pai INPUT.

  • to react on oi_custom_events:

  • call method cl_gui_cfw=>dispatch.

CASE ok_code.

WHEN 'EXIT'.

PERFORM exit_program.

WHEN OTHERS.

  • do nothing

ENDCASE.

CLEAR ok_code.

ENDMODULE. " PAI INPUT

----


  • FORM EXIT_PROGRAM *

----


FORM exit_program.

  • CALL METHOD G_CUSTOM_CONTAINER->FREE.

  • CALL METHOD CL_GUI_CFW=>FLUSH.

LEAVE PROGRAM.

ENDFORM. "EXIT_PROGRAM

Thankes for your time and answers

8 REPLIES 8

Former Member
0 Kudos

Hello,

U need to assign the field symbol to any structure before u process the field symbol.

Like this

<b>1. ASSIGN f TO <fs>.

2. ASSIGN COMPONENT idx/name OF STRUCTURE struc TO <fs>.

3. ASSIGN LOCAL COPY OF ... f TO<fs>.

4. Dynamic ASSIGN

a. ASSIGN (f) TO <fs>.

b. ASSIGN TABLE FIELD (f) TO <fs>.

c. ASSIGN LOCAL COPY OF MAIN TABLE FIELD (f) TO <fs>.

d. ASSIGN LOCAL COPY OF ... (f) TO <fs>.

5. ASSIGN dref->* TO <fs>.</b>

If useful reward.

Vasanth

0 Kudos

hi Vasanth M i dont understand u well . i use the same code for other alv report and i dont have a any runtime . mybe u can explain the soltion u bring a little better regards

0 Kudos

Hello Antonio,

if g_gui_type ne 1.

if <ls_fcat>-key eq abap_true.

ls_lvc_data-style = alv_style_color_int_key.

elseif l_style_color is initial

and ( <ls_fcat>-emphasize is initial or

<ls_fcat>-emphasize = '$' ).

if <ls_stin>-counter is initial.

ls_lvc_data-style = alv_style_color_normal.

In the above piece of code first u need to assign the field symbol

assign str to <ls_fcat>.

If u do this u won't get the short dump.

If useful reward.

Vasanth

0 Kudos

hi Vasanth M i have to copy that to my program as is ?.i ask that becouse i never use a field symbol . and if i have to change your code which things i have to change regards

0 Kudos

hi vasanth what i have to put in ls_fcat regards

Former Member
0 Kudos

Hi,

To declare a field symbol, use the statement

FIELD-SYMBOLS <FS> [<type>|STRUCTURE <s> DEFAULT <wa>].

For field symbols, the angle brackets are part of the syntax. They identify field symbols in the program code.

If you do not specify any additions, the field symbol <FS> can have data objects of any type assigned to it. When you assign a data object, the field symbol inherits its technical attributes. The data type of the assigned data object becomes the actual data type of the field symbol.

Check the sample code:

TYPES: BEGIN OF line,

col1 TYPE c,

col2 TYPE c,

END OF line.

DATA: wa TYPE line,

itab TYPE HASHED TABLE OF line WITH UNIQUE KEY col1,

key(4) TYPE c VALUE 'COL1'.

FIELD-SYMBOLS <fs> TYPE ANY TABLE.

ASSIGN itab TO <fs>.

READ TABLE <fs> WITH TABLE KEY (key) = 'X' INTO wa.

Hope this helps.

keerthi

0 Kudos

hi keerthi kiran varanasi why i have to do that i dont use field symbol in my program regards

alison_lloyd
Active Participant
0 Kudos

field symbol errors in ALV are usually down to fieldcat columns incorrectly defined. Check your internal table fields of the table you pass to the alv FM against the columns defined in the fieldcat