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 Option

0 Kudos

Select options for all key fields of the table MARA,MARC and MBEW, matnr mandatory for all fields.

How to declare the data and select option for the above fields,

DATA: MATNR TYPE W_MATNR,
MATNR TYPE V_MATNR,
MATNR TYPE S_MATNR.

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS: MARA FOR W_MATNR,
MARC FOR V_MATNR,
MBEW FOR S_MATNR.

Entering this code getting on error, Kindly help me on this issue.

6 REPLIES 6

former_member763929
Participant
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. Since this is your first question, I recommend that you familiarize yourself with Community Q&A , as the overview provides tips for preparing questions that draw responses from our members.

Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your Profile you encourage readers to respond.

FredericGirod
Active Contributor

Could you explain what you are trying to achieve ?

A select-option refer to a field of a table, not to several, and even if you would like to check several table, there is only one master table. In your case MARA. You cannot check MATNR field for MARC, because you didn't sepecify the plant.

You are making a big melting pot between select-options & search-help

matt
Active Contributor

Getting an error?

Just a thought, but maybe it would be helpful if you told us the error.

0 Kudos

TYPES: BEGIN OF TY_MARA,
MATNR TYPE MATNR,
MTART TYPE MTART,
MBRSH TYPE MBRSH,
BISMT TYPE BISMT,
MEINS TYPE MEINS,
END OF TY_MARA.

TYPES: BEGIN OF TY_MARC,
MATNR TYPE MATNR,
WERKS TYPE WERKS,
DISMM TYPE DISMM,
DISPO TYPE DISPO,
KZDIE TYPE KZDIE,
KZPPV TYPE KZPPV,
MPDAU TYPE MPDAU,
END OF TY_MARC.

TYPES: BEGIN OF TY_MBEW,
MATNR TYPE MATNR,
BWKEY TYPE BWKEY,
BWTAR TYPE BWTAR,
STPRV TYPE STPRV,
LAEPR TYPE LAEPR,
DZKPRS TYPE DZKPRS,
DZKDAT TYPE DZKDAT,
END OF TY_MBEW.

DATA: W_MATNR TYPE MATNR.
DATA: T_MARA TYPE STANDARD TABLE OF TY_MARA,
WA_MARA TYPE TY_MARA,
T_MARC TYPE STANDARD TABLE OF TY_MARC,
WA_MARC TYPE TY_MARC,
T_MBEW TYPE STANDARD TABLE OF TY_MBEW,
WA_MBEW TYPE TY_MBEW.

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS: mara FOR w_matnr OBLIGATORY,
marc FOR w_matnr OBLIGATORY,
mbew FOR w_matnr OBLIGATORY.

PARAMETERS: r1 RADIOBUTTON GROUP rad1,
r2 RADIOBUTTON GROUP rad1,
r3 RADIOBUTTON GROUP rad1.
SELECTION-SCREEN END OF BLOCK part1.

IF R1 IS NOT INITIAL.
SELECT MATNR
MTART
MBRSH
BISMT
MEINS
FROM MARA
INTO TABLE T_MARA
WHERE MATNR IN MARA.

ELSEIF R2 IS NOT INITIAL.

SELECT MATNR
WERKS
DISMM
DISPO
KZDIE
KZPPV
MPDAU
FROM MARC
INTO TABLE T_MARC
WHERE MATNR IN MARC.


ELSE.
SELECT MATNR
BWKEY
BWTAR
STPRV -------------------------------------------------- error line
LAEPR -------------------------------------------------- error line

ZKPRS -------------------------------------------------- error line

ZKDAT --------------------------------------------------- error line

FROM MBEW
INTO TABLE T_MBEW
WHERE MATNR IN MBEW.

ENDIF.

Error message

The database field or the result type of the aggregate function ZKPRS and the component "BWTAR-PSPNR" of "T_MBEW" are not compatible.

Please Help me on this.

Sandra_Rossi
Active Contributor
0 Kudos

Please edit your question, don't add a comment, and press the [CODE] button so that your code is legible by everyone.

TYPES: BEGIN OF TY_MBEW,
         MATNR TYPE MATNR, " you should prefix with MBEW- everywhere (TYPE MBEW-MATNR etc.)
         BWKEY TYPE BWKEY, 
         BWTAR TYPE BWTAR,
         STPRV TYPE STPRV,
         LAEPR TYPE LAEPR,
         DZKPRS TYPE DZKPRS,
         DZKDAT TYPE DZKDAT,
       END OF TY_MBEW.,

raymond_giuseppi
Active Contributor
0 Kudos

Review your source code carefully by checking the definitions of your tables/fields.

For example, there is no DZKPRS field in MBEW but a ZKPRS field with the data element DZKPRS, (this is just one of many errors).