cancel
Showing results for 
Search instead for 
Did you mean: 

exit variable to check the user input only to restrict 5 years

former_member198992
Participant
0 Kudos

Dear All,

When a query is executed at the variable screen , I need to restrict user to enter the 0fiscalyear with only 5 years.

variable takes multiple values.

If the user selects more than 5 vaules , the user will get a error message.

I have created the fiscalyear exit variable to take multiple values and struck up how to write the code.

pls could some one help me with the code.

Regards,

Veera

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can check the values of the variable in I_STEP = 3. In this step for your specific variable, when it is more than 5 values, then you need to trigger a exception (RAISE) so that the variable screen appears again. I_STEP = 2 is then also called again.

http://help.sap.com/saphelp_nw70/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/frameset.htm

Data l_count TYPE i.

IF i_step = 3.
  CLEAR l_count.
  LOOP AT i_t_var_range INTO loc_var_range
                 WHERE vnam = '<your variable>''.
    l_count = l_count + 1.
   IF l_count  > 5.
      CALL FUNCTION 'RRMS_MESSAGE_HANDLING'
        EXPORTING
          i_class  = 'RSBBS'
          i_type   = 'E'
          i_number = '000'
          i_msgv1  = 'You can enter only 5 Fiscal years''.
      RAISE no_replacement.
      EXIT.
    ENDIF.
  ENDLOOP.
ENDIF.

Answers (0)