Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Send SCMS_AO_TABLE_GET content as email attachment

former_member307359
Participant
0 Kudos

Hi expert,

Using this FM SCMS_AO_TABLE_GET, I can download PO attachment into local machine, My requirement is to attach these document without download into local, I want to send a mail with these files.

Thanks

Vimal Raj

3 REPLIES 3

former_member235395
Contributor
0 Kudos

Dear Vimal,

All atachments for PO is working using GOS service. So, you cna find  in SRGBTBREL Table throw INSTID_A field the PO that correspond and then do something like this:

        gs_lpor-instid = SRGBTBREL-instid.

        gs_lpor-typeid = SRGBTBREL-typeid.

        gs_lpor-catid  = SRGBTBREL-catid.

        CALL METHOD cl_binary_relation=>read_links

          EXPORTING

            is_object           = gs_lpor

            it_relation_options = lt_relat

          IMPORTING

            et_links            = t_links.

        CLEAR gs_lpor.

      LOOP AT t_links INTO s_links.

        REFRESH: lt_object_content_l, lt_hex, lt_content.

        CLEAR: lwa_document_data.

        MOVE s_links-instid_b TO lv_document_id.

* Read the data

        CALL FUNCTION 'SO_DOCUMENT_READ_API1'

          EXPORTING

            document_id                = lv_document_id

          IMPORTING

            document_data              = lwa_document_data

          TABLES

            contents_hex               = lt_hex

            object_content             = lt_content

          EXCEPTIONS

            document_id_not_exist      = 1

            operation_no_authorization = 2

            x_error                    = 3

            OTHERS                     = 4.

        IF sy-subrc = 0.

          CLEAR lv_objdes.

          lv_objdes = lwa_document_data-obj_descr.

          CALL METHOD document->add_attachment

            EXPORTING

              i_attachment_type    = lwa_document_data-obj_type

              i_attachment_subject = lv_objdes

              i_att_content_text   = lt_content

              i_att_content_hex    = lt_hex.

*     add document to send request

          CALL METHOD send_request->set_document( document ).

        ENDIF.

      ENDLOOP.

Regards.

0 Kudos

Hi David,

Thanks for your reply, I already tried this one, but I'm getting nothing from this SO_DOCUMENT_READ_API1.


Note: Using FM SCMS_AO_TABLE_GET I'm getting RAW data, how to handle this RAW data and assign this to SO_NEW_DOCUMENT_ATT_SEND_API1.


Thanks

Vimal Raj

former_member307359
Participant
0 Kudos

Issue is resolved.