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_NEW_DOCUMENT_SEND_API1

Former Member
0 Likes
1,162


dear all,

I use function moudle 'SO_NEW_DOCUMENT_SEND_API1' to send emails. The program will send all pending emails in SOST,after the program is executed.

the code is as below,

    DATA:lv_email TYPE string.

  CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
    EXPORTING
      document_data              = gs_mailsubject
      document_type              = 'RAW'
      put_in_outbox              = 'X'
      commit_work                = 'X'
    TABLES
      object_content             = gt_mailtxt
      receivers                  = gt_mailrecivers
    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.
*push mial out from SAP outbox
    WRITE: 'Mail sending successfully.'.
    CLEAR lv_email.
    CONCATENATE gs_itab-email1 gs_itab-email2 gs_itab-email3 gv_email
    INTO lv_email SEPARATED BY space.
    WRITE: / 'Receiver:',lv_email.
    ULINE.
    SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
    CALL FUNCTION 'SO_DEQUEUE_UPDATE_LOCKS'.
  ELSE.
    WRITE: 'Mail sending failed.'.

  ENDIF.

who can help me solve the issue?

Br,

8 REPLIES 8
Read only

rosenberg_eitan
Active Contributor
0 Likes
1,096

Hi,

Please use CL_BCS you will be much happier...

See here:

Regards.

Read only

0 Likes
1,096

yes, thank you for your help

Read only

Former Member
0 Likes
1,096

as said, use the BCS class for working with emails. Second - did you enhlight what exactly the issue is?

Read only

0 Likes
1,096

the program will send all pending emails in SOST,  'SUBMIT rsconn01 WITH mode = 'INT' AND RETURN'

caused the issues. thank you for your help

Read only

Former Member
0 Likes
1,096

Hi,

Let us know what is the issue.

Thanks

Sunil Kumar

Read only

0 Likes
1,096

dear,

the issue have been solved,   'SUBMIT rsconn01 WITH mode = 'INT' AND RETURN',the statement will send all emails in SOST. thank you for your help.

Read only

peng_wen
Product and Topic Expert
Product and Topic Expert
0 Likes
1,096

Hello,

The problem is the statement "SUBMIT rsconn01....."
program rsconn01 is exactly the report which sends all pending emails from SOST,
usually we use it in standard job "SAPCONNECT INT SEND".

In additon, please use BCS interface instead of 'SO_NEW_DOCUMENT_SEND_API1'

as per mentioned above.

Regards,

Wen Peng

Read only

peng_wen
Product and Topic Expert
Product and Topic Expert
0 Likes
1,096

5 mins late......