Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 23

http://www.doc2pdf.

net/

This smart form can be used to calculate salary with range of employee numbers.

Step 1:

In se11 create a table just like mentioned below.

Create a table like this..

Amrutha_prabhu2000@yahoo.com 21/12/2010
Step 2:

Click on currency quantity fields and mention reference table and reference fields.

Amrutha_prabhu2000@yahoo.com 21/12/2010
Step 3: this is the contents of the table after entries.

Make sure entries are like this

Amrutha_prabhu2000@yahoo.com 21/12/2010
Step 4: In se11 create the structure selecting datatypes radiobutton just like below.

Amrutha_prabhu2000@yahoo.com 21/12/2010
Step 5: goto transaction smartforms:

Create smartforms and insert in page logo of your choice.

Then create table and divide the line according to how many fields you are calling in the output screen.

Here we have divided the first line in to 3 colums.

Step 6: right click on the header and create table line and specify the line type1.

For the main also create table line and give line type which is given to the header.

Hence we get 3 colums for header as well as for the main area.

For each cell in the header give the heading of the fields.

Now create line type 2 with single cell which will be used to display the calculations.

Just right clicl on the line1 and insert line underneth.

Amrutha_prabhu2000@yahoo.com 21/12/2010
Left sub tree structure in smartforms shd look like this.

Step 6: Double click on table and give the looping condition

Amrutha_prabhu2000@yahoo.com 21/12/2010
Loop at itab into wa

Amrutha_prabhu2000@yahoo.com 21/12/2010
Ctrl+shift+f4 you will get the list of fields available after the declaration.

Amrutha_prabhu2000@yahoo.com 21/12/2010
Just drag and drop each field you want from workarea declared in global interface.

Amrutha_prabhu2000@yahoo.com 21/12/2010
Step 7: Double click on form interface and in tables tab mention the following.

Note: ZSELOPT is the structure created for select options in data dictionary.

In form interface enter this.

Amrutha_prabhu2000@yahoo.com 21/12/2010
Step 8: double click on global definitions.

In global data specify internal table and work area refering to the structure.

In global interface goto global data and enter this.

Amrutha_prabhu2000@yahoo.com 21/12/2010
Step 9: In the types tab create types_table as mentioned below.

Note: we are referring the fields of the table.

Enter this in types tab.

Amrutha_prabhu2000@yahoo.com 21/12/2010
Step 10: In initialization write a select query and give input output parameters like this.

Initialize the smartform.

Amrutha_prabhu2000@yahoo.com 21/12/2010
Step 11: In the main area create one more table line and assingn it to line type line2. As a result you will
get a single cell, here create a program line by right clicking on the cell.

Now Specify the following calculation in the code.

Code for calculation.

Amrutha_prabhu2000@yahoo.com 21/12/2010
Step 12: Now create a text after the code and drag and drop the fields to be displayed after calculation.

Text to get the total.

Now we are done with the smartform which genertates salary slip. Save and activate. And execute the
smart form.

Amrutha_prabhu2000@yahoo.com 21/12/2010
You get a function madule generated for smartform note the function module and again click on
execute button.

Amrutha_prabhu2000@yahoo.com 21/12/2010
In this screen double click on the button 0entries corresponding to PID.

Amrutha_prabhu2000@yahoo.com 21/12/2010
You get this screen where you have to specify the range .

I = INTEGER.

BT = BETWEEN.

LOW =LEFT VALUE.

HIGH = RIGHT VALUE.

Note: the values you give should be the same order of the contents in the table. (not 100, 00000000100)

Amrutha_prabhu2000@yahoo.com 21/12/2010
Smartforms output.

Other calculations for salary include so many other fields in the table, this
was just an example.Here you can say wa-earnings,wa-deduction and wa-net as
output fields and the rest as input firlds.

The complete code for salary:

WA-EARNINGS = WA-BASIC + WA-LA + WA-TA + WA-DA + WA-HRA .

WA-DEDUCTION = WA-PT + WA-LOP + WA-IT +WA-TDS.

WA-NET = WA-EARNINGS – WA-DEDUCTION.

LA = LUNCH ALLOWANCE.

TA = TRAVEL ALLOWANCE.

Amrutha_prabhu2000@yahoo.com 21/12/2010
DA = DEARNESS ALLOWANCE.

HRA = HOUSE RENT ALLOWANCE.

PT = PROFESSIONAL TAX.

LOP = LOSS OF PAY.

IT = INCOME TAX.

ALL THE WORK AREA FIELDS MENTIONED SHOULD BE CREATED UNDER CURRENCY FIELD IN
THE SAME WAY AS OTHER FIELDS IN THE TABLE.

Driver program to run smartform

*&---------------------------------------------------------------------*
*& Report  ZSMART
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZSMART.
tables: ZEMP_EXP_DETAILS.
select-options: PID for ZEMP_EXP_DETAILS-empid.
  data: fm_name type rs38l_fnam.

  start-of-selection.

Amrutha_prabhu2000@yahoo.com 21/12/2010
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      FORMNAME                 = 'ZSMART_CALCULATIONS'

   IMPORTING
     FM_NAME                  =  FM_NAME
   EXCEPTIONS
     NO_FORM                  = 1
     NO_FUNCTION_MODULE       = 2.

 CALL FUNCTION '/1BCDWB/SF00000428'
*  EXPORTING
*    ARCHIVE_INDEX              =
*    ARCHIVE_INDEX_TAB          =
*    ARCHIVE_PARAMETERS         =
*    CONTROL_PARAMETERS         =
*    MAIL_APPL_OBJ              =
*    MAIL_RECIPIENT             =
*    MAIL_SENDER                =
*    OUTPUT_OPTIONS             =
*    USER_SETTINGS              = 'X'
*  IMPORTING
*    DOCUMENT_OUTPUT_INFO       =
*    JOB_OUTPUT_INFO            =
*    JOB_OUTPUT_OPTIONS         =
   TABLES
     PID                        = PID
*  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.

Entries should match the order of the data entered in the database.

Amrutha_prabhu2000@yahoo.com 21/12/2010
Amrutha_prabhu2000@yahoo.com 21/12/2010
Output from the driver program.

Amrutha_prabhu2000@yahoo.com 21/12/2010

You might also like