‎2006 Sep 26 5:51 AM
hi friends, pls help me reg my query.
I have wERKS select-options
on the selection screen.
(This same thing, i want to pass in FM)
2. So in FM, I have used the
TABLES parameter (Not import, nor export)
3. And the type given is
WERKS_RANG
i defined it like
plant type WERKS_RANG
(This WERKS_RANG has 4 fields,
just like a select option
SIGN
OPTION
LOW
HIGH
)
4. Then inside fm,
i used SELECT Query,
and use IN WERKS.
below is my code in FM.
select lgort labst
from mard
into table imard1
where PLANT in werks
and material1 = matnr.
but i am getting an error "field plant is unknown". i have defined it under tables parameter..pls help
how shud i get the values i enter in select option for main program in se38 to function module field 'plant'...
‎2006 Sep 26 5:54 AM
in the FM declare a tables parameter of the type SELOPT.This is the generic select option SAP structure.Just fill this tables from your se38 program and you will have the plant values in your FM.
‎2006 Sep 26 5:57 AM
in ur select statement plant is referring to table mard , so does plant exists in mard table , it should be werks
select lgort labst
from mard
into table imard1
where <b>WERKS</b> in werks
and material1 = matnr.
‎2006 Sep 26 6:06 AM
Hi,
Other option is like the way SAP implemented in Function Module RV_DISPATCH_DUE_DATE_SEL_RANGE.
Hope this helps..
Regards,
Murali
‎2006 Sep 26 6:11 AM
Hi,
do one thing,
the type you declared in the tables is the wrong one.
it need to be changed to selopt and then in debuggin see whether the data is conming into the werks.
and see that tables declaration is done in your report.
‎2006 Sep 26 7:52 AM
can any one send me code for this, i have been trying but it is not working...
‎2006 Sep 26 7:58 AM
Hi
You can define your TABLE parameter WERK without reference and define a range in your fm:
FUNCTION Z_PROVA_PROVA.
*"----
""Interfaccia locale:
*" IMPORTING
*" REFERENCE(MATNR) TYPE MATNR
*" TABLES
*" SEL_WERKS
*"----
RANGES R_WERKS FOR MARD-WERKS.
R_WERKS[] = SEL_WERKS[].
DATA: BEGIN OF IMARD1 OCCURS 0,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
END OF IMARD1.
SELECT LGORT LABST FROM MARD INTO TABLE IMARD1
WHERE WERKS IN R_WERKS
AND MATNR = MATNR.
Max