You are on page 1of 29

CRM 5.

2 - Building Smart Forms

By Prem Kumar prem.kumar7@wipro.com SAP-CRM Practice, Pune

Contents
1. INTERODCUTION.......................................................................................................................................... 1.1 INTERODUCTION..........................................................................................................................03 2. PROCEDURE 2.1 HOW TO CREATEA SMARTFROMS...........................................................................................04 2.2 PASSING DATA TO SAMRTFROMS............................................................................................09 2.3 HOW TO SET A URL IN SAMRTFROMS.....................................................................................14 2.4 HOW TO INSERT TICKET NUMBER IN SUBJECT LINE..........................................................16 2.5 HOW TO ADD SAMRTSTYLE IN THE SAMRTFOMS...............................................................18 2.6 HOW TO CREATE A TEXT MODULE AND USE IN THE SAMRTFORMS.............................25

1.1 INTERODUCTION SAP Smart Forms is introduced in SAP Basis Release 4.6C as the tool for creating and maintaining forms. SAP Smart Forms allow you to execute simple modifications to the form and in the form logic by using simple graphical tools; in 90% of all cases, this won't include any programming effort. Thus, a power user without any programming knowledge can configure forms with data from an SAP System for the relevant business processes. To print a form, you need a program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. The application program passes the data via a function module interface to the Smart Form . When activating the Smart Form, the system automatically generates a function module. At runtime, the system processes this function module. You can insert static and dynamic tables. This includes line feeds in individual table cells, triggering events for table headings and subtotals, and sorting data before output. Key Benefits of SAP Smart Forms: SAP Smart Forms allows you to reduce considerably the implementation costs of mySAP.com solutions since forms can be adjusted in minimum time. You design a form using the graphical Form Painter and the graphical Table Painter. The form logic is represented by a hierarchy structure (tree structure) that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables , or nodes for graphics. To make changes, use Drag & Drop, Copy & Paste, and select different attributes. These actions do not include writing of coding lines or using a Script language. Using your form description maintained in the Form Builder, Smart Forms generates a function module that encapsulates layout, content and form logic . So you do not need a group of function modules to print a form, but only one.

2.1 Getting started with Smart Forms (Building a simple application)


Step 1: Go to transaction Smartforms.

Step 2: Enter a name for the form and click on Create. Step 3: Enter a short description (subject of smartfrom) for the form.

In this example, we will print a simple text using our form. To create a text, expand Pages and Windows New Page. Select Main Window and Right click on that. Select Create Text

Step 4: Give a name to the text and short description. Step 5: Also enter the text you want to see on the form.

Step 6: SAVE and Activate the Smart form. To know the function module that is generated upon activation of this smart form, click on Environment Function module name.

Following popup with the function module would appear.

Step 7: Test the smart form by clicking on Test. You would be navigated to the function builder with the function module defaulting to the one that is generated earlier.

Step 8: Click on execute.

Step 9: Since we do not have any parameters to pass on, click on Execute.

2.2 PASSING DATA TO THE SMARTFORMS

Scenario: Let us take a simple scenario of passing webclient field's value from Driver program to the Smart Form. Step 1: Go to transaction SMARTFORMS and create a Smart Form. Step 2: To pass the values from the driver program to Smart Form, we need to define the form interface with the parameters to be passed on. Click on Global Settings Form Interface.

Step 3:

Now define the import parameters "ORDERADM_H", ZCRM+ORDER_CODES and HRPERSON_S

Step 4: Now create a Text in the Main window to display the above parameters.

Step 5: To add a field, we need to click on Insert Field.

Step 6: Enter the field names between the & (Ampersand) as shown below:

Step 7: Add all required fields like this in the text body.

Step 8: Save and Activate the Smart Form. Test and run the Smart Form by clicking on Execute.

Step 9: Enter the values as shown below and click on execute.

2.3 HOW TO SET URL LINK IN SMARTFROMS Step 1: Go to transaction Smartforms.

Step 2: open the smartfroms in change mode .The URL will be implemented in the text module. Step 3: Insert the URL in the text module.

Step 4: Select the link and click on the URL button.

Step 5: save and activate.

Step 6:

Note: when we use a template in email -sometimes formatting do no work that requires some email setting. If the link length is more then one line then it will come in the next link without left margin -To solve it we should not maintain left margin in the smart style .if we are using or should not give left margin in main window in form painter.

2.4 HOW TO INSERT TICKET NUMBER IN SUBJECT LINE OF SMARTFROMS

Scenario: The smartfrom is importing field value in the run time from the class " ZL_DOC_PROCESSING_CRM_ORDER" method "CRM_ORDER_EXEC_SMART_FORM ". So here we are getting ticket number in the run time and we want to add ticket number in the subject line like below. Example: Subject: Your service ticket # 40000376 Analysis : while debugging I find out that the screen field in smart form have fix size 30 characters and the data element caption (tdtitle) have real size 50 char Solution: So I plan to pass "Ticket # ticket no" at the run time to the smartfrom subject I added & in the subject field of the smartfroms(screen field) I replaced the "&" with "ticket # ticket no" at the run time.

