In my program gi_message contains fixed asset status as a string value like 'fixed asset is created for asset number 10078.' Now I am trying to send this message as a mail from SAP.
Mail is successfully sent but with nobody message in it. Can anyone please help me?
I am pasting my code below.
Best regards.
====================================================================
************************************************************************ * Local internal table declaration * ************************************************************************ *Local internal table declaration for Tables li_objcont TYPE TABLE OF soli, "For OBJECT_CONTENT li_receiver TYPE TABLE OF somlreci1. "For RECEIVERS *Insert receiver(SAP name) REFRESH: li_receiver. CLEAR: lwa_receiver. *Code for sending a mail between SAP users MOVE: SY-UNAME TO lwa_receiver-receiver, "Sap login id 'X' TO lwa_receiver-express, "Send with priority 'B' TO lwa_receiver-rec_type. APPEND lwa_receiver TO li_receiver. *For exporting parameters *DOCUMENT_DATA-OBJ_DESCR: subject of the mail. WRITE lv_maildesc TO lwa_doc_data-obj_descr. "For 'Subject of the mail' *For tables *OBJECT_CONTENT: line filled with mail content *Send fixed asset status data from gi_message to lwa_objcont. LOOP AT gi_message ASSIGNING <fs_message>. CONCATENATE <fs_message>-type <fs_message>-message INTO lwa_objcont-line SEPARATED BY space. ENDLOOP. *Appending fixed asset data from lwa_objcont to li_objcont. *li_objcont is passed through the function module. APPEND lwa_objcont TO li_objcont. *Function module call for sending mail from SAP CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1' EXPORTING document_data = lwa_doc_data DOCUMENT_TYPE = 'RAW' * PUT_IN_OUTBOX = ' ' COMMIT_WORK = c_x IMPORTING * SENT_TO_ALL = new_object_id = lwa_object_id TABLES * OBJECT_HEADER = object_content = li_objcont * CONTENTS_HEX = * OBJECT_PARA = * OBJECT_PARB = receivers = li_receiver * EXCEPTIONS * TOO_MANY_RECEIVERS = 1 * DOCUMENT_NOT_SENT = 2 * DOCUMENT_TYPE_NOT_EXIST = 3 * OPERATION_NO_AUTHORIZATION = 4 * PARAMETER_ERROR = 5 * X_ERROR = 6 * ENQUEUE_ERROR = 7 * OTHERS = 8 . IF sy-subrc <> 0 . MESSAGE ' Error in the sending of mail' TYPE 'I'. ELSE. MESSAGE ' Mail has been sent successfully' TYPE 'I'. ENDIF. ENDFORM. " SEND_MAIL_ASSET_STATUS