SAP ALV OO 选择行打印
&---------------------------------------------------------------------*
*& Report ZSDF001
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZSDF001.
INCLUDE ZSDF001_INC_001.
TABLES:VTTP,LIPS,LIKP,KNA1.
TYPES:BEGIN OF TY_HEADER,
NAME1 LIKE KNA1-NAME1,"客户名称
ORT01 LIKE KNA1-ORT01,"城市
REGIO LIKE KNA1-REGIO,"地区
STRAS LIKE KNA1-STRAS,"街道
TELF1 LIKE KUWEV-TELF1,"电话
VBELN LIKE LIKP-VBELN,"交货单号
VGBEL LIKE LIPS-VGBEL,"订单号
BLDAT LIKE LIKP-BLDAT,"日期
LNUMT LIKE T300T-LNUMT,"仓库
END OF TY_HEADER.
*单据抬头结束
*单据明细开始
TYPES:BEGIN OF TY_ITEMS,
GV_NAME LIKE KNA1-NAME1,"客户名称
GV_KUNAG LIKE LIKP-KUNAG,"客户编号(售达方)
GV_MATNR LIKE LIPS-MATNR,"物料编码
GV_ARKTX LIKE LIPS-ARKTX,"物料描述
GV_LFIMG LIKE LIPS-LFIMG,"交货数量
END OF TY_ITEMS.
*单据明细结束
DATA:fm_name TYPE rs38l_fnam.
DATA:itemsname(32) TYPE c.
DATA:headername(32) TYPE c.
DATA:GT_ITEMS TYPE TY_ITEMS OCCURS 0.
DATA:WA_ITEMS TYPE TY_ITEMS.
DATA:lt_prt_temp TYPE TY_ITEMS OCCURS 0.
*DATA:gs_tab type TY_ITEMS,
* gt_tab type TABLE OF GT_ITEMS.
DATA: alv TYPE REF TO cl_salv_table.
DATA columns TYPE REF TO cl_salv_columns_table.
DATA column TYPE REF TO cl_salv_column_table.
data lr_selections TYPE REF TO cl_salv_selections.
START-OF-SELECTION.
SELECT-OPTIONS: P_TKNUM FOR VTTP-TKNUM OBLIGATORY.
PERFORM FRM_GET_DATA.
PERFORM INITIALIZE_ALV.
alv->display( ).
*PERFORM Z_ALV_PRINT.
*PERFORM FRM_PRINT_DATA.
END-OF-SELECTION.
FORM FRM_GET_DATA.
SELECT k~NAME1 L1~KUNAG L2~MATNR L2~ARKTX L2~LFIMG
FROM VTTP AS V
INNER JOIN LIKP AS L1
ON V~VBELN = L1~VBELN
INNER JOIN KNA1 AS K
ON L1~KUNAG = K~KUNNR
INNER JOIN LIPS AS L2
ON L2~VBELN = L1~VBELN
INTO (WA_ITEMS-GV_NAME,WA_ITEMS-GV_KUNAG,WA_ITEMS-GV_MATNR,WA_ITEMS-GV_ARKTX,
WA_ITEMS-GV_LFIMG)
WHERE V~TKNUM IN P_TKNUM .
APPEND WA_ITEMS TO GT_ITEMS.
SORT GT_ITEMS BY GV_KUNAG.
CLEAR WA_ITEMS.
ENDSELECT.
ENDFORM.
CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: on_user_command FOR EVENT added_function OF cl_salv_events_table
IMPORTING e_salv_function,
on_before_salv_function FOR EVENT before_salv_function OF cl_salv_events_table
IMPORTING e_salv_function,
on_after_salv_function FOR EVENT after_salv_function OF cl_salv_events_table
IMPORTING e_salv_function.
PRIVATE SECTION.
CLASS-DATA: g_string TYPE string.
ENDCLASS. "lcl_handle_events DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_handle_events IMPLEMENTATION
*----------------------------------------------------------------------*
* 事件操作类(实现)
*----------------------------------------------------------------------*
CLASS lcl_handle_events IMPLEMENTATION.
*单击新增功能按钮事件处理方法
METHOD on_user_command.
DATA:lines TYPE i .
DATA:MODCOUNT TYPE i VALUE 3."一页显示几行
DATA:COUNT TYPE i.
CASE e_salv_function.
WHEN '&PRINT'.
PERFORM SEL_CHECK.
DESCRIBE TABLE lt_prt_temp LINES lines.
COUNT = lines mod MODCOUNT .
COUNT = MODCOUNT - COUNT.
DO COUNT TIMES.
APPEND WA_ITEMS TO lt_prt_temp.
ENDDO.
PERFORM FRM_PRINT_DATA.
CLEAR lt_prt_temp.
WHEN '&BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD. "on_user_command
*触发事件之前
METHOD on_before_salv_function.
CONCATENATE 'Before Function '
e_salv_function
INTO g_string SEPARATED BY space.
MESSAGE i000(0k) WITH g_string.
ENDMETHOD. "on_before_salv_function
*触发事件之后
METHOD on_after_salv_function.
CONCATENATE 'After Function '
e_salv_function
INTO g_string SEPARATED BY space.
MESSAGE i000(0k) WITH g_string.
ENDMETHOD. "on_after_salv_function
ENDCLASS. "lcl_handle_events IMPLEMENTATION
FORM INITIALIZE_ALV .
DATA message TYPE REF TO cx_salv_msg.
data lr_events TYPE REF TO cl_salv_events_table.
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = alv
CHANGING
t_table = GT_ITEMS ).
"设置GUI Status
alv->set_screen_status(
report = sy-repid
pfstatus = 'STANDARD'
set_functions = alv->c_functions_all
).
"注册事件
lr_events = alv->get_event( ).
SET HANDLER lcl_handle_events=>on_user_command FOR lr_events.
SET HANDLER lcl_handle_events=>on_before_salv_function FOR lr_events.
SET HANDLER lcl_handle_events=>on_after_salv_function FOR lr_events.
* alv->set_screen_status( pfstatus = 'ALV_STANDARD'
* report = lv_repid
* set_functions = alv->c_functions_all ).
*
* PERFORM enalbe_layout_settings. "设置样式
* PERFORM optimize_column_width."设置行宽度
* PERFORM hide_client_column.
* PERFORM set_departure_country_column. "设置列的一些属性
PERFORM set_toolbar. "设置工具栏
PERFORM display_settings. "设置显示
* PERFORM set_aggregations. "设置合计
PERFORM set_select_mode. "设置选择模式
CATCH cx_salv_msg INTO message.
ENDTRY.
ENDFORM. " INITIALIZE_ALV
FORM SET_TOOLBAR .
DATA functions TYPE REF TO cl_salv_functions_list.
functions = alv->get_functions( ).
functions->set_all('X').
ENDFORM.
FORM DISPLAY_SETTINGS .
data lr_display type ref to cl_salv_display_settings.
lr_display
= alv->get_display_settings( ).
lr_display
->set_list_header('领料单列表').
ENDFORM. " DISPLAY_SETTINGS
FORM SET_SELECT_MODE .
lr_selections
= alv->get_selections( ).
"设置选择模式
lr_selections
->set_selection_mode( if_salv_c_selection_mode=>row_column ).
ENDFORM. " SET_SELECT_MODE
FORM SEL_CHECK .
Data: gi_select_rows type salv_t_row.
data lw_row LIKE LINE OF gi_select_rows.
data l_lines type i.
data:wa_prt_temp type TY_ITEMS.
* lt_prt_temp type table of TY_ITEMS.
lr_selections
= alv->get_selections( ).
gi_select_rows
= lr_selections->get_selected_rows( ).
* call method alv->get_selected_rows
* importing
* et_index_rows = gi_index_rows.
DESCRIBE TABLE gi_select_rows lines l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1
= 'You must choose a valid line'.
EXIT.
ENDIF.
LOOP AT gi_select_rows into lw_row.
READ TABLE GT_ITEMS INDEX lw_row INTO wa_prt_temp.
append wa_prt_temp to lt_prt_temp.
ENDLOOP.
clear wa_prt_temp.
ENDFORM. " SEL_CHECK
FORM FRM_PRINT_DATA.
call function 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname
= 'ZSDSF001'
IMPORTING
fm_name
= fm_name
EXCEPTIONS
no_form
= 1
no_function_module
= 2
OTHERS = 3.
CONCATENATE 'ZDDITEMMM' SY-UZEIT INTO itemsname.
*CONCATENATE 'ZDDHEADER' SY-UZEIT INTO headername.
savebuffer lt_prt_temp itemsname
.
* savebuffer GT_HEADER headername.
*调用 smartForms
call function fm_name
EXPORTING
PTR_ITEMS
= itemsname
* PTR_HEADER = headername
EXCEPTIONS
formatting_error
= 1
internal_error
= 2
send_error
= 3
user_canceled
= 4.
clearbuffer itemsname
.
clearbuffer headername
.
ENDFORM.
SAP ALV OO 选择行打印的更多相关文章
- 【ABAP系列】SAP ALV 导出报表数据 始终使用选定的格式”,一旦勾上,就再也不会弹出选择框了。
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ALV 导出报表数据 始 ...
- SAP ALV内嵌(In-place)Excel的问与答
1.问题:点击ALV工具栏的"Excel"图标后,出现空白的内嵌Excel界面,无法正常显示报表数据.可按以下思路解决:(1)检查Excel中的宏安全设置选项.访问方法:启动Exc ...
- DataGridView中添加CheckBox列用于选择行
DataGridView中添加CheckBox列用于选择行 1,编辑DataGridView,添加一列 CheckBox ,Name 赋值为 "select",如下图: 2,取消 ...
- [King.yue]Ext中Grid得到选择行数据的方法总结
(1)grid.getStore().getRange(0,store.getCount()); //得到grid所有的行 (2)grid.getSelectionModel().getSele ...
- jquery easyui datagrid 获取Checked选择行(勾选行)数据
原文:jquery easyui datagrid 获取Checked选择行(勾选行)数据 getSelected:取得第一个选中行数据,如果没有选中行,则返回 null,否则返回记录. getSel ...
- ExtJS如何取得GridPanel当前选择行数据对象 - nuccch的专栏 - 博客频道 - CSDN.NET
body { font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI ...
- Ubuntu使用命令行打印文件
Ubuntu使用命令行打印文件 正文 环境: Ubuntu 16.04.3 LTS HP Deskjet InkAdvantage 4648 准备步骤 安装Common UNIX Printing S ...
- python – 基于pandas中的列中的值从DataFrame中选择行
如何从基于pandas中某些列的值的DataFrame中选择行?在SQL中我将使用: select * from table where colume_name = some_value. 我试图看看 ...
- Dev GridControl 选择行及绑定/获取List对象
GridControl绑定List对象一般是为了获取焦点行时直接获得该行代表的List对象,或者为了实现嵌套表格,对第一中情况,起始不用绑定List,绑定DataTable也可以实现获取对应List对 ...
随机推荐
- Mysql中mysqldump命令使用详解
MySQL有很多可以导入数据的方法,然而这些只是数据传输中的一半,另外的一般是从MySQL数据库中导出数据.有许多的原因我们需要导出数据.一个重要的原因是用于备份数据库.数据的造价常常是昂贵的,需要谨 ...
- JQ分页功能
HTML <div id='page'></div> <div id='con'></div> CSS span{width: 60px;height: ...
- 使用pygal 做chart图的经验分享
看到小芮介绍了pygal文章后, http://rfyiamcool.blog.51cto.com/1030776/1378400, 我一直搞数据工作, 所以对于这种数据的展现很有兴趣. 做了点研究, ...
- SQL 分组后获取其中一个字段最大值的整条记录
--有id,name,createDate的一张表testTable--根据name分组,获取每组中createDate最大的那条记录(整条)查询出来------------------------- ...
- codevs2574 波兰表达式
题目描述 Description 对于 加.减.乘.除这种四则运算的表达式,我们使用的是先乘除.后加减的从左到右的顺序进行运算,如果要指定特定的顺序,就要增加括号进行表达,比如 (A+B)*C , A ...
- HDOJ 2929 Bigger is Better
DP....好难的DP... Bigger is Better Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 ...
- VC++6.0一些常见问题解决方法(打开多个窗口、行号、添加文件无响应、更改.exe图标及名称等等)
背景: 最近使用VC++6.0做一个界面,供测试CAN通信使用.由于客户希望我们提供简单方便的函数接口让其最快速使用CAN,DLL(动态链接库)是不二之选.做DLL需要两个VC窗口进行测试才方便.可是 ...
- LUXURY15
A - Guess Your Way Out! Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & ...
- JavaScript与DOM
文档对象模型Document Object Model DOM(Document Object Model,文档对象模型)是一个通过和JavaScript进行内容交互的API.Javascript和D ...
- LESS介绍及其与Sass的差异
自从一个月前我偶然发现LESS之后我就开始坚定的使用它了.CSS本身对我来说从来不是问题,但是我很好奇使用变量来沿着一个调色盘为我的网站或模板创建一些东西的想法.拥有一个提供固定数量选项可选的色盘可以 ...