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

Exporting int table in a function module

Former Member
0 Likes
1,071

Hi,

How to export the resultant table in function module ? I have created a itab in my function module and it's getting filled up.I need to export this table ? how to do it?

DATA : BEGIN of itab occurs 0,

empno type p0001-pernr,

ename type p0001-ename,

END of itab.

I don't want to create structure in se11.

Rgds,

jothi.P

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,041

Hi,

create a type-pools ztypepool..and include the type-pools in the top include..

In the type-pools..

TYPES: begin of ztypepool_t_table occurs 0,

matnr type matnr,

end of ztypepool_t_table.

Then use the ztypepool_t_table in your exporting parameter

Check this link for how to create type-pools

http://help.sap.com/saphelp_webas610/helpdata/en/fc/eb3138358411d1829f0000e829fbfe/content.htm

Thanks

Naren

11 REPLIES 11
Read only

Former Member
0 Likes
1,041

Hi,

If you don't want to create structure in SE11 then you can't use EXPORTING paramter. Then you can transfer your table under TABLES parameter. Define TABLE of type any in TABLES parameter.

Regards,

Atish

Read only

Former Member
0 Likes
1,041

Define a table type in TOP of the function module and Define a table in TABLES Parameter using that Table Type.

Reward if useful.

Kartavya

Read only

0 Likes
1,041

hi

I declared the inttable in Tables tab. But i not able to specify its type.i left it blank as the type is declared in the source code of the fn module.

The table is getting filled up correctly inside the code but there is no entries when i export the table.

Rgds,

Jothi.P

Read only

0 Likes
1,041

Hi Jothi,

When you import that table, how is it declared in the importing program. Is it field-symbol or the table of same type defination.

Regards,

Atish

Read only

0 Likes
1,041

Hi Atish,

I haven't used any field symbol.

Foll is my code in the fun mod


TYPES: BEGIN OF s_tab,
        pernr LIKE p0001-pernr,
        ename LIKE p0001-ename
       END of s_tab.
DATA : itab like s_tab occur0 with header data.
** Filling the itab here...

In the table tab of the fn mod,
itab - - - - 

Cud u give me a sample pgm with above fields.

Rgds,
Jothi.P

Read only

0 Likes
1,041

Make that you declare the parameter in the TABLES section, something like T_ITAB.

Then just before the ENDFUNCTION statement pass itab to T_ITAB.

T_ITAB[] = itab[].

Regards.

Rich Heilman

Read only

0 Likes
1,041

Hi Rich,

Tks.It's coming.But all fields are merged into single field.

I want to see the data for each field.

Rgds,

Jothi.P

Read only

0 Likes
1,041

Hi Jothi ,

This is simple.

Now just create a similar structure/workarea in your FM as you are trying to get inside.

Now do

Loop at itab into workarea.

Endloop.

Then you can access workarea and it will be in proper fields.

regards

Nishant

Read only

0 Likes
1,041

Hello Mr. Jothi,

This is Venkat.O here.

Just follow this ..

<b>1. Function module source code.</b>

FUNCTION zvenkat_testfun.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(PERNR) TYPE PERNR-PERNR

*" TABLES

*" II_TAB

*"----


DATA:

BEGIN OF li_output occurs 0,

pernr TYPE pa0001-pernr,

ename TYPE pa0001-ename,

END OF li_output.

SELECT pernr ename

FROM pa0001

into table li_output

WHERE pernr = pernr.

IF sy-subrc = 0.

ii_tab[] = li_output[].

ENDIF.

ENDFUNCTION.

<b>2.Sample abap program with Logical database PNP.</b>

REPORT zvenkat_notebook.

TABLES pernr.

DATA: BEGIN OF i_tab OCCURS 0,

pernr TYPE pa0001-pernr,

ename TYPE pa0001-ename,

END OF i_tab.

START-OF-SELECTION.

GET pernr.

CALL FUNCTION 'ZVENKAT_TESTFUN'

EXPORTING

pernr = pernr-pernr

TABLES

ii_tab = i_tab.

loop at i_tab.

write:/ i_tab-pernr,

i_tab-ename.

endloop.

It is working fine.

By the way How are you .

Thanks,

Venkat.O

Read only

0 Likes
1,041

Hi,

Fine!Hw r u?

Pl see my above post.I need the output in a table format (now it all merged to a single field)

rgds,

Jothi.P

Read only

Former Member
0 Likes
1,042

Hi,

create a type-pools ztypepool..and include the type-pools in the top include..

In the type-pools..

TYPES: begin of ztypepool_t_table occurs 0,

matnr type matnr,

end of ztypepool_t_table.

Then use the ztypepool_t_table in your exporting parameter

Check this link for how to create type-pools

http://help.sap.com/saphelp_webas610/helpdata/en/fc/eb3138358411d1829f0000e829fbfe/content.htm

Thanks

Naren