0% found this document useful (0 votes)
182 views

Passing Select-Options To Smart Forms: by Venkat

This document provides step-by-step instructions for creating a smart form in SAP. It describes: 1. Creating the basic structure of the form, including defining import parameters, global definitions, internal tables, and page formatting. 2. Adding graphical elements like logos and setting their properties. 3. Creating windows, program lines, and addresses to fetch and display company data. 4. Using sections, templates, and tables to loop through order items and display purchase orders, line items, quantities, and totals. 5. Adding calculations to compute amounts, subtotals, and grand totals from order details.

Uploaded by

sudhakp
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
182 views

Passing Select-Options To Smart Forms: by Venkat

This document provides step-by-step instructions for creating a smart form in SAP. It describes: 1. Creating the basic structure of the form, including defining import parameters, global definitions, internal tables, and page formatting. 2. Adding graphical elements like logos and setting their properties. 3. Creating windows, program lines, and addresses to fetch and display company data. 4. Using sections, templates, and tables to loop through order items and display purchase orders, line items, quantities, and totals. 5. Adding calculations to compute amounts, subtotals, and grand totals from order details.

Uploaded by

sudhakp
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 43

http://www.saptechnical.com/Tutorials/Smartforms/SelectOptions/Demo.

htm

Passing Select-Options to Smart Forms


By Venkat

Step1: Create a Structure ZSELECTION in SE11 with following fields.

This structure is similar to the selection-option internal table. Step2: In smart form ZSELECT_FORM, create an entry in to TABLES in the Form Interface.

Step3: Define Structures in TYPES tabs in GLOBAL DEFINITIONS.

Step4: In Global Data,

Step5: In program line, write the following code.

Step6: The PERNRS given in the select-option in the driver program is captured in T_SELECT. In program lines, T_SELECT is input to SELECT query and the results are captured in internal table T_0002. We have to mention resulted internal table T_0002 in output parameters for further use.

Step7: Now, loop the internal table T_0002 as shown below.

Step8: Create driver program ZSELECT_FORM_REP. Write the following code in report.

Step9: Execute the driver program.

Step-by-step approach in creating a PO Layout using Smart Forms


By Nageshwar, Satyam Computers

Smart Forms: Transaction Code for Create Smart Forms: SMARTFORMS Transaction Code for Create Styles (Paragraph Formats, Character Formats, etc.,) Used in Smart Forms: SMARTSTYLES Steps to be followed while creating Smart Forms:

1.

Enter

the

Form

Name

(e.x.

ZEKKO_EKPO)

and

Press

Create

Button.

2.

Enter Form Description and Select the Output options Tab Enter the Page Format (e.x. DINA4) and Style (e.x.SF_STYLE_01).

3. 4.

Double click the Form interface Left Sub-tree. Enter the Import Parameters (The values that passed from the Print Program into the Form) (e.x. Company Code) Parameter name Pass value Type assignment Reference type Default value

COMPANY_CODE

TYPE

EKKO-BUKRS

5.

Double click the Global definitions from the Left Sub-tree. Assume that we are using two tables EKKO and EKPO in this example:

6. 7.

Click the Types Tab. Enter the Code as following:

8.

Click the Global data Tab. Declare the Internal Tables and Work Areas as follows:

9.

Double click the %PAGE1 New Page in the Left Sub-tree.

10. 11.

Change the %PAGE1 to FIRST or any name and Enter the Description (e.x. First Page). Select the Next Page as FIRST

12.

Select the Output options Tab and select the format of the page (Portrait or Landscape) and all other print attributes.

13.

Select the Background Picture Tab, and Enter the Name, Object and Id of the image file. (Before this step, go to SE78 and import the image first) for the Image which has to be appeared in the Background of the Script. If you want to add any LOGO in the First Page of the Script then right click the FIRST New Page in the Left Sub-tree from the Menu option Create select the Graphic.

14.

15. 16.

Double click the %Graphic1 New Graphic 1 in the Left Sub-tree. Give the Name and Description (e.x. Graphic = COMP_LOGO and Description = LOGO WINDOW)for the New Graphic Inserted. Enter Name, Object and ID for the Graphic image and Select the Color grid screen (BCOL) option button in the General attributes Tab.

