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

Problem with accesing table field in subroutine

Hello All,

I am calling a subroutine multiple times and everytine passing 2 different tables (with different structures) int he subroutine.

PERFORM fill_itabs TABLES t_adnat_bus_in

gt_adnat_bus_in_dummy

USING p_filename..

.

.

.

PERFORM fill_itabs TABLES t_adcust_ban_in

gt_adcust_ban_in_dummy

USING p_filename.

.

.

The following is the subroutine definition.

FORM fill_itabs TABLES p_t_table

p_t_table_dummy

USING p_filename .

.

.

p_t_table_dummy[] = p_t_table[].

SORT p_t_table_dummy BY cust_id.

.

.

ENDFORM.

I am getting a syntax error which states -

<u><b>"The specified type has no structure and therefore no component called "cust_id"."</b></u>

The problem is the structure of the table passed to subroutine is different in the

different times when it is called and so in subroutine defintion I cannot mention an explicit structure for the table.

Could anyone please suggest how to avoid this?

Regards,

Indrajit.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 10, 2007 at 01:45 PM

    Hi Indrajit,

    you can add one more formal parameter to the subroutine, which will act as a flag.

    while calling the subroutine, you can set the flag if cust_id field is there in the structure of the table, else dont set the flag.

    And in the the subroutine, put check on the flag status before writing

    p_t_table_dummy[] = p_t_table[].

    SORT p_t_table_dummy BY cust_id.

    Ex:

    FORM fill_itabs TABLES p_t_table

    p_t_table_dummy

    USING p_filename

    p_flag.

    .

    .

    .

    if p_flag eq 'X'.

    p_t_table_dummy[] = p_t_table[].

    SORT p_t_table_dummy BY cust_id.

    endif.

    .

    .

    ENDFORM.

    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.