How to Convert Sapscript to Smartform?
Migration to Smartform
If you have many forms already built in SAPscript, you may migrate them into Smart Forms to avoid building the Smart Forms from scratch and save development time. Two types of migration are available: individual migration and mass migration. You can migrate a SAPscript form into a Smart Form and convert a SAPscript style into a Smart Style.
Smart Styles contain the formatting information for the text. In Smart Style, you take the smaller components (paragraph and character formats) for conversion individually, whereas for Smart Forms, you take the entire Smart Form for conversion. Each conversion of a Smart Form requires a separate conversion of the accompanying Smart Style; some of the steps, however, are the same. The first phase of the migration is the download. Use program RSTXSCRP to download SAPscripts to your local hard disk
Simply select the object, based on Form, Style, Standard Text, or Device Type. You may EXPORT to download to the local drive and IMPORT to upload a SAPscript into the system.
You can also specify file selection from your desktop or from a server.
(Note: When you convert a SAPscript style into a Smart Style, the system converts all paragraphs and character formats with all their properties and attributes intact. Therefore, you can use the converted Smart Style without making any adjustments.)
When migrating a SAPscript form into a Smart Form or Smart Style, the system executes the following steps:
1. Copies the language attributes and the output options
2. Migrates the layout information including pages and windows, as well as their attributes and positions on the page
3. Copies the texts in the form
4. Displays the fields (SAPscript notation: program symbols) in the texts
5. Converts the SAPscript commands (such as NEW-PAGE or IF...ENDIF) to comment lines and displays them in the texts
Repeat the above steps for the Smart Style accompanying the form.
The second phase of migration is conversion. Though the download phase (step 1) is the same, conversion for Smart Styles must be done differently than conversion for Smart Forms. I explain steps for Smart Styles later.
For converting forms, you have a template that you can enhance and modify according to your needs. Adapt the form logic by specifying the commands that the system converted to comment lines. The work involved is similar to any form development; each element, window, page, text, logo spacing, and data mapping has to be validated, but the conversion tool makes it easier. Follow these steps for SAPscript form conversion:
Step 1. Access the initial screen. Choose Tools>Forms printout>Smart Forms (transaction SMARTFORMS) from the SAP Easy Access Menu. The dialog window SAP Smart Forms: Initial Screen appears.
Step 2. Name the form. In the Form Field, enter field name you want to give, for example ZTF_GR_## (based on your company standard starting with Z to identify this as a customized form, where “##” is the group number).
Step 3. Access the migrate function. Go to Utilities>Migrate SAPscript Form. In the dialogue window enter the SAPscript form name, for example Y_SAPSCRIPT_STD. Choose the Check button.
Step 4. View the migrated layout. On the screen that appears, the SAPscript form is migrated into a rough Smart Form (Figure 2). Click on Form Painter to see an overview of the form layout.
SMARTFORMS transaction for form development or conversion from SAPscript
Use the following steps for mass migration or simultaneous migration of multiple SAPscript forms:
Step 1. Run the mass migration program. In Reporting (transaction SE38), select the program SF_MIGRATE and execute it (Figure 3). Select the names and the language of the SAPscript forms and click the execute icon. The system creates the Smart Forms named for the SAPscript forms plus the extension SF. It displays a list of the migrated forms.
Mass-migrating Smart Forms from a range selection
Step 2. Make changes (if necessary). To change and adapt a form, go to transaction SMARTFORMS. Then activate the changed Smart Form.
The following are the unique conversion steps for Smart Styles. Note that mass migration is not possible, as each Smart Style is attached to a specific Smart Form and conversion must be done individually. For migrating a SAPscript style into Smart Styles, the steps are:
Step 1. Open Smart Styles. Go to the Smart Styles initial screen (transaction SMARTSTYLES; see Figure 4).
Transaction SMARTSTYLES for creating styles or converting from SAPscript
Name the style. In the Style field, enter the name of the Smart Style you want to create.
Run the program. Choose Smart Styles Convert SAPscript style. Enter the name of the SAPscript style you want to convert. Press Enter. A list of the converted styles appears.
Make adjustments to the style (if necessary). Choose Back. You can now change the Smart Style (using Change). To activate the Smart Style, choose Activate.
Once the SAPscripts are converted, whether in Smart Forms or Smart Styles, you should clean up any errors made during the conversion process, in terms of attributes, window alignment, or syntax errors. Cleaning up errors during conversion is often standard procedure, as SAPscript might have used local logic. Errors may occur when a field displayed is extracted or manipulated to display and doesn’t exist, or fields exist but appear with no values. Errors may also arise in ABAP syntax.
Use Form Interface within Global Settings for clean-up
Step 2. On the Import Tab, enter the import structure information. For example, enter Parameter Name (table name, such as LIKP), Type Assignment: Type, Reference Type (table name), Optional (or Mandatory); Pass Val: (Passing value indicator). This must be done for all the data retrieved from the SAP tables.
Step 3. Remove irrelevant or unnecessary windows. To delete a navigational menu node, right-click on the node, and select Delete. Since you start with windows in SAPscript, there might be redundant windows created for text.
Step 4. Set the first page. Delete the NEXT page node on the menu tree. Double-click on the first page node. In the General Attributes tab, change the Next Page value to FIRST.
Step 5. Delete the DETAIL frame window. Expand the MAIN window and delete all its text nodes.
Step 6. Adjust the text nodes. Click on the text nodes and let the system fit the text.
Step 7. Save and check the syntax.
Smart Forms allows you to customize the newly migrated forms and styles, adding images, headers, templates, and standard text.
To insert the company logo (or any image):
Step 1. Open the Form Painter for graphics (Figure 6). Select the Form Painter button. Click the LOGO window in Form Painter. Right-click and choose Create>Graphics.
Figure 6: Form Painter with graphics insertion
Step 2. Insert the logo or image. In the maintenance screen of the node (the center of the frame) under the General attributes tab, enter the company logo or other image as Graphic Image, Graphics as Object type, and bmap as ID. Choose the grid screen color and press Enter. You can position the logo as you wish.
To import standard text for addresses and other purposes:
Step 2. Prepare the new text node. On your new text node under INFO1, in the Maintenance frame, on the General Attributes node, change the Text Type to Include text. Select OK on the popup menu.
Step 3. Set the text attributes. Under Text Name, enter the name of the form. For Text Object, enter text. For Text ID, enter ST. For Language, enter WN.
Check the checkbox for No error when no text exists.
To create a template for your header and line items:
Step 1. Insert the company logo (or any image). Right-click on the MAIN window node and select Template (Figure 8).
Use menu path Form Painter>Create>Template.
Step 2. Click on your new Template node. The attributes associated with your new template will appear.
Step 3. In the tab labeled Template, enter the following:
1. In the column Name, enter Line1. This will be the first row in your template.
2. Click on the Table Painter button. Click on the Pattern button and select the pattern on the upper left hand side of the pop-up window.
Step 1. Save and activate your form. Select Activate (Figure 9).
Step 3. Execute. When the Function Module screen comes up, click on the Execute button or press the F8 key again.
Step 4. Preview the document. On the Print pop-up menu, click on the Print Preview button. Your new form will appear.
Step 5. Return to Form Builder. Close the print preview and press the Back key until you return to the Smart Form Builder screen.