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

Passing tables between functions - compilation error ?

Former Member
0 Likes
692

Hello,

I am trying to append a line to a table and pass this tables in the tables parameter to the other function but i am getting a compilation error. Here is what i have.

in the declaration of function f1 in the tables section i have a table called component:

FUNCTION f1.

*" TABLES

*" COMPONENT STRUCTURE SDOKCOMPRP OPTIONAL

  • Here i write code to append one line to COMPONENT*******

then i want to call function 'SDOK_PHIOS_FILE_PROPERTIES_GET'

and i am calling it this way:

call function 'SDOK_PHIOS_FILE_PROPERTIES_GET'

tables:

component = COMPONENTS

BAD_OBJECTS = BADOBJ.

Now this is giving a compilation error saying that COMPONENTS is unknow,

After modifying the table in function f1 i want to send it to function ''SDOK_PHIOS_FILE_PROPERTIES_GET' which will modify the table again and return it to fucntion f1. Does anyone know how to do this ?

Thank you'

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
643

if the table is modied by the function f1 it returns sy-subrc = 0 if it is 0 then pass it to function F2 and here to check the sy-subrc and if it is 0 then pass it again to function F1 by calling it.

6 REPLIES 6
Read only

Former Member
0 Likes
643

Hi,

Is this a typo..

You have given the parameter as COMPONENT ..But you are passing COMPONENTS..

*" TABLES

*" <b>COMPONENT</b> STRUCTURE SDOKCOMPRP OPTIONAL

call function 'SDOK_PHIOS_FILE_PROPERTIES_GET'

tables:

component = <b>COMPONENTS</b>

THanks,

Naren

Read only

0 Likes
643

No it is not a typo,

When i try components = component.

it compiles and works, but this will assign the table components found in function 'SDOK_PHIOS_FILE_PROPERTIES_GET'

to the table component declared in my function f1. But this is not what i want, i want to modify the table component "which is declared in my fucntion and is of the same type of COMPONENTS declared in the second function" after mmodifying it i want to send it to fucntion 'SDOK_PHIOS_FILE_PROPERTIES_GET' to further process it and then i want to send COMPONENTS function from 'SDOK_PHIOS_FILE_PROPERTIES_GET' back to f1 so that i can read the values from it. Any ideas on how to send these tables back and forth ?

thank you

Read only

Former Member
0 Likes
644

if the table is modied by the function f1 it returns sy-subrc = 0 if it is 0 then pass it to function F2 and here to check the sy-subrc and if it is 0 then pass it again to function F1 by calling it.

Read only

0 Likes
643

i cannot understand it clearly...

but i wht i think is...

component is an internal table

which ur passing it to function module F1 and here the values in the table component changes, noe u want to send the changed component table to function F2 and here too component table get changed and u want this component table to be send back to function F1...

Read only

0 Likes
643

yes,

f1 has a table call it x, f1 modifies x and want to send it to f2 "f2 is an internal sap function, and has an internal tables called y which is the same type as x" f2 also changes table x and now it returns it to f1 which prints its content. this is what i want to do but it is not working. for some reason, this is not taking place, i am not knowing how to send the tables back and forth,

inside f1 i say

call function 'f2'

tables:

y=x.

but when i am debugging, i enter into fucntion f2 and its copy of table y is not equal to the values inside x, so how to send this table x from f1 to f2 ?

Tahnks

Read only

Former Member
0 Likes
643

Hi,

I still didn't understand your requirement..

You have the tables parameter

*" COMPONENT STRUCTURE SDOKCOMPRP OPTIONAL

If you don't want to modify the COMPONENT parameter..

Then declare a local internal table..

DATA: T_COMPONENT LIKE SDOKCOMPRP OCCURS 0 WITH HEADER LINE.

T_COMPONENT[] = COMPONENT[].

***APPEND THE LINE to the table T_COMPONENT.

pass T_COMPONENT to the FM..

call function 'SDOK_PHIOS_FILE_PROPERTIES_GET'

tables:

component = <b>T_COMPONENT</b>

BAD_OBJECTS = BADOBJ.

If this is not what you want..Please explain your requirement in detail..

Thanks,

Naren