Skip to Content
avatar image
Former Member

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jan 07, 2015 at 08:44 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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