Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

select options in function module

abdulazeez12
Active Contributor
0 Kudos

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'...

6 REPLIES 6

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

0 Kudos

Hi,

Other option is like the way SAP implemented in Function Module RV_DISPATCH_DUE_DATE_SEL_RANGE.

Hope this helps..

Regards,

Murali

0 Kudos

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.

abdulazeez12
Active Contributor
0 Kudos

can any one send me code for this, i have been trying but it is not working...

0 Kudos

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