Skip to Content
0
Aug 21, 2008 at 10:23 AM

For all entries table handled by Tables parameter of Subroutine!

227 Views

Hi....

See my code...

Dont leave as it seems very big code... Actually its very small one...

In sourse code of function module...

data:itab1  type standard table of <local structure of top include> with header line,
                 itab2 type standrad table of knvp with header line.

perform routine_data tables  itab1
                      using    p_var

Subroutine code, saved in F include of that function group...

form routine_data  tables itab1 type standard table
                           using    p_var
  
  select * from <db table>
              into corresponding fields of table itab
              where <keyfield> = p_var.

 endform.

Back to source cod eof Function module..

if sy-subrc is = 0.
    select parvw kunn2 kunnr from knvp
                        into corresponding fields of table itab2 for all entries in itab1
                         where kunnr = itab1-kunnr
                         and ( parvw = 'WE' or parvw = 'RE' or parvw = 'RG').
endif.

This code is working fine......

==================Now coming to my problem==========================

In source code of function module...

data:itab1  type standard table of <local structure of top include> with header line,
                 itab2 type standrad table of knvp with header line.

perform routine_data tables  itab1
                               using    p_var

Subroutine code, saved in F include of that function group...

form routine_data  tables itab1 type standard table
                           using    p_var
  
  select * from <db table>
              into corresponding fields of table itab
              where <keyfield> = p_var.

 endform.

Function module source code...

perform routine2_data tables itab1
                                 itab2.

F include coding part for above subroutine....

form routine2_data  tables itab1 type standard table
                                      itab2 type standard table

    select parvw kunn2 kunnr from knvp
                        into corresponding fields of table itab2 for all entries in itab1
                         where kunnr = itab1-kunnr                                         <-----causing error
                         and ( parvw = 'WE' or parvw = 'RE' or parvw = 'RG').
                       
endform.

Giving error message....

>>> The specified type has no structure and therefore no component called 'KUNNR".....

So here the problem is there is a incorrect way to declare parameters....

Plz remind that SUBROUTINES OF FUNCTION MODULES SAVING IN INCLUDE PROGRAMS, because they making some deffenrce with normal external subroutines...

also...

Here for all entries is mandatory!

And Two sub routines are mandatory!

Thanks for your attention...

Naveen Inuganti.