17.

Click - Output options Tab. Set Left and Upper Margins as given:

18.

Right click the FIRST New Page in the Left Sub-tree and from the Menu option Create select the Window.

Double click the %WINDOW1 New Window1 in the Left Sub-tree and enter the Window name and Description (e.x. Window = ADD_WIN and Description = Address Window)

Set the Left and Upper margins for the ADD_WIN as follows:

19.

Right click ADD_WIN Address Window in Left Sub-tree and from the Menu option Create select the Program Lines.

20.

Enter the Program Lines name and description (e.x. Program Lines = ADD_FETCH and Description = FETCHING COMPANY ADDRESS)

21.

Enter the Input Parameter as COMPANY_CODE and Export Parameter as V_ADRNR in the General attributes Tab and write the select query as following: SELECT SINGLE ADRNR INTO V_ADRNR FROM T001 WHERE BUKRS EQ COMPANY_CODE.

(Note: Before writing the select query first declare the Variable V_ADRNR in the Global definitions area as follows: V_ADRNR TYPE T001-ADRNR.

22.

Right click the ADD_WIN Address Window in the Left Sub-tree and from the Menu option Create select the Address.

23.

Double click the %ADDRESS1 New address1 and change the Address name and description (e.x. Address = COMP_ADD and Description = COMPANY ADDRESS).

24.

Select the Type of the address in the General attributes Tab. (Since we are retrieving the Organization address, we selected the first radio button) and in the Address number text box pass the V_ADRNR Variable as &V_ADRNR&. Set the Main window attributes like this: (Setting of window co-ordinates)

25.

26.

Right click the MAIN Main Window in the Left Sub-tree and from the Menu option Create select the Program Lines.

27.

Enter the name and description (e.x. Program Lines = SELECT_RECORD and Description = SELECTING RECORDS).

28.

Enter the Input Parameter as COMPANY_CODE and Output Parameter as I_EKKO and I_EKPO in the General attributes Tab and write the select query as following:
SELECT EBELN BUKRS INTO TABLE I_EKKO FROM EKKO UP TO 10 ROWS WHERE BUKRS EQ COMPANY_CODE.

IF SY-SUBRC EQ 0. SORT I_EKKO BY EBELN. SELECT EBELN EBELP MENGE NETPR INTO TABLE I_EKPO FROM EKPO FOR ALL ENTRIES IN I_EKKO WHERE EBELN EQ I_EKKO-EBELN. IF SY-SUBRC EQ 0. SORT I_EKPO BY EBELN EBELP. ENDIF. ENDIF.

29.

Right click MAIN Main Window in the Left Sub-tree and from the Menu option Create select the Complex Section.

30.

Enter the Section name and description (e.x. Section = PO_LOOP and Description = PURCHASE ORDER NUMBER LOOP) and check the Repeat processing check box and select the Output type as Unstructured (i.e. select the Unstructured radio button) in the General attributes Tab.

31. 32.

Select the Data Tab. Enter the Internal Table Name as I_EKKO and Work area name as WA_EKKO and sort by the BUKRS and EBELN fields.

33.

Right click PO_LOOP PURCHASE ORDER NUMBER LOOP in Left Sub-tree and from the Menu option Create select the Text.

34.

Enter the Text name and description (e.x. Text = PO_NO_DISPLAY and Description = PURCHASE ORDER NUMBER DISPLAY) and enter the values as in the screen shot

Click the Text Editor

Display the values of Company Code and Purchase Order Number as shown below:

Press Back Button, then Press Save and Check Buttons

35.

Right click the PO_LOOP PURCHASE ORDER NUMBER LOOP in the Left Sub-tree and from the Menu option Create select the Template.

36.

Double click on %TEMPLATE1 New template and enter the Template name and description (e.x. Template Name = OI_HEAD and Description = ORDER ITEM HEADER).

Before press save or enter click the Table Painter Button which will take you to following screen. To avoid the cross line in the Editor click the Settings Button

which will result in the following popup, in which you un-check the Cross Check Box and press enter.

37.

Split the Cell into Four or into any number of columns you want to display in the script by right clicking the %C1. and press Back Button.

38.

Select the cv cv of the table to be displayed in the script by the clicking Select pattern Button

Selected table pattern 39. 40. Inorder to Display the Column Text for the table columns, insert the Text as shown below: Right click the OI_HEAD ORDER ITEM HEADER and from the Menu path Create Select the Text .

41.

Enter the Text name and description (e.x. Text = HEAD1 and Description = COLUMN1) and enter the values as in the screen shot (i.e. as explained in the point no 34).

42.

In order to match the Template Column with the inserted Text HEAD1 COLUMN1, select the Output options Tab and Enter the Line Number and Column Number in which the above Text has to be printed in the form

Repeat Step No.40 & 41 for all the remaining column headings.

43.

The Form is ready with all data upto Table Header. Inorder to populate data under each column header, insert a table. Insert the Table under PO_LOOP PURCHASE ORDER NUMBER LOOP by right clicking the same.

44.

45.

Enter Table Name and Description (e.x. Table Name = OI_DISPLAY and Description = ORDER ITEM DISPLAY)

46.

Match the column width with the OI_HEAD ORDER ITEM HEADER Template (refer step no 38 screet shot no 2) and Select the Default radio button and No page break check box. Click the Select pattern push button to select the table pattern to be displayed.

47.

Click the Data and populate the Item details by looping the Internal Table I_EKPO into the Work Area WA_EKPO sorted by EBELN and EBELP as shown in the following screen shot

48.

Inorder to Display the values for each column, we have to Insert Separate Text for each column under the Table OI_DISPLAY ORDER ITEM DISPLAY by Right clicking the same. Enter the Name and Description for the Each Text Inserted under the Table.

Column 1 for Line Item of each Purchase Order Populate the values for each column as explained in the step no 34.

Inorder to Match the Item values with the Template Header, In the Inserted Text ORD_ITM_COL COLUMN1 Click the Output options and Select the New line Check box and Select the Line type as Detail and also check the New cell Check box.

49.

Similarly add one Text for the remaining columns.

For the Third Column Text also You need only to select the New cell Check box.

50.

Before Inserting the 4 Text for the 4 Column, we have to calculate the Amount by Multiplying the Quantity and Unit Price and for the same we have to insert Program Lines by Right clicking OI_DISPLAY ORDER ITEM DISPLAY

th

th

51.

Similarly calculate the subtotal by adding the totals and calculate the grand total by adding the subtotals. Before doing the calculations, declare variables for total, subtotal and grand total in Global definitions.

InputParameters: WA_EKPO-MENGE,WA_EKPO-NETPR V_TOTAL,V_SUBTOTAL, V_GRDTOTAL.

&

OutputParameters:

52.

Now add the 4 Text to display the 4 column in the Form.

th

th

For the Fourth Column Text also You need only to select the New cell Check box.

53.

In order to display the Subtotals (which has been created earlier i.e. refer to step no 52) of all the Line Items for each Purchase Order, we have to Insert a separate Text Under the Table OI_DISPLAY ORDER ITEM DISPLAY by right clicking the same.

54.

Enter the Name and Description for the Inserted Text (e.x. Text = SUB_TOTAL_DISPLAY and Description = SUB_TOTAL_DISPLAY and populated the value for subtotal.

55.

After each purchase order, the Variable V_SUBTOTAL has to be refreshed, In order the clear the subtotal variable we have to insert Program Lines by right clicking the OI_DISPLAY ORDER ITEM DISPLAY.

56.

Enter Name and Description for the Program Lines (%CODE1 New program lines 1) Inserted (e.x. Program lines = CLR_VAR and Description = CLEAR SUBTOTAL VARIABLE. Input parameters = V_SUBTOTAL. Clear the variable as shown below:

57.

Now, we have to display the Grand Total (i.e. summation of all the subtotals). Insert Text under the PO_LOOP PURCHASE ORDER NUMBER LOOP by right clicking the same.

Text %TEXT1 New text1 gets inserted. Now enter the name and description for the same and also populated the value for grand total

You might also like