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

help in selection screen

Former Member
0 Likes
1,379

Hallow every one I have a program that check if employee do course and employee don't.

For that u have to choose course num ,the problem is that when the user choose course that not <b>valid</b> how can I bring error message for that tanks.

This is my declaration

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.

SELECT-OPTIONS c_course FOR z_course_table-objid

OBLIGATORY NO INTERVALS NO-EXTENSION.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,356

do course validation like below.

at selection-screen on c_course.

loop at c_course.

if not c_course-low is initial.

select single objid from z_course_table where objid = c_course-low.

if sy-subrc <> 0.

message e000(0) 'invalid code'.

endif.

endif.

if not c_course-high is initial.

select single objid from z_course_table where objid = c_course-high.

if sy-subrc <> 0.

message e000(0) 'invalid code'.

endif.

endif.

endloop.

13 REPLIES 13
Read only

Former Member
0 Likes
1,356

HI,

You have to validate the COURSE like this.

Select objid from z_course_table

Up to 1 rows where objid in c_couse.

If sy-subrc <> o.

Message < Course doesn't exist>

endif.

Regards,

Anji

Message was edited by:

Anji Reddy Vangala

Read only

0 Likes
1,356

Use At selection screen event for this -

At selection-screen.

select field1 from dbtab where field1 in c_course.

if sy-subrc ne 0.

message e000(000) with 'No course exists,enter valid course'.

endif.

here field1 is like course name.

dbtab is table storing course.

and c_course is select option.

amit

Read only

Former Member
0 Likes
1,356

hi,

perform validations and print the erroe message at the event

AT SELECTION-SCREEN.

hope this helps.

regards

Read only

Former Member
0 Likes
1,356

Hi ,

Use the following code.

At selection-screen on c_course .

check for course if entered is valid on or not .

give error message.

Consider this sample example.

AT SELECTION-SCREEN ON p_carrid.

IF p_carrid IS INITIAL.

MESSAGE 'Please enter a value' TYPE 'E'.

ENDIF.

AUTHORITY-CHECK OBJECT 'S_CARRID'

ID 'CARRID' FIELD p_carrid

ID 'ACTVT' FIELD '03'.

IF sy-subrc = 4.

MESSAGE 'No authorization for carrier' TYPE 'E'.

ELSEIF sy-subrc <> 0.

MESSAGE 'Error in authority check' TYPE 'A'.

ELSE.

IF sy-ucomm = 'ONLI'.

CALL SELECTION-SCREEN '0500'.

ENDIF.

ENDIF.

AT SELECTION-SCREEN.

IF sy-dynnr = '0500'.

IF s_conn IS INITIAL.

MESSAGE 'Please enter values' TYPE 'W'.

ELSE.

SELECT *

FROM sflight

INTO TABLE sflight_tab

WHERE carrid = p_carrid AND

connid IN s_conn.

IF sy-subrc <> 0.

MESSAGE 'No flights found' TYPE 'E'.

ENDIF.

ENDIF.

ENDIF.

Please reward if useful.

Read only

Former Member
0 Likes
1,356
AT SELECTION-SCREEN.

*Validate material no details
  PERFORM validate_matno.
FORM validate_matno.
  SELECT SINGLE matnr INTO v_matnr
         FROM mara
         WHERE matnr IN s_matnr.

  IF sy-subrc NE 0.
    MESSAGE i128.
    LEAVE LIST-PROCESSING.
  ENDIF.

ENDFORM.

Make sure that u are validating against the header table.

say eg if u wnat t validate matnr in marc, then do as below.

SELECT-OPTIONS: s_matnr FOR  marc-matnr.                  "Material No
AT SELECTION-SCREEN.

*Validate material no details
  PERFORM validate_matno.
FORM validate_matno.
DATA: v_matnr LIEK mara-matnr.
  SELECT SINGLE matnr INTO v_matnr
         FROM <b>mara</b>
         WHERE matnr IN s_matnr.

  IF sy-subrc NE 0.
    MESSAGE i128.
    LEAVE LIST-PROCESSING.
  ENDIF.

ENDFORM.

Dont select from marc.

Hope this is clear.

See ur code

AT SELECTION-SCREEN ON c_course.
IF NOT c_course[] IS INITIAL.
 SELECT objid FROM XXXX
              INTO z_course_table-objid
              WHERE objid IN c_course.
