cancel
Showing results for 
Search instead for 
Did you mean: 

Send a table with a function.

Former Member
0 Kudos

Hi all!!

I want to send a table with a function, but I don't know how to do it.

in my code I have this.

FUNCTION ZBORRAR.

*"----


""Interfase local

*"----


*"----


*"----


*" TABLES

*"----


TABLES: T751F.

*"----


*" VARIABLES

*"----


DATA: BEGIN OF S_CLA_MED_CAND.

DATA: MASSN LIKE T751F-MASSN,

MNTXT LIKE T751F-MNTXT.

DATA: END OF S_CLA_MED_CAND.

DATA: T_CLA_MED_CAND LIKE S_CLA_MED_CAND OCCURS 0 WITH HEADER LINE.

*"----


*" FILL THE I. TABLE

*"----


SELECT MASSN MNTXT

FROM T751F

INTO TABLE T_CLA_MED_CAND

WHERE SPRSL = 'S'.

ENDFUNCTION.

I don't have any thing in the import, export, modif., tables tabs.

Thanks and Regards.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

I see that it is a Z FM , can't you add a tables parameter .

If for some reason you cannot modify the signature of the FM. EXPORT the internal table to a memory id and then IMPORT it in the FM.

Not sure why you cannot add this tables parameter. You will anyway be modifying the FM code.

Regards

Kalpana

Answers (4)

Answers (4)

Former Member
0 Kudos

Use into corresponding fields of table in your select stmt .

And you see the 2 other fields , b'coz the tables parameter is declared like T751F , which has mandt and sprsl.

- Kalpana

Message was edited by: Kalpana Tyagi

Former Member
0 Kudos

I MADE THIS...

I FOLLOWED THIS

Define a tan\ble in the TABLES tab.

Table name: T_CLA_MED_CAND

Type: LIKE

Associated Type: T751F

Table T_CLA_MED_CAND will be sent thru this FM.

AND MY CODE IS:

FUNCTION ZBORRAR.

*"----


""Interfase local

*" TABLES

*" X_CLA_MED_CAND STRUCTURE T751F

*"----


*"----


*" TABLES

*"----


*"----


*" VARIABLES

*"----


TYPES: BEGIN OF S_CLA_MED_CAND,

MASSN LIKE T751F-MASSN,

MNTXT LIKE T751F-MNTXT,

END OF S_CLA_MED_CAND.

DATA: T_CLA_MED_CAND TYPE TABLE OF S_CLA_MED_CAND WITH HEADER LINE.

*"----


*" GET DATA

*"----


SELECT MASSN MNTXT

FROM T751F

INTO TABLE T_CLA_MED_CAND

WHERE SPRSL = 'S'.

LOOP AT T_CLA_MED_CAND.

MOVE: T_CLA_MED_CAND-MASSN TO X_CLA_MED_CAND-MASSN,

T_CLA_MED_CAND-MNTXT TO X_CLA_MED_CAND-MNTXT.

APPEND X_CLA_MED_CAND.

ENDLOOP.

ENDFUNCTION.

IN THE RESULTS THE TABLE HAS THE DATA I WANT BUT THERE IS TWO MORE FIELDS MANDT AND SPRSL. IS THIS BECAUSE THE SPRSL I'M USING IT TO FILTER THE DATA AND THE MANDT 'CAUSE I'M WORKING IN IT?

HOW CAN I JUST HAVE TWO FIELDS??

Former Member
0 Kudos

Hi

It is useless to manage the field MANDT in a SELECT statament, becase it's the mandatary where you are working by default.

But you should manage the language, it's usually used the language of logon:

SELECT MASSN MNTXT

FROM T751F

INTO TABLE T_CLA_MED_CAND

WHERE SPRSL = SY-LANGU.

I belevie your code should be like this:

SELECT * FROM T751F INTO TABLE X_CLA_MED_CAND

WHERE SPRSL = SY-LANGU.

Max

Message was edited by: max bianchi

Former Member
0 Kudos

use below code

FUNCTION ZBORRAR.

*"----


""Interfase local

*" TABLES

*" X_CLA_MED_CAND STRUCTURE T751F

*"----


*"----


*" TABLES

*"----


*"----


*" VARIABLES

*"----


TYPES: BEGIN OF S_CLA_MED_CAND,

MASSN LIKE T751F-MASSN,

MNTXT LIKE T751F-MNTXT,

END OF S_CLA_MED_CAND.

DATA: T_CLA_MED_CAND TYPE TABLE OF S_CLA_MED_CAND WITH HEADER LINE.

*"----


*" GET DATA

*"----


SELECT *

FROM T751F

INTO TABLE X_CLA_MED_CAND

WHERE SPRSL = 'S'.

ENDFUNCTION.

Former Member
0 Kudos

Hi ,

You have to used Insert or update or modify table(what ever table you need to update) from S_CLA_MED_CAND in the code..

venkata_ramisetti
Active Contributor
0 Kudos

Hi,

Define a tan\ble in the TABLES tab.

Table name: T_CLA_MED_CAND

Type: LIKE

Associated Type: T751F

Table T_CLA_MED_CAND will be sent thru this FM.

Thanks,

Ramakrishna