[英]Crash "Field symbol has not yet been assigned" when calling REUSE_ALV_GRID_DISPLAY
在顯示 ALV 時,我在執行程序時收到崩潰報告。 為了創建一個 ALV,我遵循了一些教程和內容,目前它看起來像這樣:
TYPE-POOLS: slis.
*build field catalog
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
repid TYPE sy-repid.
REFRESH it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-reptext_ddic = 'Table ID'.
wa_fieldcat-fieldname = 'table_id'.
wa_fieldcat-tabname = 'lt_where_used_data_of_coll'.
wa_fieldcat-outputlen = '18'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-reptext_ddic = 'Table Description'.
wa_fieldcat-fieldname = 'table_description'.
wa_fieldcat-tabname = 'lt_where_used_data_of_coll'.
wa_fieldcat-outputlen = '40'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-reptext_ddic = 'Numer of Records Found'.
wa_fieldcat-fieldname = 'nr_of_records'.
wa_fieldcat-tabname = 'lt_where_used_data_of_coll'.
wa_fieldcat-outputlen = '30'.
APPEND wa_fieldcat TO it_fieldcat.
*pass data and field catalog to ALV function module
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
it_fieldcat = it_fieldcat
i_structure_name = 'lty_where_used_data_of_coll'
TABLES
t_outtab = lt_where_used_data_of_coll.
'lt_where_used_data_of_coll' 是我的本地表,我已經在我的程序早期填充了一個工作函數。 此功能有效,我已經對其進行了測試,並且表格中會填滿數據。 我的下一步是向最終用戶顯示這些數據。 我在執行這個程序時收到的錯誤報告是:
短文本: Field symbol has not yet been assigned.
發生了什么?:
Error in the ABAP Application Program.
The current ABAP program "SAPLSLVC" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
錯誤分析:
You attempted to access an unassigned field symbol
(data segment "-1").
運行時錯誤的觸發位置:
Program SAPLSLVC
Include LSLVCF36
Row 3,273
Module type (FORM)
Module Name FILL_DATA_TABLE
我真的不知道如何開始發現我的錯誤。 從 ABAP 本身調用函數時,它似乎運行得很糟糕。
任何幫助深表感謝。
編輯:正如我所建議的,我實現了另一種顯示 ALV 的方式,可以在下面找到。 這種方式工作正常並且沒有錯誤。 問題仍然存在,為什么舊方法確實給我一個錯誤。
我用這個替換了上面的整個代碼塊:
DATA alv TYPE REF TO cl_salv_table. DATA message TYPE REF TO cx_salv_msg.
*initialize ALV
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = alv
CHANGING
t_table = lt_where_used_data_of_coll ).
CATCH cx_salv_msg INTO message.
" error handling
ENDTRY.
*display ALV
alv->display( ).
為什么舊方法確實給我一個錯誤
字段目錄名稱區分大小寫。 將每個fieldname
和tabname
值大寫,看看錯誤是否仍然存在。 還要確保名稱與您的內部表lt_where_used_data_of_coll
的名稱匹配
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.