‎2009 Feb 12 12:28 PM
Hi,
I have written a ABAP Report.
It is calling a function module.
But there is runtime error.
I don't know the ABAP Syntax.
I need a document telling me how to write Function Module'
in ABAP.
*&---------------------------------------------------------------------*
*& Report ZKB_ADD_VALUE1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZKB_ADD_VALUE1.
DATA NUM7 TYPE ZADD_VALUES-NUM1.
DATA NUM8 TYPE ZADD_VALUES-NUM2.
DATA NUM9 TYPE ZADD_VALUES-NUM1.
DATA NUM10 TYPE ZADD_VALUES-NUM2.
NUM7 = 6.
NUM8 = 9.
CALL FUNCTION 'ZADD_VALUE'
EXPORTING
NUM1 = NUM9
NUM2 = NUM10
IMPORTING
NUM3 = NUM7
NUM4 = NUM8.
WRITE: NUM10.FUNCTION ZADD_VALUE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(NUM1) LIKE ZADD_VALUES1-NUM1
*" VALUE(NUM2) LIKE ZADD_VALUES1-NUM2
*" EXPORTING
*" VALUE(NUM3) LIKE ZADD_VALUES1-NUM1
*" VALUE(NUM4) LIKE ZADD_VALUES1-NUM2
*"----------------------------------------------------------------------
DATA:
FS_TABLE TYPE ZADD_VALUES1.
FS_TABLE-NUM1 = NUM3.
FS_TABLE-NUM2 = NUM4.
INSERT ZADD_VALUES1 FROM FS_TABLE.
.
ENDFUNCTION.Regards
Kaushik Banerjee
‎2009 Feb 12 12:31 PM
Hi,
In program u have num7,num8 for which u have values and these u need to pass to functionmodule,
so export these to function module( in function module these will be imported,and changes )
In exporting, pass num7,num8
In importing give num9,num10.
This works.
‎2009 Feb 12 12:35 PM
Hi
You can refer to this document for information on function module
http://help.sap.com/saphelp_nw70/helpdata/EN/9f/db988735c111d1829f0000e829fbfe/frameset.htm
‎2009 Feb 12 12:38 PM
‎2009 Feb 12 12:48 PM
Hi,
The Possibilities for runtime error could be:
1) Datatype of the Parameters passed to Function moduel did not match or are not compatiable.
Or
2) May be because of the insert statement.
check these two.
HOpe issue resolves.
Regards,
Gurpreet
‎2009 Feb 12 12:59 PM
please use that start of selection after the data declaration ....
i think it will working .. or else please give the error at which one is giving the runtime error..
‎2009 Feb 12 2:07 PM
Hi,
Hopefully, you are using transaction SE80. Follow the menu path Program->Check->Extended program Check. Make sure that "CALL FUNCTION interfaces" is selected - I normally select everything except "character strings" - and execute. This will give you a list of errors and warnings, including if you are calling your function module correctly. You can then double-click on the lines in the report and see the error messages.
If you're unfamilar with writing function modules, please see place the cursor on the "CALL FUNCTION" statement and press F1. This should bring up the help for that statement. On my screen, it shows the help for the ABAP language on the left side. You can then read about function modules.
Hope this helps,
Brian Basch