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: 

SO_DOCUMENT_SEND_API1 - Text File attachment data in Different formate

Former Member
0 Kudos

Hi Experts,

SO_DOCUMENT_SEND_API1 Fm is used to send mail with text file attachment,

E-MAil message body is coming perfect, but the content in text file is displaying different formate .

PFB the content in Text file.

IM7330003226161208RIBA20

140000001 200904210700

200000001Wella Italia Labocos SrlVia

I need to display the content as shown in below.

IM7330003226161208RIBA20

140000001 200904210700

200000001Wella Italia Labocos SrlVia

Please help.

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos
t_packing_list-doc_type = 'RAW'.
....
----
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data                    = w_doc_data
*     PUT_IN_OUTBOX                    = ' '
     commit_work                      = 'X'
   IMPORTING
     sent_to_all                      = lv_flag
*     NEW_OBJECT_ID                    =
    TABLES
      packing_list                     = t_packing_list
3 REPLIES 3

former_member156446
Active Contributor
0 Kudos
t_packing_list-doc_type = 'RAW'.
....
----
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data                    = w_doc_data
*     PUT_IN_OUTBOX                    = ' '
     commit_work                      = 'X'
   IMPORTING
     sent_to_all                      = lv_flag
*     NEW_OBJECT_ID                    =
    TABLES
      packing_list                     = t_packing_list

Former Member
0 Kudos

Hi,

pass attachment data to contents_hex instead of contents_bin. use thebelow logic to convert to hexa..

CALL FUNCTION 'SO_RAW_TO_RTF'
    TABLES
      objcont_old = lt_objbin
      objcont_new = lt_objbin.

  LOOP AT lt_objbin INTO l_line.
   conv = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' endian = 'B').
    CALL METHOD conv->write( data = l_line ).
    l_buffer = conv->get_buffer( ).
    MOVE l_buffer TO l_hexa.
    MOVE l_hexa TO l_hex-line.
    APPEND l_hex TO lt_contents_hex.
  ENDLOOP.

Refer to thie link with example...Instead of DOC use the TXT attachement..

http://docs.google.com/Doc?id=dfv2hmgs_6hf8nm5f4&hl=en

Former Member
0 Kudos

Hi,

Check for the documentation of the FM used where example is also provided how to use the FM.