if (!FileType.equals("F")){ String Error = "This file is not valid..hence this message should fail and subsequently get canceled.."; java.util.Map param = container.getTransformationParameters(); String MessageID = (String) param.get (StreamTransformationConstants.MESSAGE_ID); Error = Error + "#" + MessageID; // Appending message id with error message DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); DynamicConfigurationKey keyHeader1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/ERROR", "ERROR"); conf.put(keyHeader1, Error); } return ""; |
************************************************************************ * Short description :This ABAP mapping is usedfor cancelling XI messages* * Message id of the message is passed from a udf in * * message mapping. * * If exception is not set in message mapping, it passes the message as * * it is. In other words, it is used only to cancel the message * * if no exception is set in message mapping, it does nothing * and passes the data as it is ....Note the last lines of code (RESULT = SOURCE).. ************************************************************************ ************************************************************************ method IF_MAPPING~EXECUTE. DATA l_record type mpp_dynamic. DATA: l_exception_raised type String, task type char10, l_msg_id type string, "variable to hold message id l_msg type string. "exception message to be displayed Constants: l_c_error_number type MPG_ERRCODE value '010'. * getting dynamic configuration value * filled in by any previous mapping (if an exception was set in message mapping) CALL METHOD DYNAMIC_CONFIGURATION->GET_RECORD EXPORTING NAMESPACE = 'http://sap.com/xi/XI/System/ERROR' NAME = 'ERROR' RECEIVING RECORD = l_record . *if l_record is not initial. l_exception_raised = l_record-value. if l_exception_raised is not initial. *& Exception message set in XI, would have a message and a message id. *& message and message id are separated by #. split l_exception_raised at '#' into l_msg l_msg_id . " separating message and message id here *& Pass this message id to RFC to cancel it. if l_msg_id is not initial. CALL FUNCTION 'ZPI_CANCEL_MESSAGES' STARTING NEW TASK task EXPORTING MESSAGE_ID = l_msg_id. "Message id endif. RAISE EXCEPTION TYPE CX_MAPPING_FAULT EXPORTING * TEXTID = * PREVIOUS = ERROR_CODE = l_c_error_number ERROR_TEXT = l_msg. " Message to be passed to display in ERROR Segment of the failed message endif. *& if no exception message was set..passing the source data as it is RESULT = SOURCE. "If no exception message was set, pass the data as it is "since it is a successful message. endmethod. |
FUNCTION ZPI_CANCEL_MESSAGES. *"-------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" VALUE(MESSAGE_ID) TYPE STRING *"-------------------------------------------------------------------- *"-------------------------------------------------------------------* *& Description: This FM takes input an xml message id and calls a * * custom report which cancels this message * * This XML message id is passed from message mapping * *--------------------------------------------------------------------* DATA: text TYPE c LENGTH 100, rspar_tab TYPE TABLE OF rsparams, rspar_line LIKE LINE OF rspar_tab, range_tab LIKE RANGE OF text, range_line LIKE LINE OF range_tab, date1 like sy-datum, date2 like sy-datum, time1 TYPE sy-uzeit, time2 TYPE sy-uzeit. date1 = sy-datum - 1. "Setting the date1 to yesterday time1 = '000000'. " variable Time1 from 000000 date2 = sy-datum. "putting today's date. time2 = '235959'. "Setting time for today's date. range_line-sign = 'E'. range_line-option = 'EQ'. range_line-low = MESSAGE_ID. APPEND range_line TO range_tab. *--Wait for 30 seconds.. WAIT UP TO 30 SECONDS. *--Calling the report to cancel the message. submit ZRSXMB_CANCEL_MESSAGES with exedate eq date1 with exe2date eq date2 with exetime eq time1 with exe2time eq time2 with msgguid in range_tab with test eq ' ' with l_answer eq 1. ENDFUNCTION. |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 |