Skip to Content
author's profile photo Former Member
Former Member

Table parameters question

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 03:50 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 03:42 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 03:43 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 18, 2008 at 03:43 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 03:52 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.