‎2007 Feb 19 6:21 PM
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.
i try this soltion but its not working what i doing wrong?
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
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 19 7:25 PM
You may just use AT SELECTION-SCREEN ON VALUE-REQUEST FOR c_course.
Thanks,
Santosh
‎2007 Feb 19 6:29 PM
Try this:
data: gv_course like z_course_table-objid.
check not c_course[] is initial.
SELECT single objid
FROM hrp1001
INTO ( gv_course )
WHERE objid IN c_course.
IF sy-subrc NE 0.
MESSAGE 'Invalid course' TYPE 'E'.
ENDIF.
Thanks,
Santosh
‎2007 Feb 19 6:32 PM
hi Antonio,
you can restrict the F4 values to courses alone by using the following logic.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR c_course-low.
*======================================================
data: lv_f4_loc_objec like objec.
data: lv_f4_loc_csrfd like dynpread-fieldname.
data: lv_f4_loc_repid like sy-repid.
data: lv_f4_loc_dynnr like sy-dynnr.
* GET CURSOR FIELD f4_loc_csrfd.
lv_f4_loc_csrfd = c_course-low.
lv_f4_loc_repid = sy-repid.
lv_f4_loc_dynnr = sy-dynnr.
**Get the selected search help value
call function 'RH_OBJID_REQUEST'
exporting
plvar = '01'
otype = 'E' "Courses
seark_begda = sy-datum
seark_endda = '99991231'
dynpro_repid = lv_f4_loc_repid
dynpro_dynnr = lv_f4_loc_dynnr
dynpro_searkfield = lv_f4_loc_csrfd
set_mode = ' '
importing
sel_object = lv_f4_loc_objec
exceptions
* cancelled = 1
wrong_condition = 2
nothing_found = 3
illegal_mode = 4
internal_error = 5
others = 6.
**Move the selected value to the input field
if sy-subrc = 0.
c_course-low = lv_f4_loc_objec-objid.
endif.you can use the same logic for c_course-high also.
Hope this helps,
Sajan Joseph.
‎2007 Feb 19 6:44 PM
Hi Antonio,
Please try this.
INITIALIZATION.
SELECT objid
FROM hrp1001
INTO z_course_table-objid.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR c_course-low.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'OBJID'
DYNPROFIELD = 'C_COURSE'
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
VALUE_ORG = 'S'
TABLES
VALUE_TAB = z_course_table.
Regards,
Ferry Lianto
‎2007 Feb 19 7:04 PM
hi ferry
i will try your soltion but how i can bring a erorr messege when the user put course number that dosent existing .
regards
‎2007 Feb 19 7:12 PM
You need to create a text element which consists of error message.
check not c_course[] is initial.
SELECT single objid
FROM hrp1001
INTO ( gv_course )
WHERE objid IN c_course.
IF sy-subrc NE 0.
MESSAGE e001 WITH text-a05.
ENDIF.
Here, text-a05 can contain an error message like "Invalid course code".
Thanks,
Santosh
‎2007 Feb 19 7:12 PM
Hi Antonio.
Please try this.
AT SELECTION-SCREEN.
IF NOT c_course-low IS INITIAL.
READ TABLE z_course_table WITH KEY objid = c_course-low.
IF SY-SUBRC <> 0.
MESSAGE 'Pleas enter the value for course' TYPE 'E'.
ENDIF.
ENDIF.
Regards,
Ferry Lianto
‎2007 Feb 19 7:20 PM
hi ferry
when i use your code in?
AT SELECTION-SCREEN ON VALUE-REQUEST FOR c_course-low.
<b>or</b>
AT SELECTION-SCREEN ON VALUE-REQUEST FOR c_course-high.
regards
‎2007 Feb 19 7:25 PM
You may just use AT SELECTION-SCREEN ON VALUE-REQUEST FOR c_course.
Thanks,
Santosh
‎2007 Feb 19 7:25 PM
Hi Antonio,
You can use for both AT SELECTION-SCREEN ON VALUE-REQUEST FOR c_course-low and AT SELECTION-SCREEN ON VALUE-REQUEST FOR c_course-high.
AT SELECTION-SCREEN.
IF NOT c_course-low IS INITIAL.
READ TABLE z_course_table WITH KEY objid = c_course-low.
IF SY-SUBRC <> 0.
MESSAGE 'Pleas enter the value for course' TYPE 'E'.
ENDIF.
ENDIF.
IF NOT c_course-high IS INITIAL.
READ TABLE z_course_table WITH KEY objid = c_course-high.
IF SY-SUBRC <> 0.
MESSAGE 'Pleas enter the value for course' TYPE 'E'.
ENDIF.
ENDIF.
Hope this answers your question. If not, please let me know.
Regards,
Ferry Lianto
‎2007 Feb 19 7:42 PM
hi ferry
u mean l can use it like that for both (high and low)?
regards
AT SELECTION-SCREEN ON VALUE-REQUEST FOR c_course-low.
*======================================================
IF NOT c_course-low IS INITIAL.
READ TABLE z_course_table WITH KEY objid = c_course-low.
IF SY-SUBRC <> 0.
MESSAGE 'Pleas enter the value for course' TYPE 'E'.
ENDIF.
ENDIF.
REFRESH: c_course.
CLEAR: c_course.
PERFORM get_objid USING 'D'
CHANGING c_course-low.