Skip to Content
author's profile photo Former Member
Former Member

Email Attachment Via Report

Hi Friends

I have an issue like i need to send the internal table data to distribution list as an attachment.. I am able to send the email attachment to the list but in the Parameter OBJBIN i hardcoded the sy-uname sy-repid to make sure that along with the output prog name and userid also gets displayed in the attachment..

My issue is Like while debuggin the FM SO_NEW_DOCUMENT_ATT_SEND_API1 i am getting the data line by line but in output attachment i am getting it as a single line..

I want to see the output with prog name and sy-repid line one after other..

Kindly help me in solving this issue

Thanks in advance,

Kishore

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 28, 2010 at 08:13 PM

    Hi Kishore,

    Its look like you might not be passing the Document size to the Packing List.

    While building the attcahment data to the ATTACHMENT TABLE (solisti1). Then get the total number of lines in the attachment table in a variable and then multiply this variable with 255 and then move the result to PACKING LIST "sopcklsti1-doc_size " table as per below code.

      *DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.*
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      *t_packing_list-doc_size   =  t_packing_list-body_num * 255.*
      APPEND t_packing_list. 
    

    Let me know if you see any problem on this.

    Regards,

    Srinivas

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Srinivas,

      Thanks a lot for your response. Actually i already have tat piece of code which u have mentioned in your scrap.

      This is my code

      for eg.

      CONCATENATE '0101010101' 'HI HOW ARE U' INTO objbin

      SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

      APPEND OBJBIN.

      DESCRIBE TABLE OBJBIN LINES TAB_LINES.

      OBJHEAD = 'PURCHASEORDERS'.

      APPEND OBJHEAD.

      • Creation of the entry for the compressed attachment

      OBJPACK-TRANSF_BIN = 'X'.

      OBJPACK-HEAD_START = 1.

      OBJPACK-HEAD_NUM = 1.

      OBJPACK-BODY_NUM = TAB_LINES.

      OBJPACK-DOC_TYPE = 'HTM'.

      OBJPACK-OBJ_DESCR = 'COST SWEEPER.htm'.

      OBJPACK-DOC_SIZE = TAB_LINES * 255.

      APPEND OBJPACK.

      • Completing the recipient list

      clear reclist.

      refresh reclist[].

      reclist-receiver = 'Z_FI_SYS_ACT'.

      reclist-rec_type = 'C'.

      APPEND reclist.

      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

      EXPORTING

      DOCUMENT_DATA = DOC_CHNG

      COMMIT_WORK = 'X'

      TABLES

      PACKING_LIST = objpack

      OBJECT_HEADER = OBJHEAD

      CONTENTS_BIN = OBJBIN

      CONTENTS_TXT = OBJTXT

      RECEIVERS = reclist[]

      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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

      Thanks a lot

      Kishore

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.