Step 1: Go to transaction Smartforms Step 2: I added '&' in the Smartfrom subject.

Step 3: Use SE24 open the class "CRM_ORDER_EXEC_SMART_FORM" Step 4: Select the method "CRM_ORDER_EXEC_SMART_FORM" Step 5: The ticket number has leading zero so to avoid it use pass the ticket number to Function module "CONVERSION_EXIT_ALPHA_OUTPUT". Step 6: Split the subject line of smartfrom by '&' and store in two strings SPLIT ls_output_options-tdtitle AT '&' INTO res1 res2.

Step 7: Concatenate the Ticket # Ticket no" with the split subject string CONCATENATE res1 ' 'Ticket#' ls_cap_int res2 INTO ls_caption Step 8: there should be one space between every word. So condense the subject line.

Step 9: Output-option used as an import parameter in smart form which have a field "tdtitle" which use to store the subject line for smartfroms. Step 10: Finally move he concatenated string to the subject line of smart from and have pass the subject line as a parameter to the samrt form function module.

Subject: "You service & has been created" At the run time: "You service ticket # 40000375 has been created"

2.5 HOW TO ADD SMARTSTYLE IN SMARTFROMS TEXT MODULE

SAP Smart Styles: Style name To display texts in a form (SAP Smart Form), we need a style (Smart Style), which contains the formatting information of the text (paragraph and character formats). We specify the style in the output options of the form attributes. It applies for the entire form. In the output options of particular form sub objects (text, address, alternative, folder, loop, table, template, complex paragraph), we can assign a different style, which overrules the general style. This style is used for all sub nodes of the sub object until again another style is specified.
Step 1: Go to transaction SmartStyles or Smartfroms

Step 2: Enter a style name and click on Create. Following screen appears:

Step 3: to create a paragraph, click on folder Paragraph Formats and click on Create (as shown in the above screenshot).

Step 4: following pop-up appears: Enter a paragraph format name.

Step 5: Enter a suitable description for your graph and enter the left margin value as 2 CH.

Step 6: Now select the tab Indents and spacing: set the alignment

There are two options below. Page protection: Use this switch to determine whether to display the paragraph entirely on one
page.

Next paragraph on same page: Next paragraph switch. If set, the system displays the next paragraph on the same page as the current paragraph; the paragraphs are not separated by a page break.

Step 7: Select the tab Font to choose appropriate font, color and style.

Step 9: Select the tabs to set the set the tab spacing.

Step 10: Select the Numbering and outline" as P1 and put the left delimiter as .. If the left delimiter is not mentioned, the values would be displayed as 11, 12, 13... instead of 1.1, 1.2, 1.3

Step 11: Save and activate your Smart Style. Step 12: Now go to transaction SmartForms. Step 13: Create a Smart Form or open an existing one.

Step 14: Select the tab Output Options to mention the Smart Style to be used.

Step 15: Now go to tab General Attributes.

Step 16: Now to change the editor, click on Goto -> Change Editor

Step 17: Here enter the desired text:

Step 18: Return to the main screen of the Text. The paragraph (p1 name will be appear)

Step 19: Save and activate the Smart Form. Test & run the Smart Form.

2.6 TEXT MODULE CREATION AND USE IN SMART FORMS We use the text type Text Module of the text node to refer to an existing text module in the system. This allows you to easily use texts from one text module in several forms. In addition, it is not necessary to load the entire form description to maintain these texts. You can use text modules in two ways: Refer to the text module. The text then appears read-only in the PC editor and is included when you print the form. Copy the text module. The system then copies the text of the module and automatically converts the text node into an editable text element.

Text modules can be used across clients and are connected to the transport and translation systems. If you refer to a text module, you can use the SFSY-SUBRC system field to check at runtime, whether the text module was found in the system. Text module creation Steps: Step 1: Go to the transaction "smart forms". Step 2: Select text module and give a name for the text module example: here I am creating text module for Awaiting ticket template.

Step 3: Click on create button. Step 4: Enter a unique name for the node and a description (for example, business term).
Step 5: On the General Attributes tab select the text type Text. Step 6: Enter text which you want to add in the Smart Forms text.

Step 7: Select the URL, which you want to make as a link and click on the URL button. Step 8: To add fields select insert button.

Step 9: Give the fields within opening and closing & and click on

button.

Step 10: To select any text style (which is existing in the system) click on the reset character formatting and select the desire one. We can apply different formatting in the text paragraph/lines. Like here in the example I created "P1 URL format"," P3 justified" ,"P4 font size 10" and "P2 Bold Curior" by transaction "smartstyles".

Step 11: Save and come out. How to add text module in the Smart Forms. Step 1: Go to transaction "smart forms". Step 2: Open the Smart Forms in which you want to add text module.

Step 3: Select the text module of Smart Forms

Step 4: Choose the General tab of text module. Step 5: choose text type as Text Module.

Step 6: Give the name of the text module created example: ZAWTTKT_TXT And choose language English "EN" and press enter

Step 7: The text in the text module we created will come automatically in the text area of The Smart Forms. Any changes if we will make in the text module text, will be reflecting directly in the text is of the Smart Forms.

You might also like