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

Function Module - return a list of values?

Former Member
0 Likes
1,073

Hi,

I have a requirement and I am not sure If I can do this using a function module.

I'll import a single value and do a lookup on a table for all the records that match this. Then I'll need to export this list of values.

Can this be done? thanks a lot

If you can send me an example, I'll appreciate it.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
688

Of course you can do that.

Have a IMPORT variable and have internal table in the TABLES parameter that would refer to one of the data dictionary strucutres.

In the function

SELECT * FROM TAB INTO ITAB WHERE COLUMN = IMPORTED VALUE.

This is the simplest way of doing.

Regards,

Ravi

Note Please mark all the helpful answers

4 REPLIES 4
Read only

Former Member
0 Likes
689

Of course you can do that.

Have a IMPORT variable and have internal table in the TABLES parameter that would refer to one of the data dictionary strucutres.

In the function

SELECT * FROM TAB INTO ITAB WHERE COLUMN = IMPORTED VALUE.

This is the simplest way of doing.

Regards,

Ravi

Note Please mark all the helpful answers

Read only

0 Likes
688

Ravi,

thanks. But how do I export that Internal table?

If I have to do that, my export parameter should be of type table. how do I do that?

Thanks

Read only

0 Likes
688

If you are working with the latest version then TABLES parameter is obsolete.

For that create a TABLE TYPE and use that to refer for the parameter in the EXPORT section of the function module.

If its custom structure, then

1. Create a structure in SE11,

2. Create a table type referrting to strcture above, in SE11

3. Use the table type to refer in the function module.

You can create a table type using DATA TYPE option of SE11

Regards,

Ravi

Note - Please mark all the helpful answers

Read only

Former Member
0 Likes
688

hi Gova,

First check for the values whether there exists any match in the database at at selection screen event.


at selection-screen.
select * from Table where <Conditions>.
if sy-subrc <> 0.
  message e000 with 'No records Found'.
endif.
 

Start-of-selection.

perform get_data.

Regards,

Santosh