Skip to Content
0
Aug 05, 2010 at 11:36 PM

Passing parameters in sub-routines? and their declaration

284 Views

Hi Experts,

In the system there is a custom Function Module/Function group/Main Prog. I got a requirement to enhance it.

 

types: ty_likp type likp,
           ty_lips type lips.

data: wa_likp type t_likp,
         wa_lips type t_lips,
         itab_likp type table of t_likp,
         itab_lips type table of t_lips.

data: begin of it_invoice_items occurs 0,
          vbeln like vbrk-vbeln,
           posnr like vbrp-posnr,
         end of it_invoice_items.

itab_lips[] = xlips[]. "xlips have 20 items

loop at it_invoice_items.

perform my_routine(my_program) USING itab_lips
                                     it_invoice_items
                                     flag_in
                               CHANGING wa_likp
                                        flag_out.
                                                                
"some other code comes here

endloop.

$$$$$$$$$$$$$$$$$

Report My_Program

FORM my_routine USING p_itab_lips
                      p_it_invoice_items
                      flag_in
                 CHANGING p_wa_likp
                          flag_out

move p_itab_lips-XYZ to p_wa_likp-XYZ

move p_it_invoice_items-ABC to p_wa_likp-ABC

Am getting an error against these formal parameters, as
"p_itab_lips" is not defined!
"p_it_invoice_items" is not defined!,
"p_wa_likp" is not defined!

1) So, is it mandatory to define them as below? (we are on ECC6.0)
becasue, am PASSING BY REFERENCE so they shuld get attributes from ACTUAL parameters right? then why system is throwing error?

FORM my_routine USING p_itab_lips TYPE itab_lips_1
                      p_it_invoice_items TYPE type_vbrp
                      p_flag_in type char1
                 CHANGING p_wa_likp TYPE type_likp
                          p_flag_out type char1

but, am stuck up in defining the itab_lips_1 "TABLE TYPE
2) pls. let me know How to define this TABLE TYPE of itab_lips_1?


FORM my_routine USING p_itab_lips TYPE itab_lips_1 "(where in VALUE clause is not used)
                      p_it_invoice_items TYPE type_vbrp
                      p_flag_in type char1
                 CHANGING p_wa_likp TYPE type_likp
                          p_flag_out type char1

3) Is the above ststement (where in VALUE clause is not used) is dangerous?
is it cumplsory to use the below stetement(where in VALUE clause is used) over the above statement?


FORM my_routine USING p_itab_lips TYPE itab_lips_1
                      p_it_invoice_items TYPE type_vbrp
                      VALUE(p_flag_in) type char1              "where in VALUE clause is used
                 CHANGING p_wa_likp TYPE type_likp
                          p_flag_out type char1 

4) I guess, the REPORT my_program should be EXECUTABLE TYPE program, right? or else, as its Function Module/Function Group/Main Prog. so should I choose MODULE POOL prog for this my_program?

Thank you