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).
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 file of test SmartForm from here. 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:
No comments:
Post a Comment