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

Subroutines parameters?

naveen_inuganti2
Active Contributor
0 Likes
968

Hi..,

Iam developed a function module...

In One of the subroutine of that function module iam fetching the data from database and filling one internal table.

So after coming back from that subroutine.. My function module needs to carry that internal table.

Which parameters i hav to pass for this sub routine...?

What about data declaration part?

And in which internal table i hav to fill my entries?

Thanks,

Naveen Inuganti.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
941

Hi Naveen,

Check these links, which have description with examples of passing internal tables in subroutines:

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db979035c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_nw70/helpdata/en/9f/db979035c111d1829f0000e829fbfe/content.htm

Hope this helps you.

Regards,

Chandra Sekhar

Hi..,

Iam developed a function module...

In One of the subroutine of that function module iam fetching the data from database and filling one internal table.

So after coming back from that subroutine.. My function module needs to carry that internal table.

Which parameters i hav to pass for this sub routine...?

What about data declaration part?

And in which internal table i hav to fill my entries?

Thanks,

Naveen Inuganti.

7 REPLIES 7
Read only

Former Member
0 Likes
941

Hi,

You can declare the internal table in the main program and populate it in the subroutine. Since it is global ,it will populate data and store it.

Regards,

anirban

Read only

0 Likes
941

What is this man....

Why are you sending Just Hi???????????

At any time if u sent correct reply i will deffenately rewards you!!!

Read only

0 Likes
941

Hi Naveen,

Use Tables parameters in your function module

regards

padma

Read only

0 Likes
941

Hi Naveen,

There are two ways.

1. Declare your internal tables as Global i.e in TOP include of that FM. So no need to pass in the subroutine. U can directly populate and use it any where.

2. Declare local internal tables(In the source code of FM) and pass these in TABLES parameters. Populate these in side form. U can use after PERFORM.

eg: PERFORM populate_data TABLES i_tab1 i_tab2.

Use these tables.

FORM populate_data TABLES pi_tab1 pi_tab2.

Populate the tables with ur logic.

ENDFORM.

Thanks,

Vinod.

Read only

Former Member
0 Likes
941

hi,

Pass the internal table By REference into the sub Routine. Declare it a global variable so that it can be Accessed.

Regards

Sumit Agarwal

Read only

Former Member
0 Likes
941

Hi,

Tables parameter is used to pass internal tables as input and return internal tables as output.

If reqd you can have two parameters, one for input internal table and one for output internal table.

Regards,

Subramanian

Read only

Former Member
0 Likes
942

Hi Naveen,

Check these links, which have description with examples of passing internal tables in subroutines:

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db979035c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_nw70/helpdata/en/9f/db979035c111d1829f0000e829fbfe/content.htm

Hope this helps you.

Regards,

Chandra Sekhar