Skip to Content
author's profile photo Former Member
Former Member

error in function module

Hi,

I want to create a function module which adds two numbers

n1, n2 and should get the result n3 = n1 + n2. I tried creating the FM in the following way but i got error. Kindly rectify.

In the import parameters

parameter name typing associated type

N1 TYPE I

N2 TYPE I

export parameters

N3 TYPE I

Source code

FUNCTION ZY.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(N1) TYPE I

*" VALUE(N2) TYPE I

*" EXPORTING

*" REFERENCE(N3) TYPE I

*"----


N3 = N1 + N2.

ENDFUNCTION.

regards,

mahathi

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 23, 2008 at 10:27 AM

    Hi,

    while cresting fm after providing importing and exporting parameters in the source code write logic n3 = n1 + n2

    and then call it in executable program

    regards

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 23, 2008 at 12:17 PM

    can you tell me what error you got...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2008 at 08:52 AM

    See mahati,

    jus put the flag for export parameter

    i.e.enable the checkbox for pass by value in export parameter

    this is the sample code

    REPORT ZSYAM_F1.

    parameters:a1 type i,

    a2 type i.

    data:a3 type i.

    CALL FUNCTION 'ZSYAM_FM1'

    EXPORTING

    N1 = a1

    N2 = a2

    IMPORTING

    N3 = a3

    EXCEPTIONS

    NOT_FOUND = 1

    OTHERS = 2

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    write:/ a3.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 06:04 AM

    hi,

    i also created a function module with same parameters and did not get any error.

    what error are you getting?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 06:55 AM

    Mahathi,

    I thing you might not activated your function group.

    First check with your fucntion group .

    To activate Function group.

    tcode se37 ->on menu bar "Environment" ->Inactive objects-- Function groups >select your Function group > press activate (ctrl+F8).

    Don't forget to reward if useful...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 09:10 AM

    hi there,

    do one thing activate all the object function module function group.

    just double click on the errors what you are gettinmg and just activate all the inactive object.

    chose ACTIVATE ANYWAYS

    if you get a error.

    hope this might help

    i have made a F.M to check the outcome.

    anuj

    reward point if helpful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 09:18 AM

    hi,

    this is in report:

    REPORT FMXXXX..

    parameters:op1 type i,

    op2 type i.

    data: sum type i.

    CALL FUNCTION ZFM1'

    EXPORT

    N1 = op1

    N2 = op2

    IMPORT

    N3 = sum.

    write:/ op1, '+' ,op2 , '=', sum.

    in function module what u declared as same

    try this

    reward if its useful

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.