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

RFC INSERT

Former Member
0 Likes
2,188

Hi,

How to create a Remote Enabled Function Module with Insert code. I have a database table call ZTakeData.

and i want to insert data into that using some RFC FUnc Module..

Any Sugg.

Seshu

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,503

You can create your function module via SE80 or SE37, in the attributes tab, mark as "Remote Enabled", you can then define your interface, you can use a TABLES paramter typed like the structure of your "Z" table. Then in the code of your function module, you only need one statement.

Here im_ZTakeData is the name of the TABLES parameter that you defined.



insert ZTakeData from table im_ZTakeData.

Now all you need to do is call the RFC and pass an internal table with the same structure of your "Z" table and all records will be inserted into the "Z" table.

Regards,

Rich Heilman

9 REPLIES 9
Read only

Former Member
1,503

Write a function module and make it Remote-Enabled. In the function module declare required variables & also table structure.

In the code access the table passed and update the respective table.

Read only

0 Likes
1,503

Hi,

Thanks for reply, i need steps please.

Seshu

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,504

You can create your function module via SE80 or SE37, in the attributes tab, mark as "Remote Enabled", you can then define your interface, you can use a TABLES paramter typed like the structure of your "Z" table. Then in the code of your function module, you only need one statement.

Here im_ZTakeData is the name of the TABLES parameter that you defined.



insert ZTakeData from table im_ZTakeData.

Now all you need to do is call the RFC and pass an internal table with the same structure of your "Z" table and all records will be inserted into the "Z" table.

Regards,

Rich Heilman

Read only

0 Likes
1,503

Hi,

anything to do in Import, Export, Tables tab while creating Func Module?

Seshu

Read only

0 Likes
1,503

Yes, As I said, I would suggest passing the data thru the TABLES parameter.

For the name of the parmater, use something meaningful and in the next column enter LIKE, in the next column use the name of your "Z" table, then add the line of code that I mentioned above in to the source code.

REgards,

Rich Heilman

Read only

0 Likes
1,503

Hi Rich,

i did like this,

in tables tab:

ITAB          LIKE         ZTakeData

and in Source code tab

insert ZTakeData from table itab.

and while checking Syntax its saying

"Reference parameters are not allowed with RFC"

Read only

0 Likes
1,503

Yes, are you passing any other parameters in the IMPORT or EXPORT tab?

You usually see this error when passing by reference in an RFC. If you have anything on the IMPORT or EXPORT paramters tabs, you need to check the checkbox for "passing by value".

Regards,

Rich Heilman

Read only

0 Likes
1,503

Hi,

i am sorry, i have something in export tab and now i removed it.. now its activated..

actually, whats the use of Import and Export Tab?

Seshu

Read only

0 Likes
1,503

IMPORT and EXPORT parameters are usually single fields or structures containing one line of data, and you use the TABLES parameter for passing multy line data like internal tables.

Actually the best practice has shifted to using only IMPORT and EXPORT parameters and not use the TABLES parameters at all. You are now supposed to pass your internal tables via IMPORT and EXPORT parameters using Table Types defined in the ABAP dictionary. To tell you the true, I have not yet adopted this practice, and I haven't see many that have. But there is nothing wrong with using the TABLES parameters

Regards

Rich Heilman