05-18-2009 9:29 PM
Hello SDN partners.
I'm programing a RFC function that uses FMFR_CREATE_FROM_DATA to create commitment funds ( trx FMZ1). That function when makes data validations gives an error message type and consecuently it finish the execution of my RFC, without using exceptions.
How can i manage or capture that message error to execute the RFC function?.
Thanks
Greetings
Edison Alcaide.
Sap-Abap Consultant
05-18-2009 9:40 PM
Hi,
Create one more parameter in TABLES tab in your RFC function module
appned the exceptions from FMFR_CREATE_FROM_DATA to that table.
after finishing your RFC loop through that internal table ans display it in a report
Regards
Krishna
05-18-2009 9:40 PM
Hi,
Create one more parameter in TABLES tab in your RFC function module
appned the exceptions from FMFR_CREATE_FROM_DATA to that table.
after finishing your RFC loop through that internal table ans display it in a report
Regards
Krishna
05-18-2009 9:52 PM
Hello Krishna
Thanks for answering but the problem is that exceptions from FMFR_CREATE_FROM_DATA are not launched after the call. It just give me a message error at status bar. In debugginf mode i found that message comes from a validation subrutine that doesn't uses exception raising.
I wonder if it's possible to catch that message before ?.
Thanks again.
Edison
07-21-2009 5:17 PM
Hello Edison,
Have you solved you problem with FMFR_CREATE_FROM_DATA showing message without return? Could you please share the solution?
Thank you in advance!
Kirill
Edited by: Kirill Trunov on Jul 21, 2009 6:17 PM
07-21-2009 6:09 PM
Hello Kirill
I solved the problem, it wasn't very easy because i have to debug a lot to find how the function sends the message. I remember that it uses an internal table for messages and then uses a function to send the message out.
To capture that message before i proceed this way.
First Initialize the message capture with MESSAGES_INITIALIZE function with this parameters at program beginning, to avoid showing the messages on screen:
CALL FUNCTION 'MESSAGES_INITIALIZE'
EXPORTING
collect_and_send = ' '
RESET = 'X'
line_from = ' '
line_to = ' '
i_store_duplicates = 'X'
i_no_duplicate_count = 500
check_on_commit = 'X'
i_allow_foreign_reset = 'X'
i_reset_line = 'X'
EXCEPTIONS
log_not_active = 1
wrong_identification = 2
OTHERS = 3.
Next call the function FMFR_CREATE_FROM_DATA and if sy-subrc ne 0 call the function MESSAGE GIVE and store the result on internal table.
CALL FUNCTION 'MESSAGES_GIVE'
TABLES
t_mesg = l_t_msg
EXCEPTIONS
OTHERS = 1.
Then you can print the table as log.
If you have something familiar let me now.
Thanks a lot, greetings
Edison
07-22-2009 7:41 AM
Hello Edison,
Just tried you code. It works!
Thank you a lot!
Regards,
Kirill
Edited by: Kirill Trunov on Jul 22, 2009 8:46 AM
07-29-2009 11:11 PM
Edison,
Thanks for your response. We are using FMFR_CREATE_FROM_DATA, and were encountering situations where postings were returning with errors that were only applicable to previous postings. By including a call to MESSAGES_INITIALIZE at the top of our module, and simply passing RESET = 'X', we were able to resolve the issue.
Zac
04-30-2010 3:17 AM
Hi Zac,
In one of our requirement, We are trying to use this
CALL FUNCTION 'MESSAGES_INITIALIZE' to capture the error messages from function module FMFR_CREATE_FROM_DATA.
But we couldn't succeed.Can you please explain in detail how to use these MESSAGES_INITIALIZE and MESSAGES_GIVE function modules.Are there any Parameters values that need to be passed?
Thanks
Lokesh
04-30-2010 3:18 AM
Hi Kirill,
In one of our requirement, We are trying to use this
CALL FUNCTION 'MESSAGES_INITIALIZE' to capture the error messages from function module FMFR_CREATE_FROM_DATA.
But we couldn't succeed.Can you please explain in detail how to use these MESSAGES_INITIALIZE and MESSAGES_GIVE function modules.Are there any Parameters values that need to be passed?
Thanks
Lokesh
Edited by: Lokesh Reddy on Apr 30, 2010 4:19 AM
11-18-2010 10:01 AM
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.
09-12-2011 12:19 PM
Thanks Guss. Just did as you mentioned in your last post and it worked. Thanks to all once again.