Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
method DERIVE_HANDLER.
* Loops through the patterns trying to find a match on the URL's path info
* If it finds one, it returns the corresponding handler class name, plus
* an optional list of matched strings from parentheses in the pattern
data:
l_path type char255
, ls_handler type ty_handler
, lt_match type match_result_tab
, ls_match type match_result
, ls_submatch type submatch_result
.
field-symbols: <submatch> type any.
loop at handlers into ls_handler.
find regex ls_handler-pattern in path results lt_match.
if sy-subrc = 0.
class = ls_handler-handler.
read table lt_match into ls_match index 1.
l_path = path.
loop at ls_match-submatches into ls_submatch.
assign l_path+ls_submatch-offset(ls_submatch-length) to <submatch>.
append <submatch> to matches.
endloop.
exit.
endif.
endloop.
endmethod.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment