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 clarification

Former Member
0 Likes
508

Hello,

I require some clarification concerning table usage if possible.

I have a function called foo, that has a table declared in its tables tab. the table is: COMP like SDOKCOMPRP.

in this fucntion i am calling sap function 'SDOK_PHIOS_FILE_PROPERTIES_GET'

call function 'SDOK_PHIOS_FILE_PROPERTIES_GET'

tables:

COMPONENTS = COMP

BAD_OBJECTS = BADOBJ.

so does this mean, then when i call function 'SDOK_PHIOS_FILE_PROPERTIES_GET', i am sending it my copy of COMP and then function 'SDOK_PHIOS_FILE_PROPERTIES_GET' fills it up and return it to the faller function foo ? so it is a two way assignment in that foo first assign COMP to COMPONENTS and then 'SDOK_PHIOS_FILE_PROPERTIES_GET' assigns/returns the result of COMPONENTS to COMP ?

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
411

Hello

Any suggestions

Thanks

2 REPLIES 2
Read only

Former Member
0 Likes
412

Hello

Any suggestions

Thanks

Read only

0 Likes
411

Excerpt from the F1 help on Function (yepp, it is THAT easy!):

<b>Function Module Interfaces </b>

There are four kinds of parameters: IMPORTING, EXPORTING, CHANGING,and TABLES, which are all created in the Function Builder.

IMPORTING parameters are pure inbound parameters. When they are called, a value is transferred and the value of the actual parameter stays the same.

EXPORTING parameters are pure outbound parameters. The value of the actual parameter when it is called is not important and after the parameter returns from being called, the actual parameter contains the value of the formal parameter.

CHANGING parameters are both inbound and outbound parameters. When they are called, a value is transferred and after the parameter returns from being called, the actual parameter contains the value of the formal parameter.

TABLES parameters are like CHANGING parameters both inbound and outbound parameters, but can only be used for transferring standard tables. In this case the internal table always has a header line, from the formal parameter's viewpoint.

There are two types of parameter passing: pass by reference and pass by value.

Pass by reference points the formal parameter directly to the actual parameter so that changes to the formal parameter immediately affect the actual parameter.

Pass by value creates the formal parameter either as a copy of the actual parameter when the function module is called (at IMPORTING value and CHANGING value parameters) or creates it initially on the stack (at EXPORTING value parameters). With CHANGING value and EXPORTING value parameters, the formal parameter is copied to the actual parameter when it returns from the function module call.

Pay attention to the following when combining the four types of parameters ( IMPORTING, EXPORTING, CHANGING, and TABLES parameters) with the two types of passing (pass by reference and pass by value):

You can use either "pass by value" or "pass by reference" with IMPORTING, EXPORTING, and CHANGING parameters, whereas you can only use "pass by reference" with TABLES parameters.

<b>Conclusion:</b>

If the called function module updates the table you passed, then YES the table will be changed.

Guenther

Message was edited by:

Guenther Schober