‎2009 Sep 08 2:23 PM
Hi,
I have question for specifying internal table type of the subroutine parameter.
The following code could not compile due to the parameter definition problem. I wonder the cause of the problem in the following code:
FORM checkinfoobject
USING value(l_it_subareaid) TYPE STANDARD TABLE OF zpld_nmck.
.....
.....
ENDFORM.
"TYPE STANDARD TABLE OF" cannot be used in specifying parameter for subroutine.
Why is this so?
Thanks in advance.
Regards,
Joon Meng
‎2009 Sep 08 2:29 PM
Hi,
only for a structure or a Variable we use USING parameters, if you wnt to pass a Table in subroutine u should use TABLES parameter...
eg:
PERFORM checkinfoobject TABLES it_subareaid.
FORM checkinfoobject TABLES it_subareaid STRUCTURE zpld_nmck.
ENDFORM.
Hope it helps!!
Rgds,
Pavan
‎2009 Sep 08 2:26 PM
‎2009 Sep 08 2:29 PM
Hi,
only for a structure or a Variable we use USING parameters, if you wnt to pass a Table in subroutine u should use TABLES parameter...
eg:
PERFORM checkinfoobject TABLES it_subareaid.
FORM checkinfoobject TABLES it_subareaid STRUCTURE zpld_nmck.
ENDFORM.
Hope it helps!!
Rgds,
Pavan
‎2009 Sep 08 2:31 PM
Hi,
Try like this,
DATA: l_it_subareaid TYPE STANDARD TABLE OF zpld_nmck .
FORM checkinfoobject TABLES l_it_subareaid
USING value(l_it_subareaid)
ENDFORM.
Regards,
Vikranth
‎2009 Sep 08 2:36 PM
Hi,
You cannot pass tables like that.
It needs to be passed using the TABLES options.
But that is obsolete now.
So do as follows:-
Declare a table type of zpld_nmck in your global declaration and then use the same in your exporting or importing parameter of the subroutine.
TYPES: TT_ zpld_nmck type standard table of zpld_nmck.
FORM checkinfoobject
USING value(l_it_subareaid) TYPE TT_ zpld_nmck
.....
.....
ENDFORM.Regards,
Ankur Parab
‎2009 Sep 08 3:53 PM
Hi,
Thanks for the quick reply!
@Soumyaprakash: I have problem with this declaration. Although I have passed "zpld_nmck" (a structure), but I got the error message stating that it is not a structure.
@Vishnu: Thanks for the solution. It worked! The only drawback one is that this is considered obsolete.
@Vikranth: Sorry for the imprecise description from my side. I need to use subroutines in a function module. So, l_it_subareaid cannot be used in this case.
@Ankur: Thanks for the information. But the problem is that I have 10 subroutines need to be called in a function module. It would inconvenient to declare all these table types. Do you have any other suggestion?
Thanks once again!
Regards,
Joon Meng
‎2009 Sep 08 4:05 PM
Hi,
Using TABLES within a SUBROUTINE is OBSOLETE practise.
If you do the extended program check and run the code inspector you will find that it is an obsolete practise.
Currently only USING and CHANGING options are allowed for a subroutine and in case you need to pass tables you have to pass them using table types only.
Regards,
Ankur Parab