短转储:字段符号尚未分配
当我运行这个程序时,我得到一个简短的转储(字段符号尚未分配)。 我知道当我没有正确填写 t_fieldcat
时,我可能会收到此错误。 据我所知,我已经正确填写了字段目录。
我无法弄清楚问题出在哪里..请帮忙。
REPORT Y_ALV1.
type-pools slis.
tables: scarr.
data:
t_scarr type table of scarr,
t_fieldcat type slis_t_fieldcat_alv.
data:
wa_fieldcat type slis_fieldcat_alv.
select-options:
s_carrid for scarr-carrid.
start-of-selection.
select * into table t_scarr from scarr where carrid in s_carrid.
if sy-subrc ne 0.
leave list-processing.
endif.
define fill_fieldcatalog.
wa_fieldcat-col_pos = &1.
wa_fieldcat-fieldname = &2.
wa_fieldcat-tabname = &3.
wa_fieldcat-outputlen = &4.
append wa_fieldcat to t_fieldcat.
end-of-definition.
fill_fieldcatalog 1 'carrid' 't_scarr' 10.
fill_fieldcatalog 2 'carrname' 't_scarr' 10.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
IT_FIELDCAT = t_fieldcat
TABLES
T_OUTTAB = t_scarr
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.
I am getting a short dump (Field symbol has not yet been assigned) when I run this program.
I know that I may get this error when I don't fill the t_fieldcat
correctly.
As far as I know I have filled the field catalog correctly.
I cannot figure out where the problem is..Please help.
REPORT Y_ALV1.
type-pools slis.
tables: scarr.
data:
t_scarr type table of scarr,
t_fieldcat type slis_t_fieldcat_alv.
data:
wa_fieldcat type slis_fieldcat_alv.
select-options:
s_carrid for scarr-carrid.
start-of-selection.
select * into table t_scarr from scarr where carrid in s_carrid.
if sy-subrc ne 0.
leave list-processing.
endif.
define fill_fieldcatalog.
wa_fieldcat-col_pos = &1.
wa_fieldcat-fieldname = &2.
wa_fieldcat-tabname = &3.
wa_fieldcat-outputlen = &4.
append wa_fieldcat to t_fieldcat.
end-of-definition.
fill_fieldcatalog 1 'carrid' 't_scarr' 10.
fill_fieldcatalog 2 'carrname' 't_scarr' 10.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
IT_FIELDCAT = t_fieldcat
TABLES
T_OUTTAB = t_scarr
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,这个案例在这里确实很重要。将以下行更改为
:
Unfortunately the case does matter here. Change the following lines:
to
其他选项是在宏中将其转换为大写。这样你在调用它时就永远不会出错。
Other option would be to do the translation to upper case in your macro. That way you can never make a mistake when calling it.