Application Development 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: 

Assigning structure to table parameter of subroutine inside the subroutine

Former Member
0 Kudos

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

2 REPLIES 2

former_member181962
Active Contributor
0 Kudos

Hi Indrajit,

Use a macro instead.

define sub.

SORT &1 BY kunnr.

enddefine.

main program:

sub itab1.

sub itab2.

REgards,

Ravi

Former Member
0 Kudos

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