I am pretty new at ABAP and I try to learn Function Modules in ABAP. I create a function and give it parameters for IMPORT and EXPORT,TABLES also I want to give an exception to the user while he/she make something what I don't want.
So, I have two import parameters which are: These lines are the column items for Import and Export fields.
i_x TYPE xx
i_type TYPE char2
I have 1 table parameters which is :
et_xx_sorted LIKE xx 'this is an exception'
I have 1 exception line :
MAX_RECORD 'There is no record for this.'
My source code is :
SELECT * INTO TABLE et_xx_sorted[] FROM xx WHERE yy = i_x.
I want to use the my exception line when user give an input to i_x which is maximum than the border which I choose. I mean there is numbers 1 to 30 , but I want that user just can give 1 to 20. He/she can not give 20 to 30. And if there is an input into 20 to 30, program needs to give MAX_RECORD exception and say to the user 'There is no record for this.'
I used :
IF sy-subrc <> 0.
MESSAGE 'No record' TYPE 'E' RAISING MAX_RECORD.
ENDIF.
But this is not what I want. There is a line for 20 - 30 so this code block isnt work for my border items. There is 1 to 30 lines but user only can see 1 to 20. And if he/she give 20 to 30 then program should give an exception using which I determined into EXCEPTIONS field.