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

Obligatory fields in selection-screen

Former Member
0 Likes
1,233

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
Read only

JozsefSzikszai
Active Contributor
0 Likes
1,198

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
Read only

Former Member
0 Likes
1,197

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

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,199

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

Read only

valter_oliveira
Active Contributor
0 Likes
1,197

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.

Read only

Former Member
0 Likes
1,197

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

Read only

Former Member
0 Likes
1,197

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

Read only

Former Member
0 Likes
1,197

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.

Read only

Former Member
0 Likes
1,197

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.