Application Development and Automation 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: 
Read only

Selection screen output obligatory field

Former Member
0 Likes
3,354

Hi all,

I have two radio buttons, if i selected one radio button one selection screen will come for entries another will be invisible.

in that selection screen i have all are mandatory fields. so it is not allowing to another radio button with out entering the values

Chek my code.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text001.
PARAMETERS     : p_aut RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND ac.
PARAMETERS     : p_man RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text002.
PARAMETERS     : p_zbukr   TYPE reguh-zbukr  MODIF ID aut. 
SELECT-OPTIONS : s_laufi   FOR  reguh-laufi  MODIF ID aut OBLIGATORY,               
                 s_laufd   FOR  reguh-laufd  MODIF ID aut OBLIGATORY,                
                 s_hbkid   FOR  reguh-hbkid  MODIF ID aut OBLIGATORY,           
                 s_hktid   FOR  reguh-hktid  MODIF ID aut OBLIGATORY.               
SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text003.
PARAMETERS     : p_bukrs   TYPE bsak-bukrs   MODIF ID man DEFAULT 'LTGI'. 
SELECT-OPTIONS : s_augbl   FOR  bsak-augbl   MODIF ID man OBLIGATORY,  
                             s_augdt   FOR  bsak-augdt   MODIF ID man OBLIGATORY. 
SELECTION-SCREEN END OF BLOCK b3.

Will it move from one radion button to another even those are obligatory.

Regards,

Sri

Edited by: Thomas Zloch on Sep 14, 2010 2:34 PM - please use code tags!

Hi all,

I have two radio buttons, if i selected one radio button one selection screen will come for entries another will be invisible.

in that selection screen i have all are mandatory fields. so it is not allowing to another radio button with out entering the values

Chek my code.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text001.
PARAMETERS     : p_aut RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND ac.
PARAMETERS     : p_man RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text002.
PARAMETERS     : p_zbukr   TYPE reguh-zbukr  MODIF ID aut. 
SELECT-OPTIONS : s_laufi   FOR  reguh-laufi  MODIF ID aut OBLIGATORY,               
                 s_laufd   FOR  reguh-laufd  MODIF ID aut OBLIGATORY,                
                 s_hbkid   FOR  reguh-hbkid  MODIF ID aut OBLIGATORY,           
                 s_hktid   FOR  reguh-hktid  MODIF ID aut OBLIGATORY.               
SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text003.
PARAMETERS     : p_bukrs   TYPE bsak-bukrs   MODIF ID man DEFAULT 'LTGI'. 
SELECT-OPTIONS : s_augbl   FOR  bsak-augbl   MODIF ID man OBLIGATORY,  
                             s_augdt   FOR  bsak-augdt   MODIF ID man OBLIGATORY. 
SELECTION-SCREEN END OF BLOCK b3.

Will it move from one radion button to another even those are obligatory.

Regards,

Sri

Edited by: Thomas Zloch on Sep 14, 2010 2:34 PM - please use code tags!

7 REPLIES 7
Read only

Former Member
0 Likes
1,794

don't make the fields obligatory...validate entries when SSCRFIELDS-UCOMM is 'ONLI' or 'PRIN' or 'SJOB' in the at selection-screen event. Also, search the forum on showing/hiding selection screen elements.

Read only

0 Likes
1,794

Hi Shrikant,

Try this.It will surely solve your problem.Donu2019t make fields on selection screen mandatory using obligatory keyword.If you still want that fields to behave as mandatory without using obligatory keyword.Try checking initial for all these fields in the START OF SELECTION.Check all fields to be not initial.If any fields is initial the you can display the appropriate message in the corresponding SY-SUBRC check.

This will check all your mandatory fields and will allow to move to another radio button with out entering the values.

And one more point I want to bring to your notice.

u2022 Avoid using obligatory option with SELECT OPTIONS.I am saying this as one problem client(LAYMAN) face when we make a select option mandatory is one cannot enter more than 2 values using extension without filling the mandatory field.This is annoying for client sometimes.

u2022 So if you want to make it mandatory use No extension option to avoid this hassle.

Thanks!!

Rahul

Read only

0 Likes
1,794

I agree except that if you use AT SELECTION-SCREEN instead, you can give the message while the user is still on the selection screen. I have a similar program and I do my checking at AT SELECTION-SCREEN.

Read only

0 Likes
1,794

Hi Erik.

I tried it using the check on the AT SELECTION SCREEN.But the problem was as soon as the user select other radio button all the required fields (which u want to make visible ) will appear but all the checks that are there for checking mandatory fields will be triggered simultaneously and will display msg that value is missing .However the user was not allowed to entered that values as that fields were previously not visible.Because of this only reason you have to use these check in start of selection.Hope you get my point

Thanks!!

Rahul

Read only

0 Likes
1,794

Hi Rahul,

I didn't have that problem. I checked the state of the radio buttons before checking for mandatory fields so I would only check the fields the user should have entered.

Thanks

Erik

Edited by: Erik Peterson on Sep 14, 2010 8:38 AM - Typo fixed

Read only

0 Likes
1,794

Hi

Could be please provide me some code to get better overview.

I was saying that suppose i have 2 radiobuttons

1. All Customers

2. Changed Customer

By default the all customer radio button is checked.

So when you select changed customer field appears to enter date(Code for which is written in at selection screen output).

Just after this at selection screen is executed.Since you are saying to have a check in at selection screen.Here you were saying that you will also check the state of the radio button.So u will check whether the changed customer is is not initial which is true in this case.So the check for the mandatory date will be done.But still the user didn't get a chance to enter date.

Please suggest.

Thanks!!

Rahul

Read only

0 Likes
1,794

Hi,

True. There are some variables to keep track of.

So, I have two radio buttons. P_UPL and P_DNL. If P_DNL is selected and gv_mode has already been set to "download status", then I do the check. AT SELECTION-SCREEN OUTPUT happens after AT SELECTION-SCREEN so my gv_mode variable won't be set on the first AT SELECTION-SCREEN when the radio button is selected.


*--------------------------------------------------------------------*
* SELECTION SCREEN EVENTS
*--------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
  DATA: lv_type(3).
  IF p_upl = 'X'.
    gv_mode = c_screen_upload.
  ELSE.
    gv_mode = c_screen_download.
  ENDIF.

  LOOP AT SCREEN.
    IF NOT screen-group1 IS INITIAL.
      IF screen-group1 = gv_mode.
        screen-active = 1.
      ELSE.
        screen-active = 0.
      ENDIF.
    ENDIF.

    MODIFY SCREEN.
  ENDLOOP.

AT SELECTION-SCREEN.
.
.
.
  IF p_dnl = 'X' and gv_mode = c_screen_download.

    IF p_aland is INITIAL.
      MESSAGE text-m03 type 'E'.
    ENDIF.

    IF so_azone[] is INITIAL.
      MESSAGE text-m04 TYPE 'E'.
    ENDIF.

  endif.