Application Development and Automation 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: 
Read only

SO_DOCUMENT_SEND_API1

Former Member
0 Likes
667

Hi,

When I'm using SO_DOCUMENT_SEND_API1 to send report output to mail in excel format,

the header data in the excel document printing from second row onwards,the first row it is leaving empty .I want to print the header values in the first row onwards.

can any one help me in this regard?

Thanks in advance

Regards,

Anji

4 REPLIES 4
Read only

Former Member
0 Likes
578

Hi,

After bringing your final alv data in the final internal table,

go through this link , i also had an same requirement to send data after converting to excel file and

send it as an attachment to mail id outside Sap,

https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/to%252bsend%252b2%252bint%252btables%252bdat...

Hope it helps

Regrds

Mansi

Read only

viquar_iqbal
Active Contributor
0 Likes
578

Hi

try giving like this

tables

packing_list =

OBJECT_HEADER = 'X'

Read only

Former Member
0 Likes
578

Hi anji,

it is because when you are building your excel file, you are leaving an empty space somewhere. refer to the codes below and hope it helps. thanks

  • Creating the document to be sent

wa_doc_data-obj_name = text-043.

  • subject

wa_doc_data-obj_descr = p_subj.

i_contents-line = text-061.

APPEND i_contents.

i_contents-line = ' '.

APPEND i_contents.

i_contents-line = text-029.

APPEND i_contents.

DESCRIBE TABLE i_contents LINES v_tab_lines.

READ TABLE i_contents INDEX v_tab_lines.

IF sy-subrc EQ 0.

wa_doc_data-doc_size = ( v_tab_lines - 1 ) * 255 + STRLEN( i_contents ).

ENDIF.

  • Creating the entry for the compressed document

CLEAR i_packing_list-transf_bin.

i_packing_list-head_start = 1.

i_packing_list-head_num = 0.

i_packing_list-body_start = 1.

i_packing_list-body_num = v_tab_lines.

i_packing_list-doc_type = c_raw.

APPEND i_packing_list.

  • Sending the document

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = wa_doc_data

put_in_outbox = c_x

commit_work = c_x

TABLES

packing_list = i_packing_list

object_header = i_object_header

contents_hex = i_attachment3

contents_txt = i_contents

receivers = i_receiver

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

OTHERS = 8.

IF sy-subrc EQ 0.

MESSAGE s034(zxxxmf) WITH text-048.

ENDIF.

Read only

Former Member
0 Likes
578

Answered