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 parameters question

Former Member
0 Likes
751

Hi all,

I want to pass a table as a changing parameter in a few different subroutines. I define the table using a type and a couple of data statements as follows:

TYPES: BEGIN OF t_user,

bname TYPE ubname,

tid TYPE utid,

END OF t_user.

DATA: gt_users TYPE STANDARD TABLE OF t_user.

I then define the method signatures as follows:

FORM retrieve_users CHANGING pt_users TYPE table.

FORM retrieve_user_auth CHANGING pt_users TYPE table.

In the first subroutine I do an append of rows to an empty table. In the second subroutine I attempt a modify on a populated table. Problem is the second subroutine balks when I perform a check. It seems it doesn't like the general table type declared in the method signature. Any thoughts on how to over come this problem?

Thanks,

Mat

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
711

I have done few changes in ur code. Pl. check.

TYPES: BEGIN OF t_user,

bname TYPE ubname,

tid TYPE utid,

END OF t_user.

types: my_table type standard table of t_user.

DATA: gt_users TYPE my_table.

perform retrieve_users CHANGING gt_users.

perform retrieve_user_auth CHANGING gt_users.

FORM retrieve_users CHANGING pt_users TYPE my_table.

endform.

FORM retrieve_user_auth CHANGING pt_users TYPE my_table.

endform.

Regards,

Joy.

5 REPLIES 5
Read only

Former Member
0 Likes
711

Hi,

TYPES: BEGIN OF t_user,

bname TYPE ubname,

tid TYPE utid,

END OF t_user,

tab_user type standard table of t_user.

DATA: gt_users TYPE STANDARD TABLE OF t_user.

I then define the method signatures as follows:

FORM retrieve_users CHANGING pt_users TYPE tab_user.

FORM retrieve_user_auth CHANGING pt_users TYPE tab_user.

Thanks,

Rajinikanth

Read only

Former Member
0 Likes
711

TYPES: BEGIN OF t_user,

bname TYPE ubname,

tid TYPE utid,

END OF t_user.

TYPES: ty_t_users TYPE TABLE of t_user.

data: gt_users type table of ty_t_users.

FORM retrieve_users CHANGING pt_users TYPE ty_t_users.

If you want to pass tables using 'USING' or 'CHANGING', the table must be of a TABLE TYPE.

When you declare your table using:

DATA: gt_users TYPE STANDARD TABLE OF t_user.

You're creating an internal table typed to a structure, not of a table type.

Regards.

Read only

naimesh_patel
Active Contributor
0 Likes
711

Declare table type and use that in the changing parameters.

Like:


types: ty_t_user type table of t_user.

FORM retrieve_users CHANGING pt_users TYPE ty_t_user.

FORM retrieve_user_auth CHANGING pt_users TYPE ty_t_user.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
712

I have done few changes in ur code. Pl. check.

TYPES: BEGIN OF t_user,

bname TYPE ubname,

tid TYPE utid,

END OF t_user.

types: my_table type standard table of t_user.

DATA: gt_users TYPE my_table.

perform retrieve_users CHANGING gt_users.

perform retrieve_user_auth CHANGING gt_users.

FORM retrieve_users CHANGING pt_users TYPE my_table.

endform.

FORM retrieve_user_auth CHANGING pt_users TYPE my_table.

endform.

Regards,

Joy.

Read only

Former Member
0 Likes
711

Hi,

You need to define a table type and then use it in FORM signature

FORM retrieve_users CHANGING pt_users TYPE tt_tabletype.

Thanks

Dan