&---------------------------------------------------------------------* & Form SENT_MAIL &---------------------------------------------------------------------* & Mail Sent incase of errors &---------------------------------------------------------------------* FORM sent_mail. DATA: lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL, lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL, "document object lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL, "sender lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL, "recipient lt_text TYPE bcsy_text, "Table for body lt_lines TYPE TABLE OF tline. CONSTANTS: lc_st TYPE thead-tdid VALUE 'ST', lc_en TYPE thead-tdspras VALUE 'EN', lc_name TYPE thead-tdname VALUE 'ZAHLPLANAENDERUNG', "<=change it lc_text TYPE thead-tdobject VALUE 'TEXT'. lo_send_request = cl_bcs=>create_persistent( ). "Read the email body template from SO10 text CALL FUNCTION 'READ_TEXT' EXPORTING id = lc_st language = lc_en name = lc_name object = lc_text TABLES lines = lt_lines EXCEPTIONS id = 1 language = 2 name = 3 not_found = 4 object = 5 reference_check = 6 wrong_access_to_archive = 7 OTHERS = 8. IF sy-subrc EQ 0. "Set email body LOOP AT lt_lines ASSIGNING FIELD-SYMBOL(<lfs_lines>). APPEND INITIAL LINE TO lt_text ASSIGNING FIELD-SYMBOL(<lfs_text>). <lfs_text>-line = <lfs_lines>-tdline. ENDLOOP. ENDIF. "create document lo_document = cl_document_bcs=>create_document( i_type = 'TXT' "Type of document - HTM, TXT etc i_text = lt_text "email body i_subject = TEXT-016 ). "email subject "Pass the document to send request lo_send_request->set_document( lo_document ). "Set sender to send request TRY. lo_sender = cl_sapuser_bcs=>create( sy-uname ). "sender is the logged in user lo_send_request->set_sender( EXPORTING i_sender = lo_sender ). CATCH cx_address_bcs INTO DATA(lv_address_bcs). ENDTRY. "Set recipient lo_recipient = cl_cam_address_bcs=>create_internet_address( 'test@deloitte.com' ). "Recipient email TRY. lo_send_request->add_recipient( EXPORTING i_recipient = lo_recipient i_express = abap_true ). CATCH cx_send_req_bcs INTO DATA(lo_send_req_bcs). ENDTRY. "Send email TRY. CALL METHOD lo_send_request->set_send_immediately EXPORTING i_send_immediately = abap_true. lo_send_request->send( EXPORTING i_with_error_screen = abap_true ). COMMIT WORK. IF sy-subrc = 0. "mail sent successfully WRITE :/ 'Mail sent successfully'. ENDIF. CATCH cx_send_req_bcs INTO lo_send_req_bcs. ENDTRY. ENDFORM.
Wednesday, 9 October 2019
Send Mail
Tuesday, 8 October 2019
File listing in AL11
Using this FM ensures to return only the filename. It will not return any directory name.
CALL FUNCTION 'EPS2_GET_DIRECTORY_LISTING' EXPORTING iv_dir_name = CONV eps2filnam( me->gv_filepath ) TABLES dir_list = lt_dir_list EXCEPTIONS invalid_eps_subdir = 1 sapgparam_failed = 2 build_directory_failed = 3 no_authorization = 4 read_directory_failed = 5 too_many_read_errors = 6 empty_directory_list = 7 OTHERS = 8. IF sy-subrc <> 0 OR lt_dir_list IS INITIAL. MESSAGE TEXT-029 TYPE gc_e . ENDIF.
Change Pointer Activation
Activate the change pointer in the system by going to BD61
Go to WE81 and create a new Message type: ZMATMAS_AMPL:
Goto BD52 and maintain the fields for which the change pointer should get triggered
Now, whenever there will be any changes in those particular fields, changes will get saved in table BDCP2. You can also check CDPOS and CDHDR to get the old value and new value.Use table TBD62 to get the Object ID for the change pointer
Go to WE81 and create a new Message type: ZMATMAS_AMPL:
Now, whenever there will be any changes in those particular fields, changes will get saved in table BDCP2. You can also check CDPOS and CDHDR to get the old value and new value.Use table TBD62 to get the Object ID for the change pointer
Subscribe to:
Posts (Atom)
Report to find CDS view of Standard Table
A small change has been made to the original program ( SAP YARD Article ) so that it can also display the common CDS used by multiple table...
-
Step 1: Goto Transaction: SE41 Step 2: Click on Status or press CTRL+F6 Step 3: Fill up the dialog box as below: Frm Program: SAPLSALV...
-
Report: Z_R_ALV REPORT z_r_alv . CLASS gcl_event_handler DEFINITION DEFERRED . "Data Declaration INCLUDE z_r_alv_top . "...
-
AT SELECTION-SCREEN OUTPUT event gets triggered before generating the Selection Screen. Thus, it can be used to manipulate the elements of...