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: 

Obligatory fields in selection-screen

former_member210563
Participant
0 Kudos

Hi,

I have these 3 fields in my selection-screen:

S_EBELN

S_KDATB

S_KDATE

The last 2 fields are Valid to and from fields. They are only to be obligatory if s_ebeln is empty.

How can I control that ?

1 ACCEPTED SOLUTION

JozsefSzikszai
Active Contributor
0 Kudos

hi,

something like this:

AT SELECTION-SCREEN.

IF s_ebeln[] IS INITIAL.
IF s_kdatb[] IS INITIAL AND[] s_kdate IS INITIAL.
* error message
ENDIF.
ENDIF.

hope this helps

ec

7 REPLIES 7

Former Member
0 Kudos

In the AT SELECTION-SCREEN event, validate the fields S_KDATB

S_KDATE

AT SELECTION-SCREEN.
if s_vbeln is initial.

select ...
  from table ----
 where kdatb in s_kdatb
     and kdate in s_kdate.
if sy-subrc ne 0.
message e000.
exit.
endif.

Regards

Kannaiah

JozsefSzikszai
Active Contributor
0 Kudos

hi,

something like this:

AT SELECTION-SCREEN.

IF s_ebeln[] IS INITIAL.
IF s_kdatb[] IS INITIAL AND[] s_kdate IS INITIAL.
* error message
ENDIF.
ENDIF.

hope this helps

ec

valter_oliveira
Active Contributor
0 Kudos

Hello.

Check this code:


START-OF-SELECTION.
  READ TABLE s_ebeln TRANSPORTING NO FIELDS INDEX 1.
  IF sy-subrc NE 0.
    READ TABLE s_kdatb TRANSPORTING NO FIELDS INDEX 1.
    IF sy-subrc NE 0.
      MESSAGE 'Fill field kdatb' TYPE i.
      EXIT.
    ENDIF.
    READ TABLE s_kdate TRANSPORTING NO FIELDS INDEX 1.
    IF sy-subrc NE 0.
      MESSAGE 'Fill field kdate' TYPE i.
      EXIT.
    ENDIF.
  ENDIF 

Regards.

Valter Oliveira.

Former Member
0 Kudos

Hi

U need to insert a control in AT SELECTION-SCREEN event:

AT SELECTION-SCREEN.

  CHECK S_EBELN[] IS INITIAL.

  IF S_KDATB[] IS INITIAL.
     MESSAGE E208(00) WITH 'Insert  Valid To date'.
  ENDIF.
  IF S_KDATE[] IS INITIAL.
    MESSAGE E208(00) WITH 'Insert  Valid From date'.
  ENDIF.

Max

Former Member
0 Kudos

it is better to use like this..

in the at selection screen output please pop up the error message for all the field to be mandatory.. .then it is possible otherwise it is not possible

Former Member
0 Kudos

Don't set them as obligatory when you define them.

You could then instead use the AT SELECTION-SCREEN code event to check if S_EBELN is empty, e.g.

AT SELECTION-SCREEN.

if S_EBELN is initial.

if s_kdatb is initial.

message etc etc.

endif.

endif.

Former Member
0 Kudos

Hello Peter,

you can do it in the LOOP AT SCREEN.. ENDLOOP.

IF ( S_EBELN IS NOT INITIAL ) .

IF ( S_KDATB IS INITIAL AND

S_KDATE IS INTIAL ).

SCREEN-INPUT = 1.

ENDIF.

ENDIF.

Hope it helps you

Regards

Indu.