当前位置:网站首页>SAP SMARTFORMS换页打印自动判断
SAP SMARTFORMS换页打印自动判断
2022-06-11 00:50:00 【DeveloperMrMeng】
最近项目需要做一些单据打印,又遇到了那个熟悉的需求,明细标题行要在换页的时候也进行打印,如果只是简单的只有一种明细清单,那将标题行放在Windows窗口中就行了,但如果有多种明细清单,就不能这么做了,因为每种明细清单标题可能是不一样的,换页的时候是需要根据当前是哪种明细数据来打印对应的标题行的,记得之前做法都是先打印出来,或者根据行高去计算,看到第几行需要换页,然后写代码计算行数,MOD求余,使用换页命令进行换页等等一些操作,嫌麻烦就扒了一下系统标准代码,从标准判断换页的逻辑中抽离出来了一小部分封装了一个通用函数,后面判断换页只需要调用一下就好了,无需一堆逻辑去手动计算,再通过命令调用换页之类的操作了。
标准判断换页的逻辑在 SSFCOMP_TABLE_BEGIN 的 performtab_use_definition 中,也可以自己去打断点看看。
效果如下:


实现方式:
1.创建函数ZCHECK_NEW_PAGE


**********************************************************************
* 根据行高判断下一行是否需要换页
* 参照函数SSFCOMP_TABLE_BEGIN中perform tab_use_definition中的处理
**********************************************************************
FUNCTION ZCHECK_NEW_PAGE.
*"----------------------------------------------------------------------
*"*"本地接口:
*" IMPORTING
*" REFERENCE(I_VALUE)
*" REFERENCE(I_UNIT) TYPE CHAR2
*" EXPORTING
*" REFERENCE(E_NEW_PAGE) TYPE FLAG
*"----------------------------------------------------------------------
* Units
CONSTANTS:
UNIT_CHARACTER(2) VALUE 'CH',
UNIT_CENTIMETER(2) VALUE 'CM',
UNIT_MILLIMETER(2) VALUE 'MM',
UNIT_POINT(2) VALUE 'PT',
UNIT_LINE(2) VALUE 'LN',
UNIT_TWIP(2) VALUE 'TW',
UNIT_INCH(2) VALUE 'IN'.
DATA:
L_FACTOR TYPE F,
LV_CONV_VALUE TYPE I.
CASE I_UNIT.
WHEN UNIT_TWIP.
L_FACTOR = 1.
WHEN UNIT_POINT.
L_FACTOR = 20.
WHEN UNIT_CENTIMETER.
L_FACTOR = 1440 / 254 * 100.
WHEN UNIT_MILLIMETER.
L_FACTOR = 144 / 254 * 100.
WHEN UNIT_INCH.
L_FACTOR = 1440.
WHEN OTHERS.
L_FACTOR = 0.
ENDCASE.
LV_CONV_VALUE = I_VALUE * L_FACTOR.
ASSIGN ('(SAPLSTXBC)FT-REM_HEIGHT') TO FIELD-SYMBOL(<FS_REM_HEIGHT>).
IF <FS_REM_HEIGHT> - LV_CONV_VALUE + 12 <= 0.
E_NEW_PAGE = 'X'.
ELSE.
E_NEW_PAGE = ''.
ENDIF.
ENDFUNCTION.2.在smartforms中添加以下逻辑:
传入参数为明细内容行的高度和高度单位,也就是下一行即将要打印的行的高度信息
当判断下一行明细会换页打印时,在此之前先打印标题,即实现标题行随换页一起打印的效果

打印完换页后的标题行和换页后的第一行明细后,清空标识,保证每一页只会打印一次标题

借助这个函数,我们就能快速的知道下一行是否需要换页,从而可以在换页后的最开始,去决定我们想要打印的东西。
以上。
边栏推荐
- [leetcode] merge K ascending linked lists
- Task07: double pointer
- Interviewer: let me introduce the items in your resume. Tell me more about them, and attach the actual project
- Leetcode 1116 print zero even odd (concurrent multithreading countdownlatch lock condition)
- 小鱼儿的处理
- 爱思唯尔---Elseviewer---预印本在线发表通知
- 2021-7-18 ROS notes XML language related
- ACM教程 - 堆排序
- 【MATLAB】图像分割
- [music] playing blue and white porcelain based on MATLAB [including Matlab source code 1873]
猜你喜欢

Leetcode 652 find duplicate subtrees (recommended by DFS)

【错误记录】Android 应用安全检测漏洞修复 ( StrandHogg 漏洞 | 设置 Activity 组件 android:taskAffinity=““ )

A brief history of neural network

Programming implementation: input any English month, and output its corresponding Chinese prompt after looking up the month table. Abbreviations can also be found.

薪的测试开发程序员们,你为何要走?和产品相互残杀到天昏地暗......

Byte Beijing 23K and pinduoduo Shanghai 28K, how should I choose?
![[BSP video tutorial] BSP video tutorial issue 17: single chip microcomputer bootloader topic, startup, jump configuration and various usage of debugging and downloading (2022-06-10)](/img/69/1e2a71f123527b9aa8381cb9b86f7f.png)
[BSP video tutorial] BSP video tutorial issue 17: single chip microcomputer bootloader topic, startup, jump configuration and various usage of debugging and downloading (2022-06-10)

Method of using dism command to backup driver in win11 system

Metersphere tutorial: how to assert when the returned result of the interface is null

Project sorting of Online Exercise System Based on gin and Gorm
随机推荐
【Qt】error: QApplication: No such file or directory 解决方案
Win11系统使用DISM命令备份驱动程序的方法
Leetcode 1116 print zero even odd (concurrent multithreading countdownlatch lock condition)
Question g: candy
[Qt] Erreur: qapplication: No such file or directory Solution
Virtual joystick of QT quick QML instance
A brief history of neural network
[leetcode] reverse linked list II
Leetcode 665 non decreasing array (greedy)
Matlab array other common operation notes
[leetcode] construct a binary tree by traversing the sequence from front to middle (continuous optimization)
[traffic sign recognition] Based on Matlab GUI YCbCr feature extraction +bp neural network traffic sign recognition [including Matlab source code 1869]
AI fanaticism | come to this conference and work together on the new tools of AI!
How to change the administrator's Avatar in win11? Win11 method of changing administrator image
In May, the main growth ranking list (platform of station B) of the single flying melon data up was released
[leetcode] a group of K flipped linked lists
[leetcode] delete duplicate Element II in the sorting linked list
flutter 状态管理
[cloud native | kubernetes] actual combat of ingress case
【BSP视频教程】BSP视频教程第17期:单片机bootloader专题,启动,跳转配置和调试下载的各种用法(2022-06-10)