简体   繁体   English

简短的转储:尚未分配字段符号

[英]short Dump: Field symbol has not yet been assigned

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. 我知道当我没有正确填写t_fieldcat时,我可能会收到此错误。 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.

Unfortunately the case does matter here. 不幸的是,这里的情况确实很重要。 Change the following lines: 更改以下行:

fill_fieldcatalog 1 'carrid' 't_scarr' 10.
fill_fieldcatalog 2 'carrname' 't_scarr' 10.

to

fill_fieldcatalog 1 'CARRID' 't_scarr' 10.
fill_fieldcatalog 2 'CARRNAME' 't_scarr' 10.

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. 这样,您永远不会在调用时犯错。

wa_fieldcat-fieldname = &2.
TRANSLATE wa_fieldcat-fieldname TO UPPER CASE.
wa_fieldcat-tabname = &3.
TRANSLATE wa_fieldcat-tabname TO UPPER CASE.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM