function module

 

Create function module.

      *  First create function group in se80. Give name and create and activate the function group.

        *  Goto se37

        *  Give name starts with z/y.

        *  ZAJAY_OPERATIONS.

        * Import means input parameters

                    



                * Export means output parameters.

                                


                *  Then source code means performs operations.

                                    


Calling function module through program.

    REPORT ZAJAY_OPEATION.

    PARAMETERS: P_a type i,
            p_b type i.
    data: v_sum type i,
          v_sub type i.
    CALL FUNCTION 'ZAJAY_OPERATIONS'
      EXPORTING
       V_A           = p_a
        v_b           = p_b
     IMPORTING
       V_C           = v_sum
       V_D           = v_sub.

   write: / 'addition of',P_a ,'and',p_b ,'is :' ,v_sum.
   write: / 'subtraction of',P_a,'and',p_b,'is :' ,v_sub.


Input


Output


                            







Calling function module through program


    REPORT ZAJAY_FM.

    PARAMETERS: P_a type i,
            p_b type i.
    data: v_sum type i,
          v_sub type i,
          v_mul type i,
           v_div type i.

    CALL FUNCTION 'ZAJAY_OPERATIONS1'
      EXPORTING
        v_a           = P_a
        v_b           = P_b
     IMPORTING
       V_SUM         = V_sum
       V_SUB         = V_sub
       V_MUL         = V_mul
       V_DIV         = V_div.

   write: / 'addition of',P_a ,'and',p_b ,'is :' ,v_sum .
   write: / 'subtraction of',P_a,'and',p_b,'is :' ,v_sub .
   write:  / 'mutiply of' , P_a , 'and', p_b ,'is :' ,v_mul .
   write:  / 'divison of' , P_a , 'and', p_b ,'is :' ,v_div .

Comments

Popular posts from this blog

Custom entity/Action dialog in RAP using Unmanaged scenario

New syntax for append- VALUE (new syntax 7.4+) in ABAP

Read statement new syntax in ABAP. (7.4+).