‎2007 Feb 19 11:51 AM
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.
‎2007 Feb 19 12:00 PM
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.
‎2007 Feb 19 11:56 AM
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
‎2007 Feb 19 11:59 AM
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
‎2007 Feb 19 11:57 AM
hi,
perform validations and print the erroe message at the event
AT SELECTION-SCREEN.
hope this helps.
regards
‎2007 Feb 19 11:58 AM
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.
‎2007 Feb 19 11:58 AM
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
‎2007 Feb 19 11:58 AM
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
‎2007 Feb 19 11:59 AM
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.
‎2007 Feb 19 11:59 AM
validate course details in AT Selection-Screen event block and if there is erro u can display using 'MESSAGE'....
‎2007 Feb 19 12:00 PM
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.
‎2007 Feb 19 1:45 PM
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.
‎2007 Feb 19 2:25 PM
Hi judith
I try your suggestion and it still dont 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 dont 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.
‎2007 Feb 20 5:58 AM
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.
‎2007 Feb 19 2:27 PM
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