Skip to Content

creating Attachment in send mail step

Hi,

My requirement is to send all the item details as attchement in mail to sap inbox .

i am getting all sales order item details into internal table to workflow container element ZITEMS.

1.created workflow container element ZATTCH of object type SOFM

2. Binding ZATTCH element to ATTACHMENT in mail task step

but i am unable do the bellow steps

3.How to pass data from ZITEMS element to ZATTACH which conatins all item details.

or

4. i need to display all sales order item details in body of email but item details are multipule.

please tell me how to acheive these requirement.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Dec 13, 2013 at 09:30 PM

    Hello,

    "4. i need to display all sales order item details in body of email but item details are multipule."

    All elements of a multiline element can be displayed as follows:

    &USERLIST.USER##&

    regards

    Rick Bakker

    Add a comment
    10|10000 characters needed characters exceeded

    • Rick Bakker phanikumar yennamani

      Hello,

      It's very simple - if a container element is multiline then you can display all of the lines with e.g.:

      &ABC##&

      If an attribute is multiline then you can display all of the lines with e.g.:

      &ABC.DEF##&

      "How to pass data from ZITEMS element to ZATTACH"

      Binding them should do it. What's the problem?

      regards

      Rick Bakker

  • Posted on Dec 19, 2013 at 01:51 PM

    Hi,

    i am trying to attach internal table data as attachemnt to mail step but it is not working.

    i try to send it as text data but it is not showing attachment.

    if i pass xstring data it is showing attachment but data is unreadable format.

    please tell me what is wrong in these code

    swc_get_element container 'W_I' w_i.

    select * from vbap into TABLE lt_vbap UP TO 20 rows.
    *i_solix = lt_vbap.
    CALL FUNCTION 'SCMS_TEXT_TO_BINARY'
    * EXPORTING
    * FIRST_LINE = 0
    * LAST_LINE = 0
    * APPEND_TO_TABLE = ' '
    * MIMETYPE = ' '
    * ENCODING =
    * IMPORTING
    * OUTPUT_LENGTH =
    TABLES
    TEXT_TAB = lt_vbap
    BINARY_TAB = i_solix[]
    * EXCEPTIONS
    * FAILED = 1
    * OTHERS = 2
    .

    DESCRIBE TABLE I_SOLIX LINES V_TAB_LINES. "get index
    READ TABLE I_SOLIX INTO V_WA_SOLIX INDEX V_TAB_LINES.
    V_DOC_SIZE = ( 255 * V_TAB_LINES ). "whole lines

    CALL FUNCTION 'SCMS_BINARY_TO_STRING'
    EXPORTING
    INPUT_LENGTH = v_doc_size
    * FIRST_LINE = 0
    * LAST_LINE = 0
    * MIMETYPE = ' '
    * ENCODING =
    IMPORTING
    TEXT_BUFFER = v_string
    * OUTPUT_LENGTH =
    TABLES
    BINARY_TAB = i_solix
    * EXCEPTIONS
    * FAILED = 1
    * OTHERS = 2
    .
    IF SY-SUBRC <> 0.
    * Implement suitable error handling here
    ENDIF.

    * convert binary to xstring
    CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
    EXPORTING
    input_length = v_doc_size
    IMPORTING
    buffer = v_xstring
    TABLES
    binary_tab = i_solix.

    v_att_header-file_type = 'B'.
    v_att_header-file_name = 'TEST'. "v_docname_only.
    v_att_header-file_extension = 'XLS'. "v_doc_extension.
    v_att_header-language = sy-langu.
    V_XSTRING = V_STRING.
    CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
    EXPORTING
    workitem_id = w_i
    att_header = v_att_header
    *ATT_TXT = v_string
    att_bin = v_xstring
    IMPORTING
    att_id = v_att_id.
    * pass attachment id and internal document number for SOFM
    swc_set_element container 'ATT_ID' v_att_id.
    swc_set_element container 'SOFM' v_att_id-doc_id.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 20, 2013 at 04:11 AM

    Hi Rick,

    my internal table contains sales order item details , so it is text only.

    by using this &ABC##& we can display but if salesorder conatins mutipule items.

    so i am trying for attachment.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 20, 2013 at 01:35 PM

    Hi,

    i tried with bellow code for text file attachment it is working but i am unable to do PDF or XL attachement.

    select VBELN POSNR from vbap into TABLE lt_vbap UP TO 20 rows.

    DATA:I_CHAR TYPE String.
    data:i_soli TYPE STANDARD TABLE OF SOLI WITH HEADER LINE.

    LOOP AT lt_vbap INTO ls_vbap.
    CONCATENATE LS_VBAP-VBELN LS_VBAP-POSNR I_CHAR INTO I_CHAR SEPARATED BY SPACE.
    ENDLOOP.

    v_att_header-file_type = 'T'.
    v_att_header-file_name = 'TEST'. "v_docname_only.
    v_att_header-file_extension = 'RAW'. "v_doc_extension.
    v_att_header-language = sy-langu.
    V_XSTRING = V_STRING.

    CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
    EXPORTING
    WORKITEM_ID = w_i
    ATT_HEADER = v_att_header
    ATT_TXT = I_CHAR
    * ATT_BIN = V_XSTRING
    DOCUMENT_OWNER = SY-UNAME
    LANGUAGE = SY-LANGU

    DO_COMMIT = 'X'
    * COMMENT_SEMANTIC = ' '
    IMPORTING
    * RETURN_CODE =
    ATT_ID = v_att_id
    * TABLES
    * MESSAGE_LINES =
    * MESSAGE_STRUCT =
    .

    can anyone tell how to do PDF or XL attachment using above function module.

    can we do PDF attachment without SPOOL ID ?

    Thanks,

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.