Application Development 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: 

Importing the internal into functional module and exporting the same from the functional module.

Former Member
0 Kudos

I have  internal table "itabfinal" with fields "pernr, werks, btrtl, plan, ansal, Persk".

now i need to pass "itabfinal" into the functional module and get back the all of "itabfinal"  field from the function module into the program.

for this i am creating the funtional module " ZFM1"


inside the functional module i have given the import as "itab1-type-table"

inside the functional module i have given the export as "itab2-type-table".

inside the functional module i have given the changing  as "itab3-type-table"

inside the functional module i have given the Table as "itab4-type-ZFM1_STRU_T"

where "ZFM1_STRU_T" is the table type with reference to itabfinal.

in my program i am calling the functional module as below.

CALL FUNCTION 'ZFM1'


   EXPORTING

     itab1         = itabfinal


  IMPORTING

    ITAB2         = itab4


   changing

     itab3         = itab4.

But in functional module i had given the code as below :

FUNCTION zfm1.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(ITAB1) TYPE  TABLE

*"  EXPORTING

*"     REFERENCE(ITAB2) TYPE  TABLE

*"  TABLES

*"      ITAB4 TYPE  ZFM1_STRU_T

*"  CHANGING

*"     REFERENCE(ITAB3) TYPE  TABLE

*"----------------------------------------------------------------------

data: wa type ZFM1_STRU.

clear wa.

loop at itab1 into wa.

move wa to itab4.

   modify itab4.

   endloop.

ENDFUNCTION.

please help me to get the itabfinal into the program using above funtional module

5 REPLIES 5

Former Member
0 Kudos

You don't need importing and exporting if they are of same type. You can just create the FM using changing. Any change in the changing parameters will be reflected back once it comes out of FM.

0 Kudos

Hi Adithya can u please help me with the basic example or tell me the what is the source code to be written if you use only changin option in the fm.

0 Kudos

Hi Vishnu,

No code is required if you use CHANGING parameter. It will remain same. If you want to change content of your internal table then you can use statement like APPEND, MODIFY, INSERT to change content of your internal table.

Regards,

Sid

0 Kudos

Thanks once again  adihtya,

inside the functional module i have given the changing  as "itab3-type-table"



and no source code given.



But now in the program i am calling the functional module.so how i need to call it exactly?


I had given like this please tell me we can do it or not


CALL FUNCTION 'ZFM1'

   CHANGING

     itab2         = itabfinal.


I have a doubt with out exporting the itabfinal inside the functional module how we can use the change option?

0 Kudos

Hi Vishnu,

In changing parameter you can pass the internal table to function module and if you do any changes on the same internal table in function module, then after execution same changes will reflect in calling program.

Many Thanks / Himanshu Gupta