2008 Mar 17 6:35 AM
I am in the middle of writing a program, and whenever I run it, I get the error: Runtime Errors GETWA_NOT_ASSIGNED. I have written some code, and cut and paste from some other code. I belive that the error is occuring in the subrouitine GRID_DISPLAY.
Any help would be appreciated.
Regards,
Al Lal
Code:
REPORT YABHINAV15.
program to display products at chosen level *
Tables: T179, T179t.
types: begin of hierarchy,
prodh type t179-prodh,
vtext type t179t-vtext,
stufe type t179-stufe,
end of hierarchy.
data: pvs type standard table of hierarchy initial size 0.
data: pvs2 type hierarchy.
TYPE-POOLS:SLIS.
*For ALV
DATA: GT_FLD TYPE SLIS_T_FIELDCAT_ALV,
GT_EV TYPE SLIS_T_EVENT,
GT_HDR TYPE SLIS_T_LISTHEADER,
GT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: WA_FLD TYPE SLIS_FIELDCAT_ALV,
WA_EV TYPE SLIS_ALV_EVENT,
WA_HDR TYPE SLIS_LISTHEADER,
WA_SORT TYPE SLIS_SORTINFO_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
DEFINE FLD.
WA_FLD-FIELDNAME = &1.
WA_FLD-TABNAME = &2.
WA_FLD-OUTPUTLEN = &3.
WA_FLD-SELTEXT_L = &4.
WA_FLD-SELTEXT_M = &5.
WA_FLD-SELTEXT_S = &6.
WA_FLD-COL_POS = &7.
WA_FLD-FIX_COLUMN = &8.
WA_FLD-DO_SUM = &9.
APPEND WA_FLD TO GT_FLD.
CLEAR WA_FLD.
END-OF-DEFINITION.
CONSTANTS: C_TOP TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
C_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
DATA: MTRL LIKE SY-REPID,
TITLE LIKE SY-TITLE.
select-options level for t179-stufe no intervals.
Select prodh stufe from T179 into corresponding fields of table pvs where stufe in level.
Select vtext from t179t into corresponding fields of table pvs where prodh = t179-prodh.
sort pvs by prodh.
loop at pvs into pvs2.
write: / pvs2-prodh, pvs2-vtext, pvs2-stufe.
endloop.
perform BUILD_FIELDCAT.
perform BUILD_EVENT.
perform BUILD_LISTHEADER.
perform GRID_DISPLAY.
form BUILD_FIELDCAT .
FLD 'prodh' 'pvs' '20' 'Product Hierarchy' ' ' ' ' '1' '' '' .
FLD 'vtext' 'pvs' '40' 'Description ' ' ' ' ' '2' '' '' .
FLD 'stufe' 'pvs' '5' 'Level' ' ' ' ' '3' '' '' .
endform. " BUILD_FIELDCAT
form BUILD_EVENT .
call function 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = GT_EV
EXCEPTIONS
LIST_TYPE_WRONG = 1
others = 2.
if SY-SUBRC <> 0.
message id SY-MSGID type SY-MSGTY number SY-MSGNO
with SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
read table GT_EV with key NAME = SLIS_EV_TOP_OF_PAGE into WA_EV.
if SY-SUBRC = 0.
move C_TOP to WA_EV-FORM.
modify GT_EV from WA_EV index SY-TABIX transporting FORM.
endif.
READ TABLE GT_EV WITH KEY NAME = SLIS_EV_USER_COMMAND
INTO WA_EV.
IF SY-SUBRC = 0.
WA_EV-form = C_USER_COMMAND.
MODIFY GT_EV FROM WA_EV INDEX SY-TABIX TRANSPORTING FORM.
ENDIF.
endif.
endform. " BUILD_EVENT
&----
*& Form BUILD_LISTHEADER
&----
text
----
--> p1 text
<-- p2 text
----
form BUILD_LISTHEADER .
data: L_HIGH type CHAR10,
L_LOW type CHAR10.
WA_HDR-TYP = 'H'.
write: TITLE to WA_HDR-INFO.
append WA_HDR to GT_HDR.
clear WA_HDR.
append WA_HDR to GT_HDR.
clear WA_HDR.
WA_HDR-TYP = 'S'.
WA_HDR-KEY = 'Date :'.
concatenate BUDAT-LOW+6(2)
BUDAT-LOW+4(2)
BUDAT-LOW+0(4)
into L_LOW
separated by '.'.
if not BUDAT-HIGH is initial.
*
concatenate BUDAT-HIGH+6(2)
BUDAT-HIGH+4(2)
BUDAT-HIGH+0(4)
into L_HIGH
separated by '.'.
*
concatenate L_LOW '-' L_HIGH into WA_HDR-INFO
separated by SPACE.
else.
WA_HDR-INFO = L_LOW.
endif.
*
append WA_HDR to GT_HDR.
clear WA_HDR.
endform. " BUILD_LISTHEADER
&----
*& Form GRID_DISPLAY
&----
text
----
--> p1 text
<-- p2 text
----
form GRID_DISPLAY .
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = MTRL
I_CALLBACK_USER_COMMAND = 'C_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = C_TOP
I_STRUCTURE_NAME = 'PVS'
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = GT_FLD
IT_SORT = GT_SORT
I_DEFAULT = 'X'
I_SAVE = 'U'
IT_EVENTS = GT_EV
TABLES
T_OUTTAB = PVS[]
EXCEPTIONS
PROGRAM_ERROR = 1
others = 2.
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. " GRID_DISPLAY
2008 Mar 17 6:37 AM
2008 Mar 17 6:37 AM
2008 Mar 17 6:39 AM
form BUILD_FIELDCAT .
FLD 'PRODH' 'pvs' '20' 'Product Hierarchy' ' ' ' ' '1' '' '' .
FLD 'VTEXT 'pvs' '40' 'Description ' ' ' ' ' '2' '' '' .
FLD 'STUFE' 'pvs' '5' 'Level' ' ' ' ' '3' '' '' .
endform. " BUILD_FIELDCAT
give names in capital letters as mentioned above
2008 Mar 17 6:41 AM
Hi,
When writing the ALV Report make sure that you write the whole report in the UpperCase......Also write Every function of ALV in UpperCase.
HTH
Regards,
Dhruv Shah
2008 Mar 17 6:42 AM
all field names should be in Caps.
form BUILD_FIELDCAT .
FLD 'PRODH' 'pvs' '20' 'Product Hierarchy' ' ' ' ' '1' '' '' .
FLD 'VTEXT' 'pvs' '40' 'Description ' ' ' ' ' '2' '' '' .
FLD 'STUFE' 'pvs' '5' 'Level' ' ' ' ' '3' '' '' .
endform. " BUILD_FIELDCAT