当前位置:网站首页>About the writing of ALV format control part
About the writing of ALV format control part
2022-07-29 03:47:00 【Lunar Yin shortage】
About ALV How to write the format control part
ALV There are two ways to write format control , A format that controls each attribute separately , A format that uniformly controls each attribute
Now let's write two cases
The first is to control each attribute separately , The case is as follows :
We will number each attribute colpos , And then the first one lv_colpos Set to 1, The latter is set as self increasing
ls_fieldcat-fieldname For the property name (ls_fieldcat It is the inner table name set by ourselves )
Then you can set the data type and data length by yourself ( namely ls_fieldcat-datatype and ls_fieldcat-outputlen)
then ls_fieldcat-seltext_m That is, remarks
Pay attention to add APPEND ls_fieldcat TO lt_fieldcat.
among lt_fieldcat For our inner table name
* 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.
* 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.
The first way seems a little troublesome ( The main reason is that the occupied length is too long , But in fact, it's just a copy and paste effort )
We can also use the second method , That is to use a subroutine , To uniformly arrange these attributes
For example, as follows
Define a subroutine F_SET_LAYOUT
Then write the unified attributes ,
namely gs_layout-zebra = ‘X’. (gs Also defined for yourself , Equivalent to the above ls)
gs_layout-colwidth_optimize = ‘X’.
- gs_layout-f2code = ‘&ETA’.
&---------------------------------------------------------------------
*& Form F_SET_LAYOUT
&---------------------------------------------------------------------
*& text
&---------------------------------------------------------------------
*& --> p1 text
*& <-- p2 text
&---------------------------------------------------------------------
FORM f_set_layout .
CLEAR gs_layout.
gs_layout-zebra = ‘X’.
gs_layout-colwidth_optimize = ‘X’.
- gs_layout-f2code = ‘&ETA’.
gs_layout-info_fieldname = ‘COL_LINE’." Line color display
gs_layout-coltab_fieldname = ‘COL_CELL’." Cell color display
ENDFORM.
In the above part, we have uniformly written the layout settings of each attribute , Now we are going to write which attributes should be shown by us
You can see our subroutine below , Macro definitions are used , Defined alv_appen_field
&---------------------------------------------------------------------
*& Form F_SET_FIELDCAT
&---------------------------------------------------------------------
*& text
&---------------------------------------------------------------------
*& --> p1 text
*& <-- p2 text
&---------------------------------------------------------------------
FORM f_set_fieldcat .
CLEAR gs_fieldcat.
REFRESH gt_fieldcat.
DEFINE alv_appen_field.
gs_fieldcat-fieldname = &1.
gs_fieldcat-seltext_l = &2.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
END-OF-DEFINITION.
alv_appen_field:
‘VBELN’ ‘ Sales order number ’,
‘MENGE’ ‘ Purchase order number ’,
‘ERFMG’ ‘ Quantity of goods received ’,
‘ERFMG_JS’ ‘ Timely warehousing quantity ’,
‘ERFMG_BJS’ ‘ Not timely warehousing quantity ’,
‘JSL’ ‘ Timeliness rate ’,
‘EINDT’ ‘ Purchase delivery date ’,
‘EBELN’ ‘ Purchase order number ’,
‘EBELP’ ‘ Purchase order line number ’,
‘MATNR’ ‘ Part number ’,
‘TXZ01’ ‘ Part number description ’,
‘MEINS’ ‘ Order unit ’,
‘BUKRS’ ‘ company ’,
‘WERKS’ ‘ factory ’,
‘EKORG’ ‘ Purchasing organization ’,
‘EKGRP’ ‘ Procurement section ’,
‘SUBMI’ ‘ Summary No ’,
‘BEDAT’ ‘ Order date ’,
‘MATKL’ ‘ Item group ’,
‘ERFMG_WRK’ ‘ Summary of UN warehoused quantity ’,
‘BUDAT’ ‘ Latest warehousing date ’,
‘POSNR’ ‘ Sales order line number ’,
‘BSTNK’ ‘ Customer reference number ’,
‘KUNNR’ ‘ Customer code ’,
‘KVGR2’ ‘ brand ’,
‘EDATU’ ‘ Sales order review delivery date ’,
‘SFJH’ ‘ Whether the goods are delivered in time ’,
‘BSART’ ‘ Voucher type ’,
‘LIFNR’ ‘ Supplier code ’.
ENDFORM.
Then write this subroutine in call_alv This subroutine is encapsulated twice
&---------------------------------------------------------------------
*& Form CALL_ALV
&---------------------------------------------------------------------
*& text
&---------------------------------------------------------------------
*& --> p1 text
*& <-- p2 text
&---------------------------------------------------------------------
FORM call_alv .
PERFORM f_set_fieldcat.
PERFORM f_set_layout.
PERFORM f_call_alv.
ENDFORM.
Write the following line in the program , It is usually written after the selection interface
PERFORM call_alv. " Exhibition
The two methods are shown
边栏推荐
- (codeforce547)C-Mike and Foam(质因子+容斥原理)
- Overestimated test driven development?
- I.MX6U-驱动开发-2-LED驱动
- Shutter start white screen
- Extended operator of new features in ES6
- Solve the delay in opening the console of Google browser
- 路西法98-生活记录ing
- Solve the problem of garbled code when opening the project code in idea
- The const keyword of ES6 declares variables
- Typescript from entry to mastery (XXI) generic types in classes
猜你喜欢

Since 2019, you must have stopped using this marketing strategy

Shopify seller: EDM marketing should be combined with salesmartly to easily get the conversion rate

tron OUT_ OF_ ENERGY

(2022杭电多校三)1002-Boss Rush(状压DP+二分)

Analysis of new retail o2o e-commerce model

Why is continuous integration and deployment important in development?

SQL窗口函数

Configmap配置与Secret加密

Vs code must know and know 20 shortcut keys!

Process tracking of ribbon principle
随机推荐
最新二开版漫画小说听书三合一完整源码/整合免签接口/搭建教程/带采集接口
Data too long for column 'xxx' at row 1 solution
华为天才少年稚晖君做了一把模块化机械键盘,引起极客圈地震,网友:这才是真正的客制化...
The const keyword of ES6 declares variables
Several cases of word wrapping in div
2. 变量及作用域
RHCE的at,crontab的基本操作,chrony服务和对称加密和非对称加密
SFTP upload error: com.jcraft.jsch JSchException: connection is closed by foreign host
Why don't programmers work blindly?
The latest second edition of comic novels, listening to books, three in one, complete source code / integrated visa free interface / building tutorials / with acquisition interface
Shopify卖家:EDM营销就要搭配SaleSmartly,轻松搞定转化率
Introduction and comparison of unicast, multicast (target broadcast, multicast), broadcast, flooding, flooding
Simple understanding of Poe and UPS Technology
安装抓包证书
SSL==证书相关概念
How fast does it take to implement a super simple language
sql
How to judge stun protocol
Android view system and custom view Series 1: (kotlin version)
Interview essential! TCP classic 15 consecutive questions!