当前位置:网站首页>Simplest ALV template
Simplest ALV template
2022-06-12 20:39:00 【Square wood 2021】
*&---------------------------------------------------------------------*
*& Report ZMMU100
*&---------------------------------------------------------------------*
*& System : Program name
*& Module : MM
*& Program ID : ZMMU100
*& Author : john
*& Date : 20210616
*& Description : Program Introduction
*&---------------------------------------------------------------------*
*& Modify the record :
*& Edition date Modifier
*& NO** YYYY/MM/DD XXX
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
REPORT zmmu100.
TABLES:zmmt021.
TYPE-POOLS:slis.
DATA:mail_ret TYPE zsappo_ret_info.
DATA:gt_fieldcat TYPE STANDARD TABLE OF lvc_s_fcat.
DATA:gs_fieldcat LIKE LINE OF gt_fieldcat.
DATA:gt_events TYPE slis_t_event.
DATA:gt_repid TYPE sy-repid.
*DATA:GS_EVENTS LIKE LINE OF GT_EVENTS.
DATA:gs_layout TYPE lvc_s_layo.
*DATA:GS_LAYOUT LIKE LINE OF GT_LAYOUT.
DATA:chat_input TYPE zmsg01.
DATA:BEGIN OF gt_data OCCURS 0,
ebeln TYPE zmmt021-ebeln,
status TYPE zmmt021-status,
zdate TYPE zmmt021-zdate,
ztime TYPE zmmt021-ztime,
ernam TYPE ekko-ernam,
msg TYPE string,
END OF gt_data.
DATA:t_tab TYPE zmms005_t,
is_req TYPE zsappo_req_info,
is_input TYPE zmms006,
es_ret TYPE zsappo_ret_info,
chat_RET TYPE zsappo_ret_info.
SELECTION-SCREEN BEGIN OF BLOCK col WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: s_ebeln FOR zmmt021-ebeln .
SELECT-OPTIONS: s_STATUS FOR zmmt021-status DEFAULT 'N'.
SELECT-OPTIONS: s_ZDATE FOR zmmt021-zdate.
SELECT-OPTIONS: s_ZTIME FOR zmmt021-ztime.
SELECTION-SCREEN END OF BLOCK col.
DEFINE fill_field.
CLEAR gs_fieldcat.
gs_fieldcat-fieldname = &1. "ALV control : Field name of internal table field
gs_fieldcat-scrtext_l = &2. " Long field label
gs_fieldcat-no_zero = &3. "ALV control : Hide zero for output
gs_fieldcat-ref_table = &4. " Refer to table
gs_fieldcat-ref_field = &5. " Reference field
APPEND gs_fieldcat TO gt_fieldcat.
END-OF-DEFINITION.
START-OF-SELECTION. " The sequence in which the program occurs
PERFORM frm_get_data. " Count
PERFORM frm_process_data. " Processing data
PERFORM frm_set_layout. "LAYOUT Parameter setting
PERFORM frm_set_fieldcat. " Set up FIELDCAT Parameters
PERFORM frm_top_of_page. "TOP_OF_PAGE Parameter setting
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form frm_get_data
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_get_data .
DATA:lt_return LIKE TABLE OF bapireturn WITH HEADER LINE.
CLEAR:lt_return[].
DATA ls_zmmt021 TYPE zmmt021.
SELECT DISTINCT a~ebeln,a~status,a~zdate,a~ztime,b~ernam
INTO TABLE @DATA(lt_ebeln)
FROM zmmt021 AS a
INNER JOIN ekko AS b ON b~ebeln = a~ebeln
AND b~frgke = 'Z'
AND b~ihrez <> 'X'
WHERE a~ebeln IN @s_ebeln
AND a~status IN @s_status
AND a~zdate IN @s_zdate
AND a~ztime IN @s_ztime.
LOOP AT lt_ebeln ASSIGNING FIELD-SYMBOL(<fs>).
MOVE-CORRESPONDING <fs> TO gt_data. " Field auto match
MOVE-CORRESPONDING <fs> TO ls_zmmt021. " Field auto match
APPEND gt_data.
ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_process_data
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_process_data .
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_set_layout
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_set_layout .
gs_layout-zebra = 'X'.
gs_layout-cwidth_opt = 'X'.
gs_layout-detailinit = 'X'.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_set_fieldcat
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_set_fieldcat .
REFRESH gt_fieldcat.
fill_field:'EBELN' ' Purchase order ' 'X' 'EKKO' 'EBELN',
'STATUS' ' state ' 'X' '' '',
'ZDATE' ' date ' 'X' '' '',
'ZTIME' ' Time ' 'X' '' '',
'ERNAM' ' Purchaser ' 'X' '' '',
'MSG' ' news ' 'X' '' ''.
gt_repid = sy-repid.
SORT gt_data BY ebeln.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = gt_repid
* i_callback_user_command = 'USER_COMMAND' " Double-click the event
i_callback_top_of_page = 'FRM_TOP_OF_PAGE' " Header
is_layout_lvc = gs_layout
it_fieldcat_lvc = gt_fieldcat[]
i_save = 'A'
it_events = gt_events
TABLES
t_outtab = gt_data[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_top_of_page
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_top_of_page .
DATA:gt_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
"TITLE title
wa_header-typ = 'H'. " The font of the title
wa_header-info = ' Manually push purchase orders to OA System records '.
APPEND wa_header TO gt_header.
CLEAR:wa_header.
"DATE Tabulated date
wa_header-typ = 'S'. " Font of tabulation date
wa_header-key = 'DATE:'. " Date title
CONCATENATE sy-datum(4)'.'
sy-datum+4(2)'.'" From 4 Character truncation 2 position
sy-datum+6(2)
INTO wa_header-info. "TODAY DATE
APPEND wa_header TO gt_header.
CLEAR:wa_header.
"TOTAL NO.OF RECORDS SELECTED
DESCRIBE TABLE gt_data LINES ld_lines.
ld_linesc = ld_lines.
CONCATENATE 'TOTAL NO.OF RECORDS SELECTED:' ld_linesc " Convert to text format
INTO t_line SEPARATED BY space.
wa_header-typ = 'A'. "A In italics
wa_header-info = t_line.
APPEND wa_header TO gt_header.
CLEAR:wa_header,
t_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' " Control the output of header data
EXPORTING
it_list_commentary = gt_header. " Header parameters
ENDFORM.
边栏推荐
- Centos7 installing MySQL 5.7
- 2022年春招,测试工程师全套面试攻略,一篇吃透全部技术栈(全是干货)
- Before job hopping, Jin San made up the interview questions. Jin San successfully landed at Tencent and got a 30K test offer
- Design rule check constraint (set_max_transition, set_max_capability)
- 【无标题】
- Blue Bridge Cup basic-15 VIP question string comparison
- Do we media video, and share the necessary app for friendly new media operation
- Go -- monitor file changes
- Preliminary understanding of regular expressions (regex)
- typeScript的定义类型:不能将类型“Timeout”分配给类型“number”;
猜你喜欢

竣达技术丨适用于“科士达”智能精密空调网络监控

QT pro文件配置ffmpeg宏

设计规则检查约束(set_max_transition、set_max_capacitance)

Event distribution mechanism of view

牛客網:三數之和

Niuke.com: sum of three numbers

Solve the cvxpy error the solver GLPK_ MI is not installed

EditText control starts from the upper left corner

一致性哈希的简单认识

Halcon angle and radian interchange
随机推荐
MySQL installation and Application
MinIO客户端(mc命令)实现数据迁移
服务端口不通排查
What did new do
Understanding of functions
Transaction code qs28 of SAP QM preliminary level
(11) Image frequency domain filtering with OpenCV
设计规则检查约束(set_max_transition、set_max_capacitance)
中小型机房动力环境综合监控解决方案
MySQL field truncation principle and source code analysis
2022年春招,测试工程师全套面试攻略,一篇吃透全部技术栈(全是干货)
JS deep and shallow copy
Is foreign exchange speculation formal and is the fund safe?
Halcon angle and radian interchange
CentOS7安装MySQL5.7操作说明
Listener in JSP
可测性设计学习笔记
MySQL + PostgreSQL batch insert update insertorupdate
What are the barriers that Huawei terminals need to cross if they want to rely on the intelligent turnover of the whole house?
跳槽前恶补面试题,金三成功上岸腾讯,拿到30k的测开offer