‎2006 Oct 06 9:31 AM
Hello,
how can I use parameters of a function in subroutines?
I keep getting error saying the fields are 'unknown'.
Thank you.
‎2006 Oct 06 9:33 AM
‎2006 Oct 06 9:35 AM
‎2006 Oct 06 9:43 AM
you must use them as using / tables - parameters
hello,
yes I am doing that. I have different table parameters (P0000, P0001, P0002).
I have a subroutine where I use these tables, but then I get the error that the fields are unknown.
This subroutine is in an include in the same function group
‎2006 Oct 06 9:46 AM
this is the code:
FUNCTION Z_TEST.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(DRUN) TYPE DATS
*" TABLES
*" P0000 STRUCTURE P0000
*" P0001 STRUCTURE P0001
*" P0002 STRUCTURE P0002
*" P0006 STRUCTURE P0006
*" P0016 STRUCTURE P0016
*" P0021 STRUCTURE P0021
*" P0100 STRUCTURE P0100
*" P0108 STRUCTURE P0108
*" P0109 STRUCTURE P0109
*" P0138 STRUCTURE P0138
*"----------------------------------------------------------------------
PERFORM delete_future_and_sort_desc.
ENDFUNCTION.
FORM delete_future_and_sort_desc.
DELETE: p0000 WHERE begda GT drun,
p0001 WHERE begda GT drun,
p0002 WHERE begda GT drun,
p0006 WHERE begda GT drun,
p0016 WHERE begda GT drun,
p0021 WHERE begda GT drun,
p0100 WHERE begda GT drun,
p0108 WHERE begda GT drun,
p0109 WHERE begda GT drun,
p0138 WHERE begda GT drun.
SORT: p0000 BY endda DESCENDING,
p0001 BY endda DESCENDING,
p0002 BY endda DESCENDING,
p0006 BY endda DESCENDING,
p0016 BY endda DESCENDING,
p0021 BY endda DESCENDING,
p0100 BY endda DESCENDING,
p0138 BY endda DESCENDING.
ENDFORM.
‎2006 Oct 06 9:50 AM
Dear Dave
Please make the highlighted changes.
> this is the code:
>
> FUNCTION Z_TEST.
> *"----------------------------------------------------
> ------------------
> *"*"Local interface:
> *" IMPORTING
> *" VALUE(DRUN) TYPE DATS
> *" TABLES
> *" P0000 STRUCTURE P0000
> *" P0001 STRUCTURE P0001
> *" P0002 STRUCTURE P0002
> *" P0006 STRUCTURE P0006
> *" P0016 STRUCTURE P0016
> *" P0021 STRUCTURE P0021
> *" P0100 STRUCTURE P0100
> *" P0108 STRUCTURE P0108
> *" P0109 STRUCTURE P0109
> *" P0138 STRUCTURE P0138
> *"----------------------------------------------------
> ------------------
>
> PERFORM delete_future_and_sort_desc
<b>using drun
tables p0000 .... to p0138.</b>
>
> ENDFUNCTION.
>
>
> FORM delete_future_and_sort_desc
<b>using drun
tables p0000 ... p0138.</b>
> DELETE: p0000 WHERE begda GT drun,
> p0001 WHERE begda GT drun,
> p0002 WHERE begda GT drun,
> p0006 WHERE begda GT drun,
> p0016 WHERE begda GT drun,
> p0021 WHERE begda GT drun,
> p0100 WHERE begda GT drun,
> p0108 WHERE begda GT drun,
> p0109 WHERE begda GT drun,
> p0138 WHERE begda GT drun.
>
> SORT: p0000 BY endda DESCENDING,
> p0001 BY endda DESCENDING,
> p0002 BY endda DESCENDING,
> p0006 BY endda DESCENDING,
> p0016 BY endda DESCENDING,
> p0021 BY endda DESCENDING,
> p0100 BY endda DESCENDING,
> p0138 BY endda DESCENDING.
> ENDFORM.
>
> Hope that resolves your error.
Kind Regards
Eswar
‎2006 Oct 06 10:49 AM
hello,
now i'm getting an error saying 'In LOOP..WHERE.. the line of the table must be statically defined'.
‎2006 Oct 06 11:22 AM
Hi dave,
1. If we want to use the parameters
in some FORM routine, insdie the FM,
2. Then we need to GLOBALIZE like this
3. In se37
4. EDIT->INTERFACE-->GLOBALIZE PARAMETERS
5. After this, u will be able to use in subroutine.
regards,
amit m.
‎2006 Oct 06 9:41 AM
Hi Dave,
Looks like the problem with the data that is passed to the function module, but not with the parameters of the function module. The subroutine is not able to recognize the data that is passed to the FM.
1.Pass data to subroutine using syntax
perform subroutine using <field1> <field2>....
(OR)2. Try to define the data globally that you want to pass to the function module.
Thanks,
Ramakrishna