I wrote program to display shopping cart (SC) details in SRM server. In my program I put validations on select -options. It's working fine but if I provide any random range for example 9990000000 to 9999999999 for sc ,all SCs between this range should display but it’s throwing error message as I kept validation on low and high value. Because of this my trainer said putting validation on select-options is not preferable. He gave me new assignment that Apart from doing validation I should restrict user to enter only valid value to input field. How can I achieve this? Please give me full code.
DATA : lv_shc TYPE crmd_orderadm_h-object_id .
*DATA : lv_shc TYPE z_obj_id.
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-111.
*SELECT-OPTIONS : s_shc FOR crmd_orderadm_h-object_id VALUE-REQUEST.
SELECT-OPTIONS : s_shc FOR lv_shc .
SELECTION-SCREEN END OF BLOCK a1.
INCLUDE zsrmi_declarations1.
*validations.
AT SELECTION-SCREEN ON s_shc .
IF s_shc IS NOT INITIAL.
IF s_shc-low IS NOT INITIAL.
SELECT SINGLE object_id FROM crmd_orderadm_h INTO lv_shc WHERE object_id = s_shc-low AND object_type = 'BUS2121'.
IF sy-subrc <> 0.
MESSAGE text-001 TYPE 'E'.
EXIT.
ENDIF.
ENDIF.
IF s_shc-high IS NOT INITIAL.
SELECT SINGLE object_id FROM crmd_orderadm_h INTO lv_shc WHERE object_id = s_shc-high AND object_type = 'BUS2121'.
IF sy-subrc <> 0.
MESSAGE text-001 TYPE 'E'.
EXIT.
ENDIF.
ENDIF.
ENDIF.