PARAMETERS p_sub(40) TYPE c.

DATA fssub(40) TYPE c.
fssub = p_sub.

TRY.
    PERFORM (fssub) IN PROGRAM ydemo_rick_a. " IF FOUND.
  CATCH cx_sy_dyn_call_illegal_form.
    WRITE: 'The routine', p_sub COLOR 3, 'is not exist!'.
ENDTRY.
*&---------------------------------------------------------------------*
*&      Form  sub_a
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM sub_a.
  WRITE: 'Congratulation! I am routine SUB_A!'.
ENDFORM.                    "sub_a

*&---------------------------------------------------------------------*
*&      Form  sub_b
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM sub_b.
  WRITE: 'Congratulation! I am routine sub_b.'.
ENDFORM.                    "sub_b

***当程序中的FUC不存在的时候 可以补捉到异常报错

04-14 11:08