ABAP--如何在SMARTFORMS里动态打印背景颜色
来源:互联网 发布:开淘宝需要注册公司吗 编辑:程序博客网 时间:2024/05/20 07:49
Situation:
Our outputs have some background colors for important fields to have better visibility. This works fine for the normal printout. But, when send a SmartForm Output as a FAX, output comes with a BLACK background wherever we have the background color. And this makes the output unreadable (BLACK font with BLACK background).
Possible ways to handle the problem:
- Don't send a FAX: This is not feasible, as some customers would like to have there forms as FAX
- Create a clone of the existing forms and remove the background color and call them whenever we have to send as FAX: This doesn't make sense because this will lead to more maintenance; change to the primary form leads the change to the clone form.
- Find out some way to remove the background color dynamically: This seems to be the best choice, but next question is how to do it.
Solution:
I had debugged the SmartForm function modules over and over to get the point where it sets the background color, borders etc to the output and what I found, there is only main internal table, with deep structure, which handles everything to generate the layout for the output.
I have started with creating a test Smartform. I created some tables lines with background colors. Than I made a coding node in the SmartForm and tried to change the internal table, which holds the entire layout related information, with help of field-symbols to remove the background color and BINGO - I got the background color removed.
With Background Color:
Without Background Color:
SmartForm:
Download the uploadable .XML Save this file as ZTEST_NP_DYN_BGCOL.XML. To Upload, go to tcode SMARTFORMS and upload this file from Utilities > Upload Form.
The Main logic which handles the dyanmic coloring is inside the Smartform under window DUMMY.
Driver Program
This is the driver program for SmartForm:
*&---------------------------------------------------------------------* *& Report ZTEST_NP_SF_DYN *& *&---------------------------------------------------------------------* *& Test Program to test the dynamic background color in the *& Smartforms *&---------------------------------------------------------------------* REPORT ZTEST_NP_SF_DYN. DATA: W_FM_NAME TYPE RS38L_FNAM. * Selection Screen SELECTION-SCREEN: BEGIN OF BLOCK BLK1 WITH FRAME. SELECTION-SCREEN: BEGIN OF LINE, COMMENT 1(20) L_SF_NM, POSITION 35. PARAMETERS: P_SF_NM TYPE TDSFNAME DEFAULT 'ZTEST_NP_DYN_BGCOL'. SELECTION-SCREEN: END OF LINE. SELECTION-SCREEN: BEGIN OF LINE, COMMENT 1(20) L_ITEM, POSITION 35. PARAMETERS: P_ITEM TYPE I DEFAULT 5. SELECTION-SCREEN: END OF LINE. SELECTION-SCREEN: BEGIN OF LINE. PARAMETERS: P_BG_COL AS CHECKBOX. SELECTION-SCREEN: COMMENT 3(35) L_BG, END OF LINE. SELECTION-SCREEN: END OF BLOCK BLK1. * Initialization INITIALIZATION. L_SF_NM = 'Smartform Name'. L_ITEM = 'Number of Item'. L_BG = 'With Background Color'. * Start of Selection START-OF-SELECTION. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING FORMNAME = P_SF_NM IMPORTING FM_NAME = W_FM_NAME EXCEPTIONS NO_FORM = 1 NO_FUNCTION_MODULE = 2 OTHERS = 3. IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. CALL FUNCTION W_FM_NAME EXPORTING NO_ITEM = P_ITEM I_DYN_BG = P_BG_COL EXCEPTIONS FORMATTING_ERROR = 1 INTERNAL_ERROR = 2 SEND_ERROR = 3 USER_CANCELED = 4 OTHERS = 5. IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. |
How to run this program:
Note: I have tried this on ECC 5.0.
source :https://www.sdn.sap.com/irj/sdn/wiki?path=/display/Snippets/Dynamic+Background+Colors+in+SmartForms
- ABAP--如何在SMARTFORMS里动态打印背景颜色
- ABAP 调用smartforms打印
- SAP SMARTFORMS 如何打印动态图片
- ABAP 如何判断调用smartforms时是进行打印还是预览
- 怎样在网页的code behind里动态改变控件的背景颜色
- abap smartforms使用自定义格式打印输出重叠解决方案
- abap smartforms使用自定义格式打印输出重叠解决方案
- ABAP--如何在打印报表上打印水印
- ABAP--如何在打印报表上打印水印
- ABAP--如何在打印报表上打印水印
- ABAP--如何在打印报表上打印水印
- smartforms 打印转成保存在本地pdf
- Abap-Smartforms中如何去掉开头的中文文本
- ABAP-在SMARTFORMS中取消使用WORD作为编辑器
- ABAP-在SMARTFORMS中取消使用WORD作为编辑器
- ABAP-在SMARTFORMS中取消使用WORD作为编辑器
- 背景颜色渐变动态
- abap smartforms 实现单据
- JAVA中浅复制与深复制
- bss段和.data段的区别
- 配置dreamweaver使其支持其他的文件扩展名
- 微软爆出2008年最大安全漏洞
- 深入浅出WPF(10)——“脚踩N条船”的多路Binding
- ABAP--如何在SMARTFORMS里动态打印背景颜色
- VC中cl.exe命令使用方法
- servlet实现文件上传和下载
- 利用CMT技术,倍增服务器吞吐量——介绍Sun公司的UltraSPARC T1处理器 (引用)
- 如何使父div的范围包含浮动的子div
- 如何在Microsoft Analysis里Merge partition
- SQL:左连接,右连接,全连接
- 如何使用spy ++ (How to use Spy ++)
- IE和firefox通用的复制到剪贴板的JS函数