2009 Jul 29 11:29 AM
Dear Friends,
I am have executed a simple interactive event, for that i got dump, it is saying that , You attempted to access an unassigned field symbol. and this is my code.
REPORT ZALV_FIELDCATALOG_PRACT no standard page heading
line-size 650
line-count 100.
type-pools : slis.
list header
data : wa_listheader type slis_listheader,
it_listheader type slis_t_listheader,
events
wa_events type slis_alv_event,
it_events type slis_t_event.
data : repid type sy-repid.
types : begin of ty_ekko,
ebeln type ebeln,
bukrs type bukrs,
bstyp type bstyp, " purchasing doc category
end of ty_ekko.
data : wa_ekko type ty_ekko,
it_ekko like table of wa_ekko with header line.
types : begin of ty_ekpo,
ebeln type ebeln,
ebelp type ebelp,
matnr type matnr,
end of ty_ekpo.
data : wa_ekpo type ty_ekpo,
it_ekpo like table of wa_ekpo with header line.
start of selection
start-of-selection.
select ebeln bukrs bstyp from ekko into corresponding fields of table
it_ekko.
SELECT EBELN EBELP MATNR FROM EKPO INTO TABLE IT_EKPO FOR ALL ENTRIES IN
IT_EKKO WHERE EBELN = IT_EKKO-EBELN.
events table
clear wa_events.
clear it_events.
wa_events-name = 'TOP_OF_PAGE'.
wa_events-form = 'TOP_OF_PAGE'.
append wa_events to it_events.
clear wa_events.
perform TOP_OF_PAGE
wa_events-name = 'USER_COMMAND'.
wa_events-form = 'USER_COMMAND'.
append wa_events to it_events.
clear wa_events.
*perform USER_COMMAND.
wa_events-name = 'PF_STATUS_SET'.
wa_events-form = 'SET_PF_STATUS'.
append wa_events to it_events.
clear wa_events.
*perform SET_PF_STATUS.
end of selection.
end-of-selection.
perform display_ekko.
&----
*& Form TOP_OF_PAGE
&----
text
----
--> p1 text
<-- p2 text
----
FORM TOP_OF_PAGE .
clear wa_listheader.
clear it_listheader.
wa_listheader-typ = 'H'.
wa_listheader-info = 'Interactive report'.
append wa_listheader to it_listheader.
clear wa_listheader.
uploading logo
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = it_listheader
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
.
ENDFORM. " TOP_OF_PAGE
&----
*& Form USER_COMMAND
&----
text
----
--> p1 text
<-- p2 text
----
FORM USER_COMMAND using vcom type sy-ucomm
sel_details type slis_selfield .
case vcom.
when'&IC1'.
read table it_ekko into wa_ekko index sel_details-tabindex.
select ebeln ebelp matnr from ekpo into table it_ekpo where ebeln =
it_ekko-ebeln.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
I_STRUCTURE_NAME = 'ekpo'
IT_EVENTS = it_events
TABLES
T_OUTTAB = it_ekpo.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endcase.
ENDFORM. " USER_COMMAND
&----
*& Form SET_PF_STATUS
&----
text
----
--> p1 text
<-- p2 text
----
FORM SET_PF_STATUS using it_fcodes type slis_t_extab .
DATA : wa_fcodes type slis_extab.
set pf-status 'ZSTATUS' excluding it_fcodes.
ENDFORM. " SET_PF_STATUS
&----
*& Form display_ekko
&----
text
----
--> p1 text
<-- p2 text
----
FORM display_ekko .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_STRUCTURE_NAME = 'ekko'
IT_EVENTS = it_events
TABLES
T_OUTTAB = it_ekko.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " display_ekko
2009 Jul 29 11:50 AM
Hi,
You have passed the I_STRUCTURE_NAME = 'EKKO' into the FM. You can use this field only when your output internal table is of the same structure as the dictionary structure. You seem to selecting and displaying just three fields from the table EKPO, so you cant possibly pass the EKPO(besides you have been passing the wrong table) structure into this field. What you can do is create a field catalog and then pass the field catalog
DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-tabname = 'IT_EKPO'.
APPEND wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'EBELP'.
wa_fieldcat-tabname = 'IT_EKPO'.
APPEND wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'IT_EKPO'.
APPEND wa_fieldcat to it_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
*I_STRUCTURE_NAME = 'EKKO'
IT_EVENTS = it_events
it_fieldcat = it_fieldcat
TABLES
T_OUTTAB = it_ekko.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Try this. This one works.
Or what you can possibly do is create another Zstrcture with the 3 fields EBELN, EBELP, MATNR in SE11 and pass the name to I_STRUCTURE_NAME instead of creating the field catalog.
I_STRUCTURE_NAME = ZSTRUC
Dear Friends,
I am have executed a simple interactive event, for that i got dump, it is saying that , You attempted to access an unassigned field symbol. and this is my code.
REPORT ZALV_FIELDCATALOG_PRACT no standard page heading
line-size 650
line-count 100.
type-pools : slis.
list header
data : wa_listheader type slis_listheader,
it_listheader type slis_t_listheader,
events
wa_events type slis_alv_event,
it_events type slis_t_event.
data : repid type sy-repid.
types : begin of ty_ekko,
ebeln type ebeln,
bukrs type bukrs,
bstyp type bstyp, " purchasing doc category
end of ty_ekko.
data : wa_ekko type ty_ekko,
it_ekko like table of wa_ekko with header line.
types : begin of ty_ekpo,
ebeln type ebeln,
ebelp type ebelp,
matnr type matnr,
end of ty_ekpo.
data : wa_ekpo type ty_ekpo,
it_ekpo like table of wa_ekpo with header line.
start of selection
start-of-selection.
select ebeln bukrs bstyp from ekko into corresponding fields of table
it_ekko.
SELECT EBELN EBELP MATNR FROM EKPO INTO TABLE IT_EKPO FOR ALL ENTRIES IN
IT_EKKO WHERE EBELN = IT_EKKO-EBELN.
events table
clear wa_events.
clear it_events.
wa_events-name = 'TOP_OF_PAGE'.
wa_events-form = 'TOP_OF_PAGE'.
append wa_events to it_events.
clear wa_events.
perform TOP_OF_PAGE
wa_events-name = 'USER_COMMAND'.
wa_events-form = 'USER_COMMAND'.
append wa_events to it_events.
clear wa_events.
*perform USER_COMMAND.
wa_events-name = 'PF_STATUS_SET'.
wa_events-form = 'SET_PF_STATUS'.
append wa_events to it_events.
clear wa_events.
*perform SET_PF_STATUS.
end of selection.
end-of-selection.
perform display_ekko.
&----
*& Form TOP_OF_PAGE
&----
text
----
--> p1 text
<-- p2 text
----
FORM TOP_OF_PAGE .
clear wa_listheader.
clear it_listheader.
wa_listheader-typ = 'H'.
wa_listheader-info = 'Interactive report'.
append wa_listheader to it_listheader.
clear wa_listheader.
uploading logo
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = it_listheader
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
.
ENDFORM. " TOP_OF_PAGE
&----
*& Form USER_COMMAND
&----
text
----
--> p1 text
<-- p2 text
----
FORM USER_COMMAND using vcom type sy-ucomm
sel_details type slis_selfield .
case vcom.
when'&IC1'.
read table it_ekko into wa_ekko index sel_details-tabindex.
select ebeln ebelp matnr from ekpo into table it_ekpo where ebeln =
it_ekko-ebeln.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
I_STRUCTURE_NAME = 'ekpo'
IT_EVENTS = it_events
TABLES
T_OUTTAB = it_ekpo.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endcase.
ENDFORM. " USER_COMMAND
&----
*& Form SET_PF_STATUS
&----
text
----
--> p1 text
<-- p2 text
----
FORM SET_PF_STATUS using it_fcodes type slis_t_extab .
DATA : wa_fcodes type slis_extab.
set pf-status 'ZSTATUS' excluding it_fcodes.
ENDFORM. " SET_PF_STATUS
&----
*& Form display_ekko
&----
text
----
--> p1 text
<-- p2 text
----
FORM display_ekko .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_STRUCTURE_NAME = 'ekko'
IT_EVENTS = it_events
TABLES
T_OUTTAB = it_ekko.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " display_ekko
2009 Jul 29 11:32 AM
Hi,
This dump appears due to a problem in your fieldcatalog.
Just check the same.
Check if you have given the fieldname correctly in your fieldcatalog as the field names in your internal table and in CAPITAL LETTERS.
There might be some type error.
Regards,
Ankur Parab
2009 Jul 29 11:37 AM
Hi,
please paste code properly ..its difficult to read it as an essay ...:)
Please check your field catalog i cant see it here ..
it is possible you have done some typing error in the fieldnames sholuld be in CAPITAL letters
thanks
2009 Jul 29 11:42 AM
Sorry to say, I have not used field catalog, I just passed my internal table to reuse_alv_grid_display.
2009 Jul 29 11:49 AM
Hi,
Give the name EKKO in capital letters as follows:-
Also do not give sy-repid directly.
lv_repid = sy-repid.
'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = lv_repid
I_STRUCTURE_NAME = 'EKKO'
IT_EVENTS = it_events
TABLES
T_OUTTAB = it_ekko.
Regards,
Ankur Parab
2009 Jul 29 11:46 AM
Hi ,
Give ur code properly...
it seems a field name mismatch issue..
Try Giving the ekpo in captial letters
I_STRUCTURE_NAME = 'ekpo'
Edited by: Lakshmiraj on Jul 29, 2009 12:52 PM
2009 Jul 29 11:50 AM
Hi,
You have passed the I_STRUCTURE_NAME = 'EKKO' into the FM. You can use this field only when your output internal table is of the same structure as the dictionary structure. You seem to selecting and displaying just three fields from the table EKPO, so you cant possibly pass the EKPO(besides you have been passing the wrong table) structure into this field. What you can do is create a field catalog and then pass the field catalog
DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-tabname = 'IT_EKPO'.
APPEND wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'EBELP'.
wa_fieldcat-tabname = 'IT_EKPO'.
APPEND wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'IT_EKPO'.
APPEND wa_fieldcat to it_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
*I_STRUCTURE_NAME = 'EKKO'
IT_EVENTS = it_events
it_fieldcat = it_fieldcat
TABLES
T_OUTTAB = it_ekko.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Try this. This one works.
Or what you can possibly do is create another Zstrcture with the 3 fields EBELN, EBELP, MATNR in SE11 and pass the name to I_STRUCTURE_NAME instead of creating the field catalog.
I_STRUCTURE_NAME = ZSTRUC
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |