Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP Report generating runtime error

Former Member
0 Likes
1,191

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

6 REPLIES 6
Read only

Former Member
0 Likes
895

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.

Read only

viquar_iqbal
Active Contributor
0 Likes
895

Hi

You can refer to this document for information on function module

http://help.sap.com/saphelp_nw70/helpdata/EN/9f/db988735c111d1829f0000e829fbfe/frameset.htm

Read only

Former Member
0 Likes
895

hi Kaushik Banerjee ,

refer thread :

it will solve your problem

regards

rahul

Read only

Former Member
0 Likes
895

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

Read only

Former Member
0 Likes
895

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..

Read only

brian_basch
Participant
0 Likes
895

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