Friday, October 28, 2016

Selection Screen with Maximum Selection (UP TO ... ROWS) MXSEL


constants gc_max_rows type tbmaxsel value '100000'
constants gc_default_rows type tbmaxsel value '200'

parameter p_mxsel type tbmaxsel obligatory default gc_default_rows.

initialization.
  select single tbmaxsel from rseumod into p_mxsel 

    where uname sy-uname.
  perform trim_mxsel.

at selection-screen on p_mxsel.
  perform trim_mxsel.

start-of-selection.
  p_mxsel p_mxsel + 1.
  select from ...
    into corresponding fields of table gt_my
    up to p_mxsel rows
    where
       ...
  if gt_my is initial.
    message s429(mo).     " no data found
    return.
  endif.
  if linesgt_my p_mxsel.
    
    delete gt_my index p_mxsel.
    message s016(eswith p_mxsel" result cut off
  endif.
  p_mxsel p_mxsel 1.


form trim_mxsel.
  if p_mxsel > gc_max_rowsp_mxsel gc_max_rowsendif.
  if p_mxsel < 1p_mxsel gc_default_rowsendif.
endform.

No comments:

Post a Comment

Working with the session Id // ID für den Modus

Sometimes it can be helpful to know the id of the current session     CALL FUNCTION 'TH_GET_CONTEXT_ID'       IMPORTING         cont...