SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Sending GOS attachments as email



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> SAP Business Workflow
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Tue Mar 04, 2008 6:04 pm    Post subject: Sending GOS attachments as email Reply with quote

Author: Ram Manohar Tiwari

Code:

REPORT z_rmtiwari_send_gos_att_mail.

PARAMETERS:
p_botype LIKE borident-objtype DEFAULT 'BUS2012',
p_bo_id LIKE borident-objkey DEFAULT '3500000503'," Key e.g. PO No.
p_reltyp LIKE breltyp-reltype DEFAULT 'ATTA'.

DATA: lo_is_object_a TYPE sibflporb,
lt_links TYPE obl_t_link,
wa_links LIKE LINE OF lt_links.

DATA : lt_rel TYPE obl_t_relt,
wa_rel LIKE LINE OF lt_rel.

lo_is_object_a-instid = p_bo_id.
lo_is_object_a-typeid = p_botype.
lo_is_object_a-catid = 'BO'.

wa_rel-sign = 'I'.
wa_rel-option = 'EQ'.
wa_rel-low = p_reltyp.
APPEND wa_rel TO lt_rel.

*TRY.
CALL METHOD cl_binary_relation=>read_links
  EXPORTING
    is_object = lo_is_object_a
*   IP_LOGSYS =
*   IT_ROLE_OPTIONS =
    it_relation_options = lt_rel
    ip_no_buffer = space
  IMPORTING
    et_links = lt_links
*   ET_ROLES =
  .
*CATCH CX_OBL_PARAMETER_ERROR .
*CATCH CX_OBL_INTERNAL_ERROR .
*CATCH CX_OBL_MODEL_ERROR .
*ENDTRY.

CALL FUNCTION 'SREL_GET_NEXT_RELATIONS'
  EXPORTING
    object = lo_is_object_a
    roletype =
    relationtype = p_reltyp
    max_hops = 1
    incl_applrels = ' '
*   EXCL_ROLES =
*   EXCL_RELATIONS =
  TABLES
    links = lt_links
*   ROLES =
*   APPLLINKS =
    EXCEPTIONS
    internal_error = 1
    no_logsys = 2
    OTHERS = 3
    .
*if sy-subrc 0.
*
*endif.

DATA : lv_document_id TYPE sofolenti1-doc_id.
DATA : lt_receivers TYPE STANDARD TABLE OF somlreci1 WITH HEADER LINE.

lt_receivers-receiver = '[email protected]'.
lt_receivers-rec_type = 'U'.

APPEND lt_receivers.

LOOP AT lt_links INTO wa_links WHERE typeid_b = 'MESSAGE'.

  MOVE wa_links-instid_b TO lv_document_id.

  CALL FUNCTION 'SO_OLD_DOCUMENT_SEND_API1'
       EXPORTING
            document_id                = lv_document_id
       TABLES
            receivers                  = lt_receivers
       EXCEPTIONS
            too_many_receiver          = 1
            document_not_sent          = 2
            document_not_exist         = 14
            operation_no_authorization = 13
            parameter_error            = 23
            x_error                    = 6
            enqueue_error              = 7
            OTHERS                     = 1000.
  IF sy-subrc NE 0.

  ENDIF.

ENDLOOP.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> SAP Business Workflow All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
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.