on 09-12-2011 7:07 AM
Hi all,
I am using Adobe interactive forms and within the onsubmitevent I have webdynpro code which calls a standard function 'FMFR_CREATE_FROM_DATA' to do commitments. See code snippet below. The problem is when there is an error from the function the function simply hangs and does not come out of it.. I have tested this function as standalone via SE37 and works perfectly and also from a normal ABAP program the error can be trapped. Is it possible to trap this within webdynpro?
CALL FUNCTION 'FMFR_CREATE_FROM_DATA'
EXPORTING
I_FLG_CHECKONLY = ' '
I_FLG_COMMIT = 'X'
TABLES
T_POSDATA = wa_fid_tab
CHANGING
C_F_HEADDATA = wa_fih
EXCEPTIONS
DOCTYPE_NOT_ALLOWED = 1
ERROR_OCCURED = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
RAISE EXCEPTION TYPE ZCX_NO_CC_BUDGET.
ELSE.
" Update RFP table with consolidated amount
" per CC/PC and commitment no.
UPDATE ZAD_RFP_T
SET CURRENCY_AMOUNT = RFP_TOTAL1
AMOUNT = RFP_TOTAL1
COMMITMENT_NO = wa_fih-belnr
WHERE DOCUMENT_ID = RFP_ID
AND LINE_ID = line_one .
ENDIF.
WebDynpro has a mesaage manager interface if_wd_message_manager. You can use one of the methods like report_t100_message instead of raising ZCX_NO_CC_BUDGET.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for th info but the problem seems to be that the process never returns from the call. We can use REPORT_T100_MESSAGE for reporting the error but I need something to check after the call to the function to see if the function was succesful or not, unfortunately the function just hangs. I've tried to debug the function to find out where it hangs (in order to give me some clues) but you have to go very deep into it. I give up after going 6 levels down.
I'm being hopeful but there must surely be a way of testing the result from a standard function call within webdynpro!!!
Thanks guys but i already tried this ie. uncommenting the exception but it never returns to the next line ie to theIF SY-SUBRC line in the code snippet below. The program simply hangs!!!
CALL FUNCTION 'FMFR_CREATE_FROM_DATA'
EXPORTING
I_FLG_CHECKONLY = ' '
I_FLG_COMMIT = 'X'
TABLES
T_POSDATA = wa_fid_tab
CHANGING
C_F_HEADDATA = wa_fih
EXCEPTIONS
DOCTYPE_NOT_ALLOWED = 1
ERROR_OCCURED = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
RAISE EXCEPTION TYPE ZCX_NO_CC_BUDGET.
ELSE.
" Update RFP table with consolidated amount
" per CC/PC and commitment no. -
UPDATE ZAD_RFP_T
SET CURRENCY_AMOUNT = RFP_TOTAL1
AMOUNT = RFP_TOTAL1
COMMITMENT_NO = wa_fih-belnr
WHERE DOCUMENT_ID = RFP_ID
AND LINE_ID = line_one .
ENDIF.
Okay, Found the solution on another thread. Do the following:-
Just disable all exceptions in the function module in the source code and add the generic statement "error_message = 1".
Ofcourse you now need to handle messages after execution of the function module - messages will not be shown on screen anymore,
So the code should look like this:
CALL FUNCTION 'FMFR_CREATE_FROM_DATA'
EXPORTING
i_flg_checkonly = space
i_flg_commit = 'X'
TABLES
t_posdata = pr_posdata
CHANGING
c_f_headdata = pr_head_data
EXCEPTIONS
doctype_not_allowed = 1
error_occured = 2
OTHERS = 3.
error_message = 1.
The above did the trick for me. I could now go on to check for sy-subrc and look at the system messages.
Thanks all for your time.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
RAISE EXCEPTION TYPE ZCX_NO_CC_BUDGET.
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.