Function的exceptions部份,要設定
error_message = n
才能阻擋function發出錯誤訊息
然而此法只對message type = E, A有效
如為X則仍然會強制跳出,成為short dump
DATA lv_text LIKE t100-text.
DATA: lv_msgv1 TYPE symsgv,
lv_msgv2 TYPE symsgv,
lv_msgv3 TYPE symsgv,
lv_msgv4 TYPE symsgv.
SELECT SINGLE text FROM t100 INTO lv_text
WHERE sprsl = 'M'
AND arbgb = gt_msgtab-msgid
AND msgnr = gt_msgtab-msgnr.
lv_msgv1 = gt_msgtab-msgv1. "Function或BDC傳出的錯誤訊息
lv_msgv2 = gt_msgtab-msgv2.
lv_msgv3 = gt_msgtab-msgv3.
lv_msgv4 = gt_msgtab-msgv4.
CALL FUNCTION 'FIEB_REPLACE_AMPERSAND_MESSAGE'
EXPORTING
im_text = lv_text
im_msgv1 = lv_msgv1
im_msgv2 = lv_msgv2
im_msgv3 = lv_msgv3
im_msgv4 = lv_msgv4
IMPORTING
ex_text = lv_text.
沒有留言:
張貼留言