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

Table as input parameter for FM

Former Member
0 Likes
4,812

Hi,

can any one will tell me how to pass table as input parameter for FM , so that i can pass multiple rows as an input parameter. This FM inturn is used for BAPI's

your help is appriciable, its bit urgent

Anjali

23 REPLIES 23
Read only

former_member186741
Active Contributor
0 Likes
3,389

there is a tab for 'tables'..........this means you can pass tables in via this

eg,

call function 'good_stuff'

tables my_tables.

Read only

0 Likes
3,389

Hi,

Sorry to tell you this if you mention in tables tab how you are going to pass parameters.Its just views the data that it.

Anjali

Read only

0 Likes
3,389

Hi,

you have to first pass the internal table itab, which is filled with data (similar to structuer of table type which ur FM is using) to this table parameter, and this FM will use the data in the itab with in the source code of FM and will return the values .

Revert back if any issues..

it willl be more clear if you write the FM in this post...

Rewars with points if helpful

Regards

Naveen

Read only

0 Likes
3,389

Hi,

As multiple rows being passed from the java program so the sap system should accept this as table parameter ... and the values coming from the java program need to be check with another table and if records exists it should be deleted from the sap tables else go ehad with another validations.

plz help me its an urgent.

Anjali

Read only

0 Likes
3,389

Hi,

Let me tell u clearly...

Iam getting the data from java and iam trying to stord in tables.

This table should be passed as input parameter to the FM and need to check this values in the existing tables if it exits then it should delete else gohead with another validation.

in FM what should me my parameter passed and how a code should be written.

plz reply its bit urgent

Read only

0 Likes
3,389

Hi,

where you are facing the problem ?

when u r passing the mulitiple rows(java) to table parameter of FM?

Regards

Naveen.

Read only

0 Likes
3,389

Hi,

But i created a table similar to the table which is their for java...

i wrote a FM...

Where i created 2 internal tables in Table parameter....

from first one and getting the data and checking with another table and adding the ddata to 2nd internal table .... but iam not getting the results ...

system is no taking the parameter and neither its checking in table.

i wrote the code like this:

"If not ( <input ITAb>-objid IS INITIAL ) and ( from IS INITIAL ) and (to IS INITIAL ).

select * from <table> into table <2nd itab> where <condition> = <input ITAb>--objid and fm= from

to = to.

endif."

its not picking up the value from one table and neither its checking and getthing the results

Anjali

Read only

0 Likes
3,389

Hi,

Go through this..

itab1 will be filled by JAVA program.

data : itab1 type table of dbtab.---> (say 'P_table like dbtab ' in FM),

ITAB2 type table of dbtab.---> (say 'P_table like dbtab ' in FM),

V1 type P_EXp.

Before passing to FM , as we need to check the values in existing table(say table BSEG).

select fld1 fld2 from BSEG into table t_bseg..

loop at t_bseg into w_bseg.

read table itab1 into w_itab1 with key fld1 = w_bseg-fld1.

if sy-subrc = 0.

move correspoind fields of w_itab1 to w_itab2.

append w_itab2 to itab2.

endif.

NOW ITAB2 CONTAINS THE RECORDS WHICH ARE VALID BY CHECKING THE ENTRIES IN TABLE BSEG.

call function 'YXYZ'

import

.....

....

export

P_exp= v1

.......

Tables

P_table = itab2.

If still in doubt ,revert back with the logic of FM u r using ,,,

Regards,

Naveen

Read only

0 Likes
3,389

hi,

'Where i created 2 internal tables in Table parameter', have u checked is there any data passing to the tables?

regards,

Naveen

Read only

0 Likes
3,389

Hi,

Can you send the code?

Regards

Naveen

Read only

0 Likes
3,389

hi,

if sy-subrc eq 0.

write 'data passed'.

else.

write 'data not passed'.

endif.

Read only

0 Likes
3,389

If you're calling this from JAVA, I believe everything has to be OO compliant

The proper way to do this is :

1) In SE11 Create the Line Type SE11 -> Data Type -> Structure

2) In SE11 Create the Table Type SE11 -> Data Type -> Table Type (with the Line Type from (1)

3) In SE37 in the IMPORT tab use your table type from (2) in your parameter

I Think you might also have to play around with the "Pass Value" parameter if you're calling it externally

Basically ignore the TABLES tab, declare a table type and use IMPORTING/EXPORTING instead

Chris Bain

Read only

0 Likes
3,389

Hi,

Can i ahve your contact number.. and email id..

plz

anjali

Read only

0 Likes
3,389

Hi

U can reach out me at 09848343604

or mvsrnaveen@gmail.com

Regards,

Naveen

Read only

0 Likes
3,389

Regards

Naveen

Message was edited by:

Naveen Deva

Read only

0 Likes
3,389

your requirement is still not clear....I think you use 'tables' to mean more than one thing...internal and database???

Anyway, show us the code for your FM and it may make more sense to us.

Read only

Former Member
0 Likes
3,389

hi,

in the Tables tab of your function module add your table if you are creating a new FM.

eg:

parameter name: it_seq

type spec: like

asociated type : relevant table name (this should be either created customly or a standard can be used)

Table parameter acts as input as well as changing parameters for the FM..

rewards if useful

if I am wrong with your query give us additional information abt your development so that we can help you..

regards,

nazeer

Read only

Former Member
0 Likes
3,389

Hi Anjali,

Goto <b>Tables</b> tab and add parameter with reference to the table name you want. thats it.

Regds,

Younus

<b>Reward Helpful Answers!!!</b>

Read only

Former Member
0 Likes
3,389

hi

perform < functionmodule name> using <table name>+

and then u pass this table to bapi

Read only

Former Member
0 Likes
3,389

Hi

In the function mudule you can see a Tab "Tables"...Here you can pass these tables..

Reward All Helpfull answers........

Read only

Former Member
0 Likes
3,389

Hi Anjali,

In your abap program declare an internal table of the same type specified in your function module tables tab.

Fill the table as you would fill a normal internal table.

when you call the function module pass the table

eg.

call function 'MY_FUNCTION_MODULE'

import

..

..

export

..

..

tables

table = my_table

.

Regards

Abdullah

Read only

Former Member
0 Likes
3,389

Hi,

To have an Input Parameter of type table

us SE11 to create a table type with the corresponding structure

while creating the table type u can choose standard table , sorted table , etc

use this as TYPE parameter for the input.

This way you dont need to use the tables tab .

Regards,

Gaurav

Read only

Former Member
0 Likes
3,389

hi anjali,

u can pass table as a parametr for Fm in Tables section of that FM as

call funtion 'FM'

importing

.........

........

exporting

........

........

tables

table = ITab[] [give table body where]

.......

if helpful reward some points.

with regards,

suresh babu aluri.