on 05-23-2012 6:14 AM
Hi,
Hi,
We are using the handcraft solution for the development based on Duet Future pack 1 development guide.
But I am not able to display the text in output. It is getting only Id and text is displaying like <text>S:LR:221</text>
Please see the below code for adding bapi message in post mapper method and also output for the same.
Can you please help me on this if you have any idea about this problem.
call method lo_message_container->add_message
exporting
is_object_key = ls_key
iv_msg_type = ls_response_return-type "/iwcnt/cl_bec_bpc_cust_const=>gc_error_message"'E'
iv_msg_id = ls_response_return-id "/iwcnt/cl_bec_bpc_cust_const=>gc_iwcnt_service_msgclass"'/IWCNT/SERVICES'
iv_msg_number = ls_response_return-number"/iwcnt/cl_bec_bpc_cust_const=>gc_message_number_012 "'012'
IV_MSG_TEXT = ls_response_return-MESSAGE
iv_msg_v1 = ls_response_return-MESSAGE_V1 "lv_msgv1
iv_msg_v2 = ls_response_return-MESSAGE_V2"lv_msgv2
iv_message_creator = 'SAS' ."/iwcnt/cl_bec_bpc_cust_const=>gc_tango_ser_appl.
output
<nm:StandardMessageFault_LM xmlns:nm="http://sap.com/xi/SAPGlobal/Global" xmlns:prx="urn:sap.com:proxy:NW1:/1SAI/TAS9EF2D25AC1590B315401:702">
- <standard>
<faultText>Standard Message Fault</faultText>
- <faultDetail>
<severity>error</severity>
<text>S:LR:221</text>
<id>221(LR)</id>
</faultDetail>
- <faultDetail>
<severity>error</severity>
<text>S:LR:221</text>
<id>221(LR)</id>
</faultDetail>
- <faultDetail>
<severity>warning</severity>
<text>The SAP system could not process your request. Contact your administrator</text>
<url>http://MSTCNW702.litware.com:8000/sap/xi/docu_apperror?ID=NA&OBJECT=%2fIWFND%2fCOD011&LANGUAGE=E</url>
<id>011(/IWFND/COD)</id>
</faultDetail>
</standard>
</nm:StandardMessageFault_LM>
<
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vishal,
The error is coming while tesing the SPROXY service.not in sharepoint external list.
Please see the below code for adding bapi message in post mapper method and also output for the same.
* loop through the results
LOOP AT ls_response_rfc-return INTO ls_response_return.
* check for error conditions
IF ls_response_return-type EQ 'E' OR ls_response_return-type EQ 'A'.
* if there was an error
ls_key-value = 'na'.
* ls_key-scheme_agency_id = iv_system_alias.
lv_msg_text = ls_response_return-message.
* add a message to the message container. This is the message that will be logged
* in SharePoint and shown in the SharePoint UI
* as well so it is important to add a useful message here
CALL METHOD lo_message_container->add_messages_from_bapi
EXPORTING
is_object_key = ls_key " ID of the object whose proccessing caused the errors
it_bapi_messages = ls_response_rfc-return " Table of BAPIRET2 messages
iv_message_creator = /capnwlm/cl_constants=>lc_tango_ser_appl. “’SAS’"'.
* lo_message_container->add_message_text_only( is_object_key = ls_key
* iv_msg_type = /iwfnd/cl_logger=>error
* iv_msg_text = lv_msg_text "à this TEXT IS FROM bapi response
* iv_error_category = /iwfnd/if_message_container=>gcs_error_category-processing
* iv_is_leading_message = abap_true
* iv_message_creator = 'SAS' ). " /capnwlm/cl_constants=>lc_tango_ser_appl ).
** Create your own message class and add the message accordingly..
* call method lo_message_container->add_message
* exporting
* is_object_key = ls_key
* iv_msg_type = ls_response_return-type "/iwcnt/cl_bec_bpc_cust_const=>gc_error_message"'E'
* iv_msg_id = ls_response_return-id "/iwcnt/cl_bec_bpc_cust_const=>gc_iwcnt_service_msgclass"'/IWCNT/SERVICES'
* iv_msg_number = ls_response_return-number"/iwcnt/cl_bec_bpc_cust_const=>gc_message_number_012 "'012'
* IV_MSG_TEXT = ls_response_return-MESSAGE
* iv_msg_v1 = ls_response_return-MESSAGE_V1 "lv_msgv1
* iv_msg_v2 = ls_response_return-MESSAGE_V2"lv_msgv2
* iv_is_leading_message = abap_true
* iv_message_creator = 'SAS' ."/iwcnt/cl_bec_bpc_cust_const=>gc_tango_ser_appl.
" Name of the Component which created the message
* set the result code to failed in order to trigger creating a fault message
CALL METHOD io_request_context->set_result_code
EXPORTING
iv_result_code = /iwfnd/if_srd_request_context=>cs_result_code-failed_permanent.
* this code controls the further flow so in case of an error code
* no subsequent Mappers will be processed
ev_process_code = /iwfnd/if_srd_bop_map=>cs_process_code-fail_operation.
ENDIF.
ENDLOOP.
Output:
- <nm:StandardMessageFault_LM xmlns:nm="http://sap.com/xi/SAPGlobal/Global" xmlns:prx="urn:sap.com:proxy:NW1:/1SAI/TAS9EF2D25AC1590B315401:702">
- <standard>
<faultText>Standard Message Fault</faultText>
- <faultDetail>
<severity>warning</severity>
<text>S:LR:206 16.00 8.00</text>
<id>206(LR)</id>
</faultDetail>
- <faultDetail>
<severity>error</severity>
<text>S:LR:221</text>
<id>221(LR)</id>
</faultDetail>
- <faultDetail>
Regards,
Venkat.
Hi Venkat,
Can you uncomment the add_message piece of code and make the message as leading message.
call method lo_message_container->add_message
exporting
is_object_key = ls_key
iv_msg_type = ls_response_return-type "/iwcnt/cl_bec_bpc_cust_const=>gc_error_message"'E'
iv_msg_id = ls_response_return-id "/iwcnt/cl_bec_bpc_cust_const=>gc_iwcnt_service_msgclass"'/IWCNT/SERVICES'
iv_msg_number = ls_response_return-number"/iwcnt/cl_bec_bpc_cust_const=>gc_message_number_012 "'012'
IV_MSG_TEXT = ls_response_return-MESSAGE
iv_msg_v1 = ls_response_return-MESSAGE_V1 "lv_msgv1
iv_msg_v2 = ls_response_return-MESSAGE_V2"lv_msgv2
iv_is_leading_message = abap_true
iv_message_creator = 'SAS' ."/iwcnt/cl_bec_bpc_cust_const=>gc_tango_ser_appl.
The parameters with Bold are most important while adding the message to message container.
Hi Advay,
Thank you for your reply.
I have uncommented the add_messge code and added the abap_true stement also but still text is not coming . Only coming out id and variables message_v1 and message_v2(
<text>S:HRTIM00REC:014 01 EARN</text> ).
Please see the below code and help me if anything we are missing.
Here is my code in post mapper method.
---------------------------------------------------------------------------------------------------------------------------------------------------
* cast the generic BOP interface do to the specific generated BOP
lo_bop_do ?= io_bop_do.
* fill the key structure fields that are constant in the error or non error case
ls_key-scheme_id = 'CAPNWLM~CRUD'. ""SCL Business Object (GSDO Type) to be used
ls_key-scheme_agency_id = iv_system_alias.
lo_message_container = io_request_context->get_message_container( ).
* if the instance was created
IF io_gsdo IS BOUND.* save the old id
es_id_mapping-old_id = io_gsdo->get_id( ).
* get the root node
lo_gsdo_root_node = io_gsdo->get_root_node( ).
* get the RFC response
lo_bop_do->get_response( IMPORTING es_response = ls_response_rfc ).
lt_catsrecords_out = ls_response_rfc-catsrecords_out.
* if there were return results
* READ TABLE ls_response_rfc-return INTO ls_response_return INDEX 1.
* check for error conditions
IF ls_response_return-type EQ 'E' OR ls_response_return-type EQ 'A'.
* if there was an error
ls_key-value = 'na'.
lv_msg_text = ls_response_return-message.
** Create your own message class and add the message accordingly..
call method lo_message_container->add_message
exporting
is_object_key = ls_key
iv_msg_type = ls_response_return-type "/iwcnt/cl_bec_bpc_cust_const=>gc_error_message"'E'
iv_msg_id = ls_response_return-id "/iwcnt/cl_bec_bpc_cust_const=>gc_iwcnt_service_msgclass"'/IWCNT/SERVICES'
iv_msg_number = ls_response_return-number"/iwcnt/cl_bec_bpc_cust_const=>gc_message_number_012 "'012'
IV_MSG_TEXT = ls_response_return-MESSAGE
iv_msg_v1 = ls_response_return-MESSAGE_V1 "lv_msgv1
iv_msg_v2 = ls_response_return-MESSAGE_V2"lv_msgv2
iv_is_leading_message = abap_true
iv_message_creator = 'SAS' ."/iwcnt/cl_bec_bpc_cust_const=>gc_tango_ser_appl.
" Name of the Component which created the message
* set the result code to failed in order to trigger creating a fault message
CALL METHOD io_request_context->set_result_code
EXPORTING
iv_result_code = /iwfnd/if_srd_request_context=>cs_result_code-failed_permanent.
* this code controls the further flow so in case of an error code
* no subsequent Mappers will be processed
ev_process_code = /iwfnd/if_srd_bop_map=>cs_process_code-fail_operation.
ENDIF.
ENDLOOP.
ENDIF.
IF ev_process_code <> /iwfnd/if_srd_bop_map=>cs_process_code-fail_operation .
* LOOP AT lt_catsrecords_out INTO ls_catsrecords_out .
READ TABLE lt_catsrecords_out INTO ls_catsrecords_out INDEX 1.
IF sy-subrc = 0.
ls_key-value = ls_catsrecords_out-employeenumber. "Sclkey.
lo_gsdo_root_node->set_key( is_key = ls_key ).
* set the new id, this is very important otherwise the key will not be returned* correctly to the calling server proxy
es_id_mapping-new_id = io_gsdo->get_id( ).
ENDIF.
* ENDLOOP.
ENDIF.
ENDIF.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Output:
- <nm:StandardMessageFault_LM xmlns:nm="http://sap.com/xi/SAPGlobal/Global" xmlns:prx="urn:sap.com:proxy:NW1:/1SAI/TAS9EF2D25AC1590B315401:702">
- <standard>
<faultText>Standard Message Fault</faultText>
- <faultDetail>
<severity>error</severity>
<text>S:HRTIM00REC:014 01 EARN</text>
<id>014(HRTIM00REC)</id>
</faultDetail>
- <faultDetail>
<severity>error</severity>
<text>S:LR:221</text>
<id>221(LR)</id>
</faultDetail>
- <faultDetail>
<severity>error</severity>
<text>S:LR:221</text>
<id>221(LR)</id>
</faultDetail>
- <faultDetail>
<severity>warning</severity>
<text>The SAP system could not process your request. Contact your administrator</text>
<url>http://MSTCNW702.litware.com:8000/sap/xi/docu_apperror?ID=NA&OBJECT=%2fIWFND%2fCOD011&LANGUAGE=E</url>
<id>011(/IWFND/COD)</id>
</faultDetail>
</standard>
</nm:StandardMessageFault_LM>
Thanks & Regards,
Venkat.
Hi Venkat,
The add_message () method of class /IWFND/IF_MESSAGE_CONTAINER, expects a message class and message id. In you code, you are passing these 2 values (which are nothing but message class and message number of the BACKEND system).
The message class, I assume is HRTIM00REC and message number being 014.
As this specific message class is not present in Gateway system, it just prints the name of the class.
What you can do is, create your own message class (via SE91), and create a new message "Business exception &1 &2"
In the varible you can pass the exact error that is thrown by backend RFC.
call method lo_message_container->add_message
exporting
is_object_key = ls_key
iv_msg_type = ls_response_return-type "/iwcnt/cl_bec_bpc_cust_const=>gc_error_message"'E'
iv_msg_id = Your Message Class (ZAPP_MSG)
iv_msg_number = Your Message Number
IV_MSG_TEXT = ls_response_return-MESSAGE
iv_msg_v1 = ls_response_return-MESSAGE_V1 "lv_msgv1
iv_msg_v2 = ls_response_return-MESSAGE_V2"lv_msgv2
iv_is_leading_message = abap_true
iv_message_creator = 'SAS' ."/iwcnt/cl_bec_bpc_cust_const=>gc_tango_ser_appl.
Let me know if this works for you.
BR, Advay
Hi,
is possible return messages BAPIRETURN without throwing exception??
Best regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.