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: 

How to make both the fields of select-options as mandatory

Former Member
0 Kudos

Hi,

I have a select-option on my selection screen.

select-options: date for 'some date field'.

Now if i use addition mandatory, it makes only lower value as mandatory.

I need to make the higher field also as mandatory.

Please help me out.

Thanks,

Sandeep.

1 ACCEPTED SOLUTION

former_member1245113
Active Contributor

Hi,

This is not possible as the SAP has not provided this.

Please go through the KEY word documentaion of SELECT-OPTIONS and go through the SCREEN OPTIONS it clearly says only the first input field it makes MADATORY

but you can try this.

TABLES mara.

SELECT-OPTIONS matnr FOR mara-matnr OBLIGATORY.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-name = 'MATNR-HIGH'.

screen-required = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

regards

Ramchander Rao.K

Edited by: ramchander krishnamraju on Dec 4, 2008 11:21 AM

12 REPLIES 12

Former Member
0 Kudos

Hi

You can do that programatically.

Check s_date-high is not initial.

Issue a message if it is initial.

Cheers

Ravish

Former Member
0 Kudos

HI Sandeep,

By giving obligatory it will make only lower value mandatory.

to make higher value also mandatory give it as REQUIRED in SCRREN TABLE.

i.e. Loop at screen.

-


-


-


modify screen.

endloop..

with Best Reagrds,

Flavya

Former Member
0 Kudos

Hi,

SELECT-OPTIONS date for p0001-begda OBLIGATORY.

with out entering the low values if you enter the high value it gives you the error on pressing enter or F8.

Edited by: avinash kodarapu on Dec 4, 2008 3:46 PM

Former Member
0 Kudos

hi,

you can use OBLIGATORY keyword.

and give a check if date-high is initial

message " enter upper limit"

former_member1245113
Active Contributor

Hi,

This is not possible as the SAP has not provided this.

Please go through the KEY word documentaion of SELECT-OPTIONS and go through the SCREEN OPTIONS it clearly says only the first input field it makes MADATORY

but you can try this.

TABLES mara.

SELECT-OPTIONS matnr FOR mara-matnr OBLIGATORY.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-name = 'MATNR-HIGH'.

screen-required = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

regards

Ramchander Rao.K

Edited by: ramchander krishnamraju on Dec 4, 2008 11:21 AM

Former Member
0 Kudos

hi

you obligatory works for lower value only

place obligatory in the select-option statement.

with in the code explicitly check for higher value

if low is not initial and high is initial.

error message.

endif.

then it becomes obligatory

Mohamed_Mukhtar
Active Contributor
0 Kudos

hi ,

Pseudo code, may be helpful to you


 AT SELECTION-SCREEN OUTPUT.  
LOOP AT SCREEN.
    IF screen-name = 'S_DATE-LOW' OR screen-name = 'S_DATE-HIGH'.
      screen-required = 1.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

Thanks & Regards

Former Member
0 Kudos

hi..sandeep..

check this code ..

TABLES: vbap.

SELECT-OPTIONS: s_vbeln for vbap-vbeln obligatory.

** validation
AT SELECTION-SCREEN on s_vbeln.
  IF s_vbeln-high is INITIAL.
    MESSAGE e000(zsd) WITH 'Dude.!!Enter higher limit also!!'.
  ENDIF.

**get data..

start-of-selection.

selec vbeln
      posnr
from vbap
into table gt_vbap
where vbeln in s_vblen.

regards,

padma

Former Member
0 Kudos

Hi..

at selection-screen on S_PLANT-low.

at selection-screen on s_plant-high.

use this events or..

simply write the code under the slection-screen ouput event.

AT SELECT-SCEEN OUPUT.

<LOGIC>.

if sy-subrc ne 0.

Message e002(zgen) with "enter the upper value".

endif.

UR's

GSANA

raymond_giuseppi
Active Contributor
0 Kudos

Of course, this is possible, SAP did it, you could check in AT SELECTION-SCREEN ON, or

- Declare the SELECT-OPTIONS as mandatory (clause OBLIGATORY)

- Then use SELECT_OPTIONS_RESTRICT and create a mode that allow only ranges (options BT, NB) and affect it to your SELECT-IOPTIONS.

* Form to perform in INITIALIZATION
* You need to add a TYPE-POOLS SSCR. in the TOP of program
FORM restrict_select.
  DATA: restrict TYPE sscr_restrict,
        opt_list TYPE sscr_opt_list,
        ass TYPE sscr_ass.
* Défine modes
* - ALL standard SELECT-OPTIONS
  CLEAR opt_list.
  MOVE 'ALL' TO opt_list-name.
  MOVE 'X' TO: opt_list-options-bt,
               opt_list-options-cp,
               opt_list-options-eq,
               opt_list-options-ge,
               opt_list-options-gt,
               opt_list-options-le,
               opt_list-options-lt,
               opt_list-options-nb,
               opt_list-options-ne,
               opt_list-options-np.
  APPEND opt_list TO restrict-opt_list_tab.
* - EQU List of values (to use in a FOR ALL ENTRIES)
  CLEAR opt_list.
  MOVE 'EQU' TO opt_list-name.
  MOVE 'X' TO opt_list-options-eq.
  APPEND opt_list TO restrict-opt_list_tab.
* - RAN Range only
  CLEAR opt_list.
  MOVE 'RAN' TO opt_list-name.
  MOVE 'X' TO: opt_list-options-bt " for between
               opt_list-options-nb. " for not between
  APPEND opt_list TO restrict-opt_list_tab.
* Affect ALL to each and every SO
  CLEAR ass.
  MOVE: 'A'          TO ass-kind,
        '*'          TO ass-sg_main,
        'ALL'        TO ass-op_main.
  APPEND ass TO restrict-ass_tab.
* Affect RAN to your SO, eg s-bldat
  CLEAR ass.
  MOVE: 'S'          TO ass-kind,
        'S-BLDAT'    TO ass-name,
        'I'          TO ass-sg_main, " no exclude
        'RAN'        TO ass-op_main. " only ranges
  APPEND ass TO restrict-ass_tab.
* Call FM 
  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
       EXPORTING
            restriction = restrict
       EXCEPTIONS
            OTHERS      = 1.
ENDFORM.                    " restrict_select

Solution provided in AT SELECTION-SCREEN OUTPUT only check first record, and does not work when user click on the arrow to select several values.

Regards

Former Member
0 Kudos

Hi,

Use the following Code.

TABLES: vbak.

SELECT-OPTIONS: sel FOR vbak-vbeln.

IF sel-high IS INITIAL.

MESSAGE e001.

ENDIF.

This will be simple as possible.

Thanks,

Uma

0 Kudos

At least, perform A

LOOP AT sel.
  IF sel-high IS INITIAL.
    MESSAGE e001.
  ENDIF.
ENDLOOP.

Regards