Академический Документы
Профессиональный Документы
Культура Документы
2005 SAP AG
Template,Table,Loop,Command in Smartform
Applies To:
SAP 4.6C - Smartforms
Summary
This document explains how to use Table, Template, Loop, and Command to display the set of records in Smartforms. By: J.Jayanthi Company: Wipro Technologies Date: 22.08.2005
Table of Contents
Applies To:........................................................................................................................................2 Summary ..........................................................................................................................................2 Table of Contents .............................................................................................................................2 Procedure .........................................................................................................................................2 Template....................................................................................................................................4 Command ..................................................................................................................................5 Loop...........................................................................................................................................5 Table..........................................................................................................................................6 Code Sample..7 Output Screen: Template .................................................................................................................8 Output Screen: Loop ........................................................................................................................9 Output Screen:Table ........................................................................................................................9 Author Bio.10
2005 SAP AG
Template,Table,Loop,Command in Smartform
Procedure
1. Go to transaction SMARTFORMS. 2. Create a Form (say zzz_test1). 3. In Global Definitions->Global Data, 4. Variable Name ZZZ_MAKT ITAB WA Type Assignment TYPE Reference Type ZZZ_MAKT
2005 SAP AG
Template,Table,Loop,Command in Smartform
6. Then right click Main window and create Program line. 7. In Code, give ZZZ_MAKT as input parameter and itab as output parameter. 8. Write the following in the coding part. select * from zzz_makt into table itab.
Template
1. Right click Code and create a Loop. 2. In its Data tab, Internal Table ITAB into wa
2005 SAP AG
Template,Table,Loop,Command in Smartform
3. Right Click the Loop and Create a Template. In that, design the Template as shown below by selecting Pattern to display Output.
4. Create three text elements (say Text2, Text4, Text3). 5. Drag ZMATNR, ZMAKTX and PICK from the Field list and put in the above mentioned Text Elements-> General Attributes respectively. 6. In Text2->Output Options , make the Line and Column as 1 and 1 respectively. 7. In Text4->Output Options , make the Line and Column as 1 and 2 respectively.
2005 SAP AG
Template,Table,Loop,Command in Smartform
8. In Text3->Output Options , make the Line and Column as 1 and 3 respectively.
Command
1. Right Click the Loop and create a Command (say %COMMAND2). Make the Command after Template (move accordingly). We are making use of Command to page break. 2. In Command->General Attributes, check mark Go to new page and give the page no. (say %PAGE). 3. Then right Click the %CODE1 and create another loop and move it after %COMMAND2.
Loop
1. In Loop->Data, Internal table itab into wa. The settings of Loop->Output options is shown below [Since in the output, we are going to display a box with border].
2005 SAP AG
Template,Table,Loop,Command in Smartform
2. Create a text element (say %TEXT1) under that Loop and design the Text->General Attributes as below.
2005 SAP AG
Template,Table,Loop,Command in Smartform
3. Create a Command (say %Command1) under %Loop1 and do as we did before for %Command2.
Table
1. Right click %Code1 and Create a Table [say %Table1]. 2. Design Table->Table tab as below.
2005 SAP AG
Template,Table,Loop,Command in Smartform
3. In Table->Data, Internal table itab into wa. 4. Create three Text Element by right clicking %Table1 [say %CELL1, %CELL2, %CELL3]. 5. Drag ZMATNR, ZMAKTX, PICK from fieldlist and put in the created text elements. 6. In CELL1->Output Options, 7. Check mark New Line and New Cell and choose the Line type as Line1 which we created in Table>Table. 8. For CELL2 and CELL3, check mark New Cell in Output options.
2005 SAP AG
Template,Table,Loop,Command in Smartform
Code Sample
REPORT zzz_jaytest3 . * Variable Declaration data : v_form_name TYPE rs38l_fnam. call function 'SSF_FUNCTION_MODULE_NAME' exporting formname = 'ZZZ_TEST1' importing fm_name = v_form_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 v_form_name 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.
2005 SAP AG
10
Template,Table,Loop,Command in Smartform
2005 SAP AG
11
Template,Table,Loop,Command in Smartform
2005 SAP AG
12
Template,Table,Loop,Command in Smartform
Author Bio
J.Jayanthi works as Senior Software Engineer at Wipro Technologies.
2005 SAP AG
13