当前位置:网站首页>The first ABAP ALV reporter construction process
The first ABAP ALV reporter construction process
2022-07-26 18:37:00 【Lunar Yin shortage】
REPORT ZALVTEST006.
First step : Statement ALV Related variables
They are definitions ALV The type pool to be used :TYPE-POOLS:SLIS
in the light of ALV Control information data (Layout&Fieldcat)
TYPE-POOLS:slis.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv, " Storage fieldcat Inner table of
wa_fieldcat TYPE slis_fieldcat_alv, " Define workspace
ls_layout TYPE slis_layout_alv. "ALV Structure of format control :layout
Generally, it is named xx_fieldcat Such a variable to reference slis_t_fieldcat, As control information data for storing internal tables
Similarly, it will be named xx_fieldcat Such a variable to reference slis_fieldcat, As the control information data used to define the workspace
Below xx_layout So it is with
The second step : Define the inner table
When there is such a table in our dictionary VBAK( Sales voucher : Header data sheet , yes SAP My watch )
After we check this table , It is found that such data
namely
VBELN Sales voucher
ERDAT Record creation date
ERNAM Name of orderer
KUNNER Seller
They all belong to VBAK This table
And the same thing VBAP This table ( Sales voucher : Project data , For the same SAP Bring their own )
ZMENG Target number of sales units
ZIEME Target quantity UOM
So we define inner table like this
TYPE:BEGIN OF TY_ALVSHOW ‘’ALVSHOW Is the name of the structure of the inner table defined by ourselves
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
KUNNR TYPE VBAK-KUNNR,
POSNR TYPE VBAP-POSNR,
MATNR TYPE VBAP-POSNR,
MATKL TYPE VBAP-MATKL,
ZMENG TYPE VBAP-ZMENG,
ZIEME TYPE VBAP-ZIEME,
WERKS TYPE VBAP-WERKS,
LGORT TYPE VBAP-LGORT.
END OF TY_ALVSHOW.
DATA: LT_ALVSHOW TYPE TABLE OF TY_ALVSHOW. “ Define the name of the related inner table as LT_ALVSHOW, Its structure refers to the structure defined above ”
WA_ALVSHOW TYPE TY_ALVSHOW. " Define workspace WA_ALVSHOW
The third step : Reading data
Because you need to read two tables , We need to connect to read , And generally we read through inner connection .
SELECT
VBELN ERDAT ERNAM KUNNR POSNRMATNR
MATKL ZMENG ZIEME WERKS LGORT
FROM VBAK as a INNER as b
on a~vbeln = b~vbeln
into TABLE LT_ALVSHOW
UP TO 100 ROWS.
Step four : ALV Format control ( In fact, that is layout Parameter control )
* The name of the format control information we named is ls_layout
ls_layout-zebra = ‘X’. “ stay ABAP Many times in the X Express ‘ yes ‘ It means
ls_layout-detail-popup = ‘X’. " Whether to pop up the detailed information serial port
layout
ETA Represents the function code of double clicking , Is constant
SE11
Then input VBAK, Click to display , You can find this table .
&---------------------------------------------------------------------
*& Report ZALVTEST006
&---------------------------------------------------------------------
*&
&---------------------------------------------------------------------
REPORT ZALVTEST006.
First step : Statement ALV Related variables
TYPE-POOLS:slis.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv, " Storage fieldcat Inner table of
wa_fieldcat TYPE slis_fieldcat_alv, " Define workspace
ls_layout TYPE slis_layout_alv. "ALV Structure of format control :layout
The second step : Define the inner table
TYPES: BEGIN OF TY_ALVSHOW,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
KUNNR TYPE VBAK-KUNNR,
POSNR TYPE VBAP-POSNR,
MATHR TYPE VBAP-MATNR,
MATKL TYPE VBAP-MATKL,
ZMENG TYPE VBAP-ZMENG,
ZIEME TYPE VBAP-ZIEME,
WERKS TYPE VBAP-WERKS,
LGORT TYPE VBAP-LGORT,
END OF TY_ALVSHOW.
Define the name of the related inner table as LT_ALVSHOW, Its structure refers to the structure at the beginning of our uninstallDATA: lt_alvshow TYPE TABLE OF TY_ALVSHOW,
LS_alvshow TYPE TY_ALVSHOW.Define workspace wa_alvshowThe third step : Reading data
SELECT
VBELN ERDAT ERNAME KUNNR POSNRMATNR
MATKL ZMENG ZIEME WERKS LGORT
FROM VBAK as a INNER JOIN vbap as b
on a~vbeln = b~vbeln
into TABLE LT_ALVSHOW
UP TO 100 ROWS.
Step four :ALV Format control
ls_layout-zebra = ‘X’.
ls_layout-detail_popup = ‘X’.
ls_layout-detail_titlebar = ‘X’.
ls_layout-f2code = ‘X’.
ls_layout-colwidth_optimize = ‘X’.
"fieldcat
* Sales voucher
lv_colpos = 1.
ls_fieldcat-fieldname = ‘VBELN’.
ls_fieldcat-col_pos = lv_colpos.
ls_fieldcat-key = ‘X’.
ls_fieldcat-datatype = ‘CHAR’.
ls_fieldcat-outputlen = ‘10’.
ls_fieldcat-seltext_m = ‘ Sales voucher ’.
APPEND ls_fieldcat TO lt_fieldcat.
* Certificate date
lv_colpos = lv_colpos + 1 .
ls_fieldcat-fieldname = ‘ERDAT’.
ls_fieldcat-col_pos = lv_colpos.
ls_fieldcat-key = ‘X’.
ls_fieldcat-datatype = ‘CHAR’.
ls_fieldcat-outputlen = ‘10’.
ls_fieldcat-seltext_m = ‘ Sales date ’.
APPEND ls_fieldcat TO lt_fieldcat.
* Creation time
lv_colpos = lv_colpos + 1 .
ls_fieldcat-fieldname = ‘ERNAME’.
ls_fieldcat-col_pos = lv_colpos.
ls_fieldcat-key = ‘X’.
ls_fieldcat-datatype = ‘CHAR’.
ls_fieldcat-outputlen = ‘10’.
ls_fieldcat-seltext_m = ‘ Creation time ’.
APPEND ls_fieldcat TO lt_fieldcat.
* founder
lv_colpos = lv_colpos + 1 .
ls_fieldcat-fieldname = ‘ERNAM’.
ls_fieldcat-col_pos = lv_colpos.
ls_fieldcat-key = ‘X’.
ls_fieldcat-datatype = ‘CHAR’.
ls_fieldcat-outputlen = ‘12’.
ls_fieldcat-seltext_m = ‘ Salesman ’.
APPEND ls_fieldcat TO lt_fieldcat.
* Seller
lv_colpos = lv_colpos + 1 .
ls_fieldcat-fieldname = ‘kunnr’.
ls_fieldcat-col_pos = lv_colpos.
ls_fieldcat-key = ‘X’.
ls_fieldcat-datatype = ‘CHAR’.
ls_fieldcat-outputlen = ‘10’.
ls_fieldcat-seltext_m = ‘ Seller ’.
APPEND ls_fieldcat TO lt_fieldcat.
* Project code
lv_colpos = lv_colpos + 1 .
ls_fieldcat-fieldname = ‘POSNR’.
ls_fieldcat-col_pos = lv_colpos.
ls_fieldcat-key = ‘X’.
ls_fieldcat-datatype = ‘NUMC’.
ls_fieldcat-outputlen = ‘6’.
ls_fieldcat-seltext_m = ‘ Project code ’.
APPEND ls_fieldcat TO lt_fieldcat.
* materiel
lv_colpos = lv_colpos + 1 .
ls_fieldcat-fieldname = ‘MATNR’.
ls_fieldcat-col_pos = lv_colpos.
ls_fieldcat-key = ‘X’.
ls_fieldcat-datatype = ‘CHAR’.
ls_fieldcat-outputlen = ‘18’.
ls_fieldcat-seltext_m = ‘ materiel ’.
APPEND ls_fieldcat TO lt_fieldcat.
* Item group
lv_colpos = lv_colpos + 1 .
ls_fieldcat-fieldname = ‘MATKL’.
ls_fieldcat-col_pos = lv_colpos.
ls_fieldcat-key = ‘X’.
ls_fieldcat-datatype = ‘CHAR’.
ls_fieldcat-outputlen = ‘9’.
ls_fieldcat-seltext_m = ‘ Item group ’.
APPEND ls_fieldcat TO lt_fieldcat.
* Number
lv_colpos = lv_colpos + 1 .
ls_fieldcat-fieldname = ‘ZMENG’.
ls_fieldcat-col_pos = lv_colpos.
ls_fieldcat-key = ‘X’.
ls_fieldcat-datatype = ‘QUAN’.
ls_fieldcat-outputlen = ‘13’.
ls_fieldcat-seltext_m = ‘ Number ’.
APPEND ls_fieldcat TO lt_fieldcat.
* Company
lv_colpos = lv_colpos + 1 .
ls_fieldcat-fieldname = ‘ZIEME’.
ls_fieldcat-col_pos = lv_colpos.
ls_fieldcat-key = ‘X’.
ls_fieldcat-datatype = ‘CUNIT’.
ls_fieldcat-outputlen = ‘3’.
ls_fieldcat-seltext_m = ‘ Company ’.
APPEND ls_fieldcat TO lt_fieldcat.
* factory
lv_colpos = lv_colpos + 1 .
ls_fieldcat-fieldname = ‘werks’.
ls_fieldcat-col_pos = lv_colpos.
ls_fieldcat-ref_tabname = ‘VBAP’.
APPEND ls_fieldcat TO lt_fieldcat.
* stock
lv_colpos = lv_colpos + 1 .
ls_fieldcat-fieldname = ‘LOGORT’.
ls_fieldcat-col_pos = lv_colpos.
ls_fieldcat-ref_tabname = ‘VBAP’.
APPEND ls_fieldcat TO lt_fieldcat.
Step five : Defining events ( Omit )
Step six : Show ALV
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
EXPORTINGI_INTERFACE_CHECK = ’ ’
I_BYPASSING_BUFFER = ’ ’
I_BUFFER_ACTIVE = ’ ’
I_CALLBACK_PROGRAM = ’ ’
I_CALLBACK_PF_STATUS_SET = ’ ’
I_CALLBACK_USER_COMMAND = ’ ’
I_CALLBACK_TOP_OF_PAGE = ’ ’
I_CALLBACK_HTML_TOP_OF_PAGE = ’ ’
I_CALLBACK_HTML_END_OF_LIST = ’ ’
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ’ ’
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = LS_LAYOUT
IT_FIELDCAT = LT_FIELDCATIT_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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = LT_ALVSHOW
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.Implement suitable error handling here
ENDIF.
边栏推荐
- Continue to work hard on your skills, and the more you learn, the more you will learn
- [brother hero July training] day 25: tree array
- Oracle第一天(开发常用的知识点再回顾整理下)
- Distributed link tracking Jaeger's use in golang
- Arm China responded to the "disconnection of Huawei supply" incident! Ren Zhengfei said "no impact"!
- 同步时现实密码不匹配
- 链表-两个链表的第一个公共结点
- ALV屏幕输入选项学习
- Visual VM 定位OOM,FullGC使用方法
- Maximum sum of continuous subarray of sword finger offer (2)
猜你喜欢

分布式链路追踪Jaeger在Golang中的使用

Are you suitable for automated testing?

Neural network learning (2) introduction 2

SSM练习第五天

MySQL 遇到过死锁问题吗,你是如何解决的?

J9 number theory: how to avoid the trap of stepping on thunder?

Rookie cpaas platform microservice governance practice

Nailing third-party service provider application ISV application development and listing tutorial

If the recommendation effect is not satisfactory, it's better to try to learn the propeller chart

钉钉第三方服务商应用ISV应用开发及上架教程
随机推荐
剑指offer 跳台阶扩展问题
链表-两个链表的第一个公共结点
网上炒股,选择在哪里开户比较安全呢?
PS_2_图层
mpc5744p烧录到98%无法继续下载程序
Bulletgraph (bullet diagram, bullet diagram)
网易游戏研发工程师实习生(客户端方向)一面
详解 gRPC 客户端长连接机制实现
打印日志的一些小技巧
Explain in detail the implementation of grpc client long connection mechanism
云服务器mySQL提示报错
凝心聚力,心心向印!印度中资手机企业协会(CMA)正式运营!
Real passwords do not match during synchronization
LeetCode_134_加油站
Duplicate gallerycms character length limit short domain name bypass
The step jumping expansion problem of sword finger offer
Operation: skillfully use MySQL master-slave replication delay to save erroneously deleted data
剑指offer 连续子数组的最大和(二)
Greedy - 455. Distribute cookies
Hello World