on 12-07-2011 3:58 AM
Dear all,
I need your inputs to solve the below mentioned issue,
There is a communication developed between MS sharepoint and SAP.
By using Mapper Classes for each and every operations the conversion of data format from Sharepoint to SAP and viceversa happens.
We can see the message or error logs created during the conversion process using the T-code /iwfnd/view_log.
But i want my custumized messages has to come in that log for that i used the following code in the mapper class Post method but still my logs are not coming in the T-code /iwfnd/view_log.
DATA: lo_logger TYPE REF TO /iwfnd/cl_logger,"logger singleton
lo_message_container TYPE REF TO /iwfnd/if_message_container,"message container
lv_message TYPE bapi_msg,
lv_log_material TYPE symsgv,
lv_log_plant TYPE symsgv,
lv_instance_counter TYPE i,
lv_previous_pur_doc TYPE char10.
CONSTANTS gc_log_agent_name TYPE /iwfnd/sup_iw_agent VALUE 'Dev Guide Purchase Req'.
CONSTANTS gc_log_msg_id TYPE symsgid VALUE 'ZDUET_SCL_PR'.
Get logger
CALL METHOD /iwfnd/cl_logger=>get_logger
RECEIVING
ro_logger = lo_logger.
initialize the post mapper log step
lo_logger->log_step_init(
EXPORTING iv_msg_number = 000 "Post Mapping started for Purchase Req Header Query
iv_msg_id = gc_log_msg_id " message class
iv_system_alias = iv_system_alias "Backend System Alias
iv_agent = gc_log_agent_name "Dev Guide Purchase Req
RECEIVING
rv_msg_handle = lv_msg_handle ).
lo_logger->log_message(
EXPORTING
iv_msg_type = /iwfnd/cl_logger=>info " Message Type
iv_msg_id = gc_log_msg_id " Message Class
iv_msg_number = 006 " Message Number
iv_msg_v1 = lv_instance_counter " Message Variable
iv_system_alias = iv_system_alias " System Alias
iv_agent = gc_log_agent_name " IW Agent
).
Else
read through the input parameters for logging query parameters
READ TABLE it_parameters INTO ls_parameters WITH KEY attr_name = 'MATERIAL'.
lv_log_material = ls_parameters-low.
READ TABLE it_parameters INTO ls_parameters WITH KEY attr_name = 'PLANT'.
lv_log_plant = ls_parameters-low.
get the message container to add messages
lo_message_container = io_request_data->get_message_container( ).
set the request result code to failed so a fault message can be created
CALL METHOD io_request_data->set_result_code
EXPORTING
iv_result_code = /iwfnd/if_srd_request_context=>cs_result_code-failed_permanent.
add the message to the message container, this will create an error log entry automatically
CALL METHOD lo_message_container->add_message
EXPORTING
is_object_key = ls_key
iv_msg_type = 'E' "Error
iv_msg_id = gc_log_msg_id
iv_msg_number = 004 "Query for Material &1 and Plant &2 returned no results.
iv_msg_v1 = lv_log_material
iv_msg_v2 = lv_log_plant
iv_is_leading_message = abap_true
iv_message_creator = gc_log_agent_name.
Endif.
end this post mapper log step
lo_logger->log_step_completion( EXPORTING
iv_msg_type = /iwfnd/cl_logger=>info
iv_msg_id = gc_log_msg_id
iv_msg_number = 002 "Post Mapping finished for Purchase Req Header Query
iv_system_alias = iv_system_alias
iv_agent = gc_log_agent_name
iv_msg_handle = lv_msg_handle ).
please let me know the answe for this issue.
Many thanks in Advance,
Harish
Hi Harish,
For this particular flow from SharePoint, do you get other standard log entries in /IWFND/VIEW_LOG and onlu your customied message is missing?
If you don't get any log message, then there is a possiblity that there was some other issue in the mapper due to which short dump had occured and the logs were not committed.
Please check if any run time errors occured in ST22. if not we will need to check the system to debug and see what could be missing.
But from the coding perspective, I could find one difference which is on the log agent you have used. Please register the log agent name in the view /IWFND/V_COCCOL (transaction SM30) under the type "IW Agents for Logging and Monitoring".
Thanks,
Girimurugan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Girimurugan,
Thank You for your reply.
In log only Standard default message logs are coming.
As per your suggetions i registered the log agent name in the view /IWFND/V_COCCOL (transaction SM30) under the type "IW Agents for Logging and Monitoring."But still i am not getting my Customized Message logs.
Thank You,
Harish
Hi Girimurugan,
I am currently working with SAP Gateway related stuffs and I need a clarification regarding the application log.
Hope you are very busy and please clarify the doubts if you can spare few minutes towards this query.
Appreciate your valuable advise towards this.
Query:
Also I have already raised a query in the SCN with this link: http://scn.sap.com/message/15477543. But could not get much details about it.
Can you please clarify the same?
Thanks & Regards,
Mohamed Meeran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.