IF sy-subrc NE 0.
 message e000 WITH 'Cousre ID not valid'.
ENDIF.
ENDIF.

XXXX refers to the check table for the field objid in z_couse_table.

Message was edited by:

Judith Jessie Selvi

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,356

Hi

You can validate the course using the below code:

At selection-screen on course.

Select <course> from <table which consists of valid values for this course>

Up to 1 rows

where course in <c_couse>.

If sy-subrc <> o.

Message< Couse doesn't exist>

endif.

Regards,

kumar

Read only

Former Member
0 Likes
1,356

hello

i think u can use

at selection screen.

use a select statement.....to find with selection as course id and employee id.

then u can trow a message accordingly.

Read only

Former Member
0 Likes
1,356

validate course details in AT Selection-Screen event block and if there is erro u can display using 'MESSAGE'....

Read only

Former Member
0 Likes
1,357

do course validation like below.

at selection-screen on c_course.

loop at c_course.

if not c_course-low is initial.

select single objid from z_course_table where objid = c_course-low.

if sy-subrc <> 0.

message e000(0) 'invalid code'.

endif.

endif.

if not c_course-high is initial.

select single objid from z_course_table where objid = c_course-high.

if sy-subrc <> 0.

message e000(0) 'invalid code'.

endif.

endif.

endloop.

Read only

0 Likes
1,356

There is no need for low and high as u have specified in SELCT-options no intervals and no-extentions so only general check is fine

See the code

AT SELECTION-SCREEN ON c_course.
IF NOT c_course[] IS INITIAL.
 SELECT objid FROM XXXX
              INTO z_course_table-objid
              WHERE objid IN c_course.
IF sy-subrc NE 0.
 message e000 WITH 'Cousre ID not valid'.
ENDIF.
ENDIF.

XXXX refers to the check table for the field objid in z_couse_table. If no check table then use z_course_table instead of XXXX.

Read only

0 Likes
1,356

Hi judith

I try your suggestion and it still don’t working maybe u have idea why

And when I try with this kind of messege(message e000 WITH 'Cousre ID not valid'.) I have this error

A message ID has not been entered. You can specify this entry for thewhole program using the "MESSAGE-ID msgid" addition with the statment

I change the messege for new and I don’t have error but it not work

and when i put break point its not going to this place .

<b>regards</b>

AT SELECTION-SCREEN ON VALUE-REQUEST FOR c_course-low.

*======================================================

IF NOT c_course[] IS INITIAL.

SELECT objid FROM hrp1001

INTO z_course_table-objid

WHERE objid IN c_course.

IF sy-subrc NE 0.

MESSAGE 'Pleas enter the value for course' TYPE 'E'.

ENDIF.

ENDSELECT.

ENDIF.

*

  • REFRESH: c_course.

  • CLEAR: c_course.

PERFORM get_objid USING 'D'

CHANGING c_course-low.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR c_course-high.

*======================================================

  • IF c_course-high IS INITIAL.

  • MESSAGE 'Pleas enter the value for course' TYPE 'E'.

  • ENDIF.

REFRESH: c_course.

CLEAR: c_course.

PERFORM get_objid USING 'D'

CHANGING c_course-high.

Read only

0 Likes
1,356

Hi,

My code will work exactly, u have to include ur message id in ur REPORT statement.

REPORT YTEST <b>MESSAGE-ID zc.</b>

Goto <b>SE91</b> and search for a message class. Specify in the place of Zc.

Then see the message number which is having <b>& &</b> either one or more should be there, take that message number and use it inplace of 000.

Message e000(zc) WITH 'Pleas enter the value for course' .
OR
Message e000 WITH 'Pleas enter the value for course'

Hope u are clear now.

If u have the same text message in the Message class u can direclty specify the number as

Message e210(zc).

Please reply me if u need clarification.

Read only

Former Member
0 Likes
1,356

Hi every one I try your suggestion and I do like that but its not working what is the problem?

LOOP AT c_course.

IF c_course-low IS NOT INITIAL.

SELECT SINGLE objid

FROM hrp1001

INTO wa_s_tab

WHERE objid = c_course-low.

IF sy-subrc <> 0.

MESSAGE 'Vaild Course' TYPE 'E'.

ELSE.

ENDIF.

EXIT.

ENDIF.

ENDLOOP.

regards