‎2023 Jan 27 10:41 PM
Dears,
I'm new sap basis and I want system send to me mail when any user on system access specific transaction like finance and payroll transactions is it possible ?
Thanks
‎2023 Jan 27 11:54 PM
Hi Abelrahman,
It is possible to send notifications when a user accesses specific transactions in SAP using ABAP. One way to do this is to create a custom ABAP program that listens for specific transactions and sends a notification when triggered. This can be done by using the ABAP Object-Oriented Programming (OOP) concepts like creating a custom class and implementing an event handling mechanism.
You can also use the ABAP Workflow Engine to create custom workflows and trigger notifications based on certain events.
Function module 'SO_NEW_DOCUMENT_SEND_API1'can be used to send an email notification too when a user accesses a specific transaction.
Here is just an example and please make sure follow SAP documents related to this function
First, you will need to import the function module into your program by using the statement "IMPORTING" in your program's header.
FUNCTION zsend_email.
IMPORTING
p_recipient TYPE adr6-smtp_addr
p_subject TYPE so_obj_des
p_body TYPE so_obj_des.
Next, you will need to call the function module and pass in the necessary parameters. The parameters include the recipient's email address, the subject of the email, and the body of the email.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = l_document_data
put_in_outbox = 'X'
sender_address = 'sender@email.com'
sender_address_type = 'SMTP'
IMPORTING
sent_to_all = l_sent_to_all
TABLES
contents_bin = lt_contents_bin
contents_txt = lt_contents_txt
recipients = lt_recipients.
Then you can use the function module in your program logic. For example, you can create a trigger to send an email notification when a user accesses a specific transaction by checking the transaction code and calling the function module when the condition is met.
IF sy-tcode = 'FB01'.
l_recipient = 'recipient@email.com'.
l_subject = 'Transaction FB01 Accessed'.
l_body = 'Transaction FB01 has been accessed by the user'.
CALL FUNCTION zsend_email
EXPORTING
p_recipient = l_recipient
p_subject = l_subject
p_body = l_body.
ENDIF.
Please check below SAP Blog for further info about "SO_NEW_DOCUMENT_SEND_API1'"
https://answers.sap.com/questions/1489680/function-module-sonewdocumentattsendapi1.html
It is important to note that in order to send emails from your SAP system, you need to have an SMTP server configured and accessible from your SAP system. You also need to have proper authorization to send emails from your SAP system.
Tahnks,
‎2023 Jan 27 11:54 PM
Hi Abelrahman,
It is possible to send notifications when a user accesses specific transactions in SAP using ABAP. One way to do this is to create a custom ABAP program that listens for specific transactions and sends a notification when triggered. This can be done by using the ABAP Object-Oriented Programming (OOP) concepts like creating a custom class and implementing an event handling mechanism.
You can also use the ABAP Workflow Engine to create custom workflows and trigger notifications based on certain events.
Function module 'SO_NEW_DOCUMENT_SEND_API1'can be used to send an email notification too when a user accesses a specific transaction.
Here is just an example and please make sure follow SAP documents related to this function
First, you will need to import the function module into your program by using the statement "IMPORTING" in your program's header.
FUNCTION zsend_email.
IMPORTING
p_recipient TYPE adr6-smtp_addr
p_subject TYPE so_obj_des
p_body TYPE so_obj_des.
Next, you will need to call the function module and pass in the necessary parameters. The parameters include the recipient's email address, the subject of the email, and the body of the email.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = l_document_data
put_in_outbox = 'X'
sender_address = 'sender@email.com'
sender_address_type = 'SMTP'
IMPORTING
sent_to_all = l_sent_to_all
TABLES
contents_bin = lt_contents_bin
contents_txt = lt_contents_txt
recipients = lt_recipients.
Then you can use the function module in your program logic. For example, you can create a trigger to send an email notification when a user accesses a specific transaction by checking the transaction code and calling the function module when the condition is met.
IF sy-tcode = 'FB01'.
l_recipient = 'recipient@email.com'.
l_subject = 'Transaction FB01 Accessed'.
l_body = 'Transaction FB01 has been accessed by the user'.
CALL FUNCTION zsend_email
EXPORTING
p_recipient = l_recipient
p_subject = l_subject
p_body = l_body.
ENDIF.
Please check below SAP Blog for further info about "SO_NEW_DOCUMENT_SEND_API1'"
https://answers.sap.com/questions/1489680/function-module-sonewdocumentattsendapi1.html
It is important to note that in order to send emails from your SAP system, you need to have an SMTP server configured and accessible from your SAP system. You also need to have proper authorization to send emails from your SAP system.
Tahnks,
‎2023 Jan 30 4:27 PM
You could also just use SM19 to setup a security audit profile for the transaction codes of interest to you, then SM20 to check the log. No custom ABAP required.