Showing posts with label Smartforms. Show all posts
Showing posts with label Smartforms. Show all posts

Dynamic Background Colors in Smartforms

Posted by Krishh Webworld | 11:10 AM | , , , | 0 comments »

We were having some specific background colors in our output generated by the SMartforms. This background colors are coming properly in the print-out. But, when we try to send them as FAX, we are getting the BLACK background whereever we have that background color.

I used Field-symbols to have an access of the table which stores the Smartforms definition. I replaced the background color with the White background.

Code Snippet for Dynamic Background Color
*&---------------------------------------------------------------------*
* This code will clear the specific background for specific conditions
*&---------------------------------------------------------------------*
* In line type TYPE1 under the MAIN_TABLE, we have two columns.
* Column 1 with RED background and border
* Column 2 with no background color and BLUE border
*
*
FIELD-SYMBOLS: TYPE tsftabdef. " Table - Actual SF definitions
*
DATA: l_tabdef TYPE ssftabdef, " Work Area for the Table
t_ltypes TYPE tsfltype, " Table - Line types
l_ltypes TYPE ssfltype, " Work Area for the table
t_colinfo TYPE tsfcolinfo, " Table - Columns
l_colinfo TYPE ssfcolinfo, " Work area for the table
t_border TYPE tsfctaba, " Tables - Borders
l_border TYPE ssfctaba. " Work Area for the border
*
*
* Assign the table definition to the table field symbol
* Assiging by '(Program)Tablename' will give as the actual table
* which contains the defination of the Smartform. We will change
* respective table background color.
*
ASSIGN ('(SAPLSTXBC)TABDEFS') TO .
*
* Table definition table
LOOP AT INTO l_tabdef.
*
* Table line Types
* Line type TYPE1 from the table MAIN_TABLE
LOOP AT l_tabdef-tltype INTO l_ltypes.
*
* Coloum information
* Column1 (cell) of the TYPE1
LOOP AT l_ltypes-tcolinfo INTO l_colinfo.
*
* Borders
* Background color and borders for that cell
LOOP AT l_colinfo-borders INTO l_border.
*
* Clearing the color parameters for the cell
CLEAR: l_border-intensity, " Intensity
l_border-fillcolor-red, " Red
l_border-fillcolor-used, " Color Used
l_border-cfillcolor-color, " Red color in Hexa
l_border-cfillcolor-xred. " Color used in Hexa
*
MODIFY l_colinfo-borders FROM l_border.
ENDLOOP.
*
MODIFY l_ltypes-tcolinfo FROM l_colinfo.
ENDLOOP.
*
MODIFY l_tabdef-tltype FROM l_ltypes.
ENDLOOP.
*
MODIFY FROM l_tabdef.
ENDLOOP.

You can follow this link to have step-by-step explianation alongwith the Screenshots and SMartform XML file:
Dynamic Background Colors in Smartforms

This is one of my published WIKIes on SDN.

SAP Smartforms: Breakpoints

Posted by Krishh Webworld | 5:56 PM | , | 0 comments »

Debugging is necessary when we have program lines node in our Smartforms and the code in the program lines node is not working as per our expectation. Currently, we don't have the Breakpoint button as what we have in the ABAP code Editor in the Workbench. So, what are the options to put a break point in Smartforms:

1. Hardcode the BREAK-POINT: We just have to put the BREAK-POINT statement whereever we want to stop the code and look inside in Debugger. This is good option when we are developing the Smartforms. But we all, as per the Human nature, forgot to remove those BREAK-POINTs from the program lines and Users would have to face the debugger at each and every break-point and would start shouting..!! This is what we all don't want. So, this option is not good.

2. Breakpoint using BREAK user-name: We can put the break point using the statment user name addition to the break command, for example BREAK NAIMESH. These break points would not stop any other users who would run this Smartform. Still it has some disadvantages: Everytime the developer who has put the break point will stop i n the Debugger. It is fine, if we have only one or two, but we have many than it would be a problem. So, this makes the option less powerful.

3. Breakpoint on the fly: To put a break point on the fly, we can follow these simple steps to put a breakpoint as required.

Step1: Open your Smartform and Copy the text as which you want to put a break point and press the Test Button. It will bring you the Function Builder.



Step 2: Press the dispaly button to open the code of the function.

Step 3: Press the Find (control+F) button.
Step 4: In the find screen, paste the copied text (control+V) in the Text.
Select the option "In main Program"
Press Enter
Step 5: From the hit list, go to the source code by doing doubleclick on the search results. Now, put a Cursor on the line and press the "Set Breakpoint" button.
That's it. So, when you run the application it will stop to this break point.
It seems to be the lengthy steps, but they are effective.

Archives

Subscribe Now: Feed Icon