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

Assigning structure to table parameter of subroutine inside the subroutine

Hello All,

I am calling a subrotuine multiple times and every time passign a table of different

structure to it.

Data: itab1 type table of kna1,

itab2 type table of knvp.

PERFORM sub TABLES itab1.

PERFORM sub TABLES itab2.

FORM sub TABLES p_itab.

SORT p_itab BY kunnr.

ENDFORM.

This is giving me a syntax error that

"The specified type has no structure and no component called 'kuunr'".

Is it possible that inside the subroutine 'sub', I assign some structure to the table

'p_itab' based on some conditions?

Please suggest.

Regards

Indrajit

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jul 13, 2007 at 09:11 AM

    Hi Indrajit,

    Use a macro instead.

    define sub.

    SORT &1 BY kunnr.

    enddefine.

    main program:

    sub itab1.

    sub itab2.

    REgards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 13, 2007 at 09:16 AM

    Use this code..

    Data: itab1 type table of kna1,

    itab2 type table of knvp.

    PERFORM sub TABLES itab1.

    PERFORM sub TABLES itab2.

    FORM sub TABLES p_itab.

    data kunnr type char5.

    kunnr = 'KUNNR'.

    SORT p_itab BY (KUNNR).

    ENDFORM.

    Reward points if useful

    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.