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对 ...
随机推荐
- a标签的target指向iframe
<html> <head> <meta charset="utf-8" /> </head> <body> <ta ...
- hdu4923 Room and Moor
4923Room and Moor Room and Moor Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 262144/2621 ...
- mongodb_修改器($inc/$set/$unset/$push/$pop/upsert......)
主从复制:http://blog.csdn.net/drifterj/article/details/7833883 对于文档的更新除替换外,针对某个或多个文档只需要部分更新可使用原子的更新修改器,能 ...
- tc 146 2 BridgeCrossing(n人过桥问题)
SRM 146 2 1000BridgeCrossing Problem Statement A well-known riddle goes like this: Four people are c ...
- 微软“One Windows”的梦想已经破灭了吗?
导读 Windows 10 正式公布的时候,微软曾表示该系统将开启更为个性化的计算新纪元,可让用户在使用各类设备处理各项事务时,享受到一致.熟悉和可兼容的体验,从 Xbox 到 PC 和手机,再到平板 ...
- MRC
MRC 关于NSString,retainCount为-1 C方法中含有Copy的方法名, 都要释放 例如CFRealse(ref) 字符串常量,因为one为字符串常量,系统不会回收,也不会对其作引用 ...
- iOS网络学习之“远离NSURLConnection 走进NSURLSession”
目前,在iOS的开发中,NURLConnection已经成为了过去式,现在的NSURLConnection已经deprected(iOS7之后),取而代之的是NSURLSession.而且AFNetw ...
- js ajax简单使用
文章部分资源来源:(http://blog.csdn.net/lzkkevin/article/details/6777474)以及(http://www.cnblogs.com/hwx0807/ar ...
- access数据库用sql语句添加字段,修改字段,删除字段
用 Create Table 建立一个表 Table1 ,主键是自动编号字段,另一个字段是长度是 10 的文本字段. 代码如下:CREATE TABLE Table1 (Id COUNTER CONS ...
- PHP判断用户操作系统(Android,ipad,iphone,windows)
这段脚本可以运用在:针对不同的操作系统,把用户引导向相应的网站或做相应的处理. <?php // PHP 判断客户端平台(PC.安卓.iPhone.平板) // strpos() 函数返回字符串 ...