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: 

FM SO_NEW_DOCUMENT_ATT_SEND_API1

Former Member
0 Kudos

Hello all,

I'm sending a mail using the FM SO_NEW_DOCUMENT_ATT_SEND_API1 with an Excel as an attachment and some text in the body of the mail.I have given the DOC TYPE as "ASC"

The problem is, the program wroks fine on D system, but on Q system the body of the mail comes as an attachment.

Please let me know if anyone has the solution.

Thanks in advance.

Regards

Jai

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Go to TCODE SCOT in Quality system

Double click on SMTP node

Click on Set against internet

Under "Output format for SAP document"

RAW Text must be TXT

Also check if other SCOT settings are same as development

Regards

10 REPLIES 10

Former Member
0 Kudos

Hi,

Go to TCODE SCOT in Quality system

Double click on SMTP node

Click on Set against internet

Under "Output format for SAP document"

RAW Text must be TXT

Also check if other SCOT settings are same as development

Regards

0 Kudos

Hello Rajvansh,

Thanks for the reply.

I'm using the below code as 'ASC' and not 'RAW'.

CLEAR g_t_objpack-transf_bin.

g_t_objpack-head_start = 1.

g_t_objpack-head_num = 0.

g_t_objpack-body_start = 1.

g_t_objpack-body_num = g_f_tablines.

g_t_objpack-doc_type = 'ASC'.

APPEND g_t_objpack.

The mail format on Q system is same as 'RAW'

Can you pleaase help me.

Best Regards

Jai

0 Kudos

Hi,

Have you compared in settings in Development and quality ? Is there a difference ?

I assume your code is right as you said it works fine in development.

In TCODE SBWP you can create a test message and check if it works in quality

Regards

Edited by: Rajvansh Ravi on Mar 9, 2009 7:35 AM

0 Kudos

Hello Rajvansh,

I've checked the settings and the RAW is set to TXT only.

Is there any other setting ?

Regards

Jai

dev_parbutteea
Active Contributor
0 Kudos

Hi,

objpack-transf_bin = 'X'. --> Will get content from contents_bin

objpack-transf_bin = ' '. --> Will get content from contents_txt

Regards.

sreeramkumar_madisetty
Active Contributor
0 Kudos

Hi Jaj

The good way to know the reason is debugging .

Put the break point on the FM:SO_NEW_DOCUMENT_ATT_SEND_API1 and how the same is differing from D to Q.

Mean while you can check whether the necessary parameters were populated properly or not like

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = lv_doc_chng

put_in_outbox = c_x

TABLES

packing_list = it_objpack

object_header = it_objhead

contents_bin = it_ty_ty_tab_objbin

contents_txt = it_objtxt

receivers = it_reclist

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

operation_no_authorization = 4.

above.

Regards,

Sreeram Kumar.Madisetty

Former Member
0 Kudos

Hi Jai,

Try to implement the following code.

&----


*& Declaration of variables for Excel & Email

&----


.

DATA: i_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE ,

i_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE ,

i_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE ,

i_receiver LIKE somlreci1 OCCURS 0 WITH HEADER LINE ,

v_tab_lines LIKE sy-tabix ,

wa_doc_data LIKE sodocchgi1 ,

v_attachment TYPE string ,

i_attachment2 TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE ,

i_attachment3 TYPE STANDARD TABLE OF solix INITIAL SIZE 0 WITH HEADER LINE ,

v_mail TYPE c .

constants: c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,

c_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf,

c_u TYPE c VALUE 'U' ,

c_x TYPE c VALUE 'X' ,

c_xls(3) TYPE c VALUE 'xls' .

  • 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.

build your xls_data_table.

DATA: lv_sy_datum TYPE string,

lv_datuv(10) TYPE c,

lv_andat(10) TYPE c,

lv_aedat(10) TYPE c,

lv_rldat(10) TYPE c,

lv_mime_type(34) TYPE c VALUE 'APPLICATION/MSEXCEL; charset=UTF-8', <----


lv_row_text TYPE string,

lv_row_hex TYPE xstring,

lv_date(10) TYPE c,

lv_emailname(50) TYPE c.

CONSTANTS: lc_name1(25) TYPE c VALUE 'XXX',

lc_name2(5) TYPE c VALUE '.XLS', <----


lc_tag TYPE c VALUE '_'.

  • Creating the entry for the compressed attachment

i_packing_list-transf_bin = c_x.

i_packing_list-head_start = 1.

i_packing_list-head_num = 1.

i_packing_list-body_start = 1.

i_packing_list-body_num = v_tab_lines.

i_packing_list-doc_type = c_xls.

i_packing_list-obj_name = c_xls.

i_packing_list-obj_descr = lv_emailname.

i_packing_list-doc_size = v_tab_lines * 255.

APPEND i_packing_list.

  • Sending the document

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = wa_doc_data

put_in_outbox = 'X'

commit_work = '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.

Hope this helps.

cheers

Former Member
0 Kudos

Hi Jai,

Please search in the link below:

[FM SO_NEW_DOCUMENT_ATT_SEND_API1|https://www.sdn.sap.com/irj/scn/advancedsearch?adv=true&cat=sdn_all&cat=sdn_library&query=ids&start=91&searchmode=similar&similardocsuri=/forumsrm/1_category/42_category/50_forum/194688_thread/2168911_message ]

Regards,

Swapna.

Former Member
0 Kudos

hi Jai,

This is a repeated question.

please check the setting in SCOT

Go to t code SCOT --> selet SMTP and click on dipaly from the applitool bar

then from the popup window click on SET of Internet

their you can see in out put should be in TXT mode . then only u'll get mail in body and not in attachemnt.

might be this settig is not made in quality and only done in development

0 Kudos

Hello,

I've chcked the settings and the RAW is set as TXT only.

Please let me know if any other settings ahve to be made.

Regards

Jai