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

Mail sending program issue

Former Member
0 Likes
658

Hi all

I have an requirement from client for sending mail through smartform, and pdf should be sent to desired person ,

i made use of below FM and OTF FM also for PDF creation.But my problem is when i un the program mail is not sent

directly. I need to go to scot transaction then after press execute button mail is sended .i want this process as direct.

Please help me in this regard,if anyone has solution.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

   EXPORTING

     document_data              = wa_doc_chng

     put_in_outbox              = 'X'

     commit_work                = 'X'

   TABLES

     packing_list               = i_objpack

     object_header              = wa_objhead

     contents_bin               = i_objbin

     contents_txt               = i_objtxt

     receivers                  = i_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.

   WRITE:/ 'Error When Sending the File', sy-subrc.

ELSE.

   WRITE:/ 'Mail sent'.

ENDIF.

1 ACCEPTED SOLUTION
Read only

former_member196331
Active Contributor
0 Likes
602

You have to Ask basis person, Some configuration may be there, i faced this one.

Ask basis person, I hope there is no Default Settings in Fm.

3 REPLIES 3
Read only

former_member230215
Participant
0 Likes
602

Di you check this https://wiki.scn.sap.com/wiki/display/Snippets/Send+mail+via+SAP+ABAP+Code

This should be added i think.

IF SY-SUBRC EQ 0.

  COMMIT WORK.

*   Push mail out from SAP outbox

  SUBMIT RSCONN01 WITH MODE = 'INT' AND RETURN.

ENDIF.

Read only

Former Member
0 Likes
602

Hi Abhijeet

The problem is not your code.

You need to set-up the email schedule job

SE36 - Create job: SAPCONNECT_INT_SEND

STEP: USER = BATCH

           PROGRAM NAME: RSCONN1

           VARIANT: (Create variant as per SE38 for this program)

SCHEDULE JOB to run every 5 minutes

Release the job.

Regards

Arden

Read only

former_member196331
Active Contributor
0 Likes
603

You have to Ask basis person, Some configuration may be there, i faced this one.

Ask basis person, I hope there is no Default Settings in Fm.