我对ABAP相当陌生,并编写了一条SQL语句将项目列表返回到ALV中。然而,当我执行程序时,它什么也不返回。下面是我写的代码。我创建了一个表类型,只显示结果中需要的列。
REPORT Z_DISPLAY_RESULTS.
TYPES: BEGIN OF t_Display,
foodItem TYPE foodList-foodItem,
foodDescription TYPE foodList-foodDescription,
END OF t_Display.
DATA: it_Display TYPE STANDARD TABLE OF t_Display INITIAL SIZE 0,
wa_Display TYPE t_Display,
wa_Display1 LIKE LINE OF it_Display.
START-OF-SELECTION.
SELECT foodItem foodDescription
FROM foodList INTO TABLE it_Display
WHERE foodID = '00001'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'foodList'
* IS_LAYOUT =
* IT_FIELDCAT =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IR_SALV_LIST_ADAPTER =
* IT_EXCEPT_QINFO =
* I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = it_Display
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
ENDIF.
- 不要学习过时的东西-使用新的基于类的API
- 仔细检查是否使用调试器实际填充了表
- CCD_ 1是指全局DDIC类型。如果您使用的是本地类型,那么您可能需要自己提供字段目录——使用这个过时的功能模块。有了新的基于类的API,就不需要了