Posted: Sun Dec 16, 2007 1:22 am Post subject: ABAP - Sending GOS attachments to an email address
Author: Narendran Muthukumaran
Description Sending GOS attachements to an email address for the given business object and ID. This program is tested in the version 4.6C.
Code:
REPORT z_send_gos_attachments.
* Selection-screen.
SELECTION-SCREEN BEGIN OF LINE.
* Email address
SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD p_email.
PARAMETERS: p_email(50) OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
* Business object type
SELECTION-SCREEN COMMENT 2(20) v_text2 FOR FIELD p_bo.
PARAMETERS: p_bo TYPE borident-objtype DEFAULT 'BUS2102'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
* Business object ID
SELECTION-SCREEN COMMENT 2(20) v_text3 FOR FIELD p_boid.
PARAMETERS: p_boid TYPE borident-objkey DEFAULT '0060000717'.
SELECTION-SCREEN END OF LINE.
* Internal table declarations.
DATA: lt_links TYPE TABLE OF relgraphlk,
lv_document_id TYPE sofolenti1-doc_id,
lt_plist LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE,
lt_soli LIKE soli OCCURS 100 WITH HEADER LINE,
lt_rec_tab LIKE somlreci1 OCCURS 1 WITH HEADER LINE,
lt_roles TYPE STANDARD TABLE OF relroles,
lt_appllinks TYPE STANDARD TABLE OF srl_aprel,
lt_object_content_l LIKE solisti1 OCCURS 0 WITH HEADER LINE,
lt_object_content LIKE solisti1 OCCURS 0 WITH HEADER LINE,
lt_doc_dat LIKE sofolenti1.
* Variables.
DATA: lv_objtp LIKE soodk-objtp,
lv_lang LIKE tst01-dlang,
lv_line_size TYPE i VALUE 255,
lv_name LIKE soextreci1-receiver.
* Work areas
DATA: lwa_doc_data LIKE sodocchgi1,
lwa_document_data LIKE sofolenti1,
lwa_links LIKE LINE OF lt_links,
lwa_object TYPE borident.
* Initialization.
INITIALIZATION.
* Set the texts.
v_text1 = 'Email addr.'.
v_text2 = 'Business obj type'.
v_text3 = 'Business obj ID'.
* Start-of-selection.
START-OF-SELECTION.
* Assign the values
lwa_object-objkey = p_boid.
lwa_object-objtype = p_bo.
* Get the attachment list for the input business object type
* and name.
CALL FUNCTION 'SREL_GET_NEXT_RELATIONS'
EXPORTING
object = lwa_object
relationtype = 'ATTA'
TABLES
links = lt_links
roles = lt_roles
appllinks = lt_appllinks
EXCEPTIONS
internal_error = 1
no_logsys = 2
OTHERS = 3.
* Check the return code.
IF sy-subrc <> 0.
MESSAGE s208(00) WITH 'Error in FM SREL_GET_NEXT_RELATIONS'.
ENDIF.
* Process the attachment list
LOOP AT lt_links INTO lwa_links.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.