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: 

Mandatory to selection screen field

Former Member
0 Kudos

Hi experts ,

I need one help , i have on check box and one select option filed . my requirement is when check box is checked my selectoption fields should be mandatory .

please let me know how to solve this issue .

Regards

Ajay pandey

9 REPLIES 9

former_member386202
Active Contributor
0 Kudos

Hi,

Do like this.

parameters : p_chk type checkbox.

select-options : s_matnr for mara-matnr.

at selection-screen.

if p_chk eq 'X'.

if s_matnr is initial.

message 'material is mandatory' type 'E'.

endif.

endif.

Regards,

pRashant

Former Member
0 Kudos

hi ,

try like this

TABLES : mara.

PARAMETERS : chk AS CHECKBOX.

SELECT-OPTIONS : mat FOR mara-matnr.

AT SELECTION-SCREEN.

IF chk EQ 'X'.

IF mat IS INITIAL.

MESSAGE 'material require' TYPE 'E'.

ENDIF.

ENDIF.

START-OF-SELECTION.

WRITE 😕 mat-low.

reward if useful...

Former Member
0 Kudos

hi,

In report progrm afetr declaring selection screen parameters.

Here ima providing error message from my customized materiall class(ZMDE).you give your material class.

REPORT zstemp_qty2_ LINE-SIZE 255 .

Tables:vbap.

PARAMETERS : chk AS CHECKBOX.

SELECT-OPTIONS : material FOR vbap-matnr.

AT SELECTION-SCREEN.

IF chk EQ 'X'.

IF material-low IS INITIAL and material-high is initial.

MESSAGE e000(zmde) WITH 'material shouldnot be empty' .

ENDIF.

ENDIF.

START-OF-SELECTION.

WRITE 😕 material-low,material-high.

Regds

Sivaparvathi

Please reward points if helpful...

Former Member
0 Kudos

Hi Ajay,

Try like this code.

tables spfli.

select-options: S_carrid for spfli-carrid.

parameters check as checkbox USER-COMMAND UCOM.

DATA T_SPFLI TYPE TABLE OF SPFLI WITH HEADER LINE.

SELECT * FROM SPFLI INTO TABLE T_SPFLI.

at selection-screen output.

if check eq 'X'.

loop at screen.

screen-required = 1.

modify screen.

endloop.

endif.

start-of-selection.

loop at t_spfli.

write / t_spfli-carrid.

endloop.

Plzz Reward if it is Useful,

Mahi.

Former Member
0 Kudos

try this...

TABLES : marc.

PARAMETER chk AS CHECKBOX USER-COMMAND u1.

SELECT-OPTIONS: s_matnr FOR marc-matnr MODIF ID MD.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF chk = 'X' AND screen-group1 = 'MD'.

screen-REQUIRED = 1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Former Member
0 Kudos

Hi,

You do like this.

select-options: s_vbeln for vbak-vbeln modif id mod.

parameters: p_check as checkbox default 'X'.

at selection-screen output.

if p_check = 'X'.

loop at screen.

If screen-group1 = 'MOD'.

screen-required = 1.

modify screen.

endif.

endloop.

endif.

I think this will help you.

Regards.

Former Member
0 Kudos

Thanks to every oe Quick reply , but my problem is if once he selected check box he need to enter value in that field .

user requirment is if by mistake user checked checked box and if again he auchecked even throug he need to enter value on that field.

How can solve this problem .

0 Kudos

hi,

try like this

TABLES : mara.

DATA : f TYPE i.

PARAMETERS : chk AS CHECKBOX.

SELECT-OPTIONS : mat FOR mara-matnr.

AT SELECTION-SCREEN.

IF chk EQ 'X' OR f = 1.

f = 1.

IF mat-low IS INITIAL OR mat-high IS INITIAL.

MESSAGE 'material require' TYPE 'E'.

ELSE.

f = 0.

ENDIF.

ENDIF.

START-OF-SELECTION.

WRITE 😕 mat-low.

i have checked but check it with different cases....

hope it works...

reward me if useful..

Former Member
0 Kudos

Hi Ajay,

The following is the code that works as per your requirement:

parameters: p_flag type flag as CHECKBOX

USER-COMMAND TEST.

data: lv_matnr type mara-matnr.

SELECT-OPTIONS: s_matnr for lv_matnr.

**********************************************************

  • the following commented lines don't work after making the

  • S_MATNR_LOW as a required field once. All subsequent * attempts to uncheck the checkbox result in SAP's

  • mandatory field checks that include required-field check and

  • it never goes to the event block AT SELECTION-SCREEN.

  • at SELECTION-SCREEN OUTPUT.

  • loop at SCREEN.

  • if screen-name = 'S_MATNR-LOW'.

  • if not p_flag is INITIAL.

  • screen-required = '1'.

  • else.

  • screen-required = '0'.

  • endif.

  • endif.

  • MODIFY SCREEN.

  • ENDLOOP.

+

**********************************************************

at SELECTION-SCREEN.

IF sy-ucomm eq 'TEST'.

if not p_flag is INITIAL and

s_matnr-low is INITIAL. "no need to check S_MATNR-HIGH

MESSAGE e000(SU) with 'Enter the material.'.

endif.

ENDIF.

Hope this helps.

Thanks

Sanjeev