可以通过函数ICON_CREATE将alv中的单元格(Cell)变成ICON.
代码如下:
LOOP AT git_alv ASSIGNING <lfs_alv>.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = icon_pdf "图标名字
info = 'PDF'
IMPORTING
result = <lfs_alv>-pdf_order
EXCEPTIONS
OTHERS = 0.
ENDLOOP
另外不要忘了声明一个TYPE-POOLS:icon.
TYPE-POOLS:icon.
显示结果:
另外也可以在搜索界面添加一个图标按钮
SELECTION-SCREEN BEGIN OF LINE .
SELECTION-SCREEN PUSHBUTTON 1(15) but1 USER-COMMAND bt1.
SELECTION-SCREEN END OF LINE .
INITIALIZATION.
* BUTTON .
CALL FUNCTION 'ICON_CREATE' "给按钮添加图标和文本
EXPORTING
name = icon_select_detail "按钮的图片的名字
text = '查询' "按钮的文本
info = '查询'
IMPORTING
result = but1
EXCEPTIONS
OTHERS = 0.
AT SELECTION-SCREEN.
CASE sscrfields-ucomm .
WHEN 'BT1' .
"PERFORM frm_patch_data.
ENDCASE .
效果
点击这个按钮则会进入 perform frm_patch_data