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

passing values to function module

Former Member
0 Likes
457

Hello Everybody!

I have defined a function group ZSUB_FGROUP1 and within that, I have defined a function module ZSUB_FMOD1. I wish to pass one set of values of following types:

VBELN, POSNR, MATNR, ARKTX, KWMENG, VRKME, NETWR from VBAP

and WAERK from VBAK.

from my main report ZSUB_REP1 to ZSUB_FMOD1, which will then print those values in the form of a list. When I processed the list from within the main report, I used regular methods like top-of-page and all. But, I am not sure how to handle things from within the function module. Please help!

2 REPLIES 2
Read only

amit_khare
Active Contributor
0 Likes
391

Hi,

These values will be your Importing Parameters of the function Module and inside the Function Module write a code for the list display exactly the same as you have written in a report using these values.

First pass all the values to an internal table.

Create Field catalog.

Create Layout.

Create Header.

Create events(if require).

Call FM REUSE_ALV_LIST_DISPLAY.

Catch exceptions and return it as exporting parameters.

Regards,

Amit

Reward all helpful replies.

Read only

Former Member
0 Likes
391

Hi...

When u create the function module , we generally provide the import and export parameters....

<b>Import parameters :</b> Which we pass to the function module ..

<b>Export parameters:</b> Which we receive from the function module...

<b>Tables parameters:</b> Tables to pass and to receive to and from the function module...

<b>Changing Parameters:</b> Which we pass to the function module and change these values in the function module and receive those from function module...

So define the fields

VBELN, POSNR, MATNR, ARKTX, KWMENG, VRKME, NETWR ,WAERK in the import parameters with LIKE declaration and corresponding type..

<b><u>Field || Type || Associated Type || Optional || Default ||</u></b>

vbeln || like || vbak-vbeln ||

<b>Optional : </b>If u check this then this field is not mandatory to receive the value..

If uncheck then we have to pass value to this field from the program !! otherwise it gives an error.

In the <b><u>source code</u></b> tab u can write the list output related code with these imported and exported parameters !!

To call the function module we use<b> PATTERN </b>which is present on the application tool bar of the SE38-Editor screen..

Click on this .. u will get a popup ..IN this check the <b>CALL FUNCTION</b> and in the input field of this,, give the function module name... and press enter ...Here u can give values for these imported fields...

reward if it helps u...

sai ramesh