cancel
Showing results for 
Search instead for 
Did you mean: 

COMMIT_IN_POSTING Dump

Former Member
0 Kudos

Hi Experts,

I am trying to send an E-mail of Notification -'IW52' . But, I am getting COMMIT_IN_POSTING error to my SAPInbox. Please, give me some idea . The code is as below .

My open_form:

lw_options-tdprogram = sy-repid.

lw_options-tdgetotf = c_true.

CALL FUNCTION 'OPEN_FORM'
    EXPORTING
*   APPLICATION                       = 'TX'
   ARCHIVE_INDEX                     =  TOA_DARA
   ARCHIVE_PARAMS                    =  ARC_PARAMS
      device                          = 'PRINTER'
     dialog                           = lf_dialog
    form                              = t390-form
*   LANGUAGE                          = SY-LANGU
     OPTIONS                          = lw_options

My close_form is:

FORM close_form_mail CHANGING ct_otf_data TYPE tt_otf_data
                              cw_options  TYPE itcpp.

  CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
      RESULT                           = cw_options
*     RDI_RESULT                       =
     TABLES
       otfdata                         = ct_otf_data

And I am converting the OTF to PDF and sending mail using FM SO_NEW_DOCMENT_API1.

CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
      format                = 'PDF'
      max_linewidth         = 132
    IMPORTING
      bin_filesize          = l_doc_size
    TABLES
      otf                   = otf_data
      lines                 = lit_pdfdata


  CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
    EXPORTING
      line_width_src              = 134
      line_width_dst              = 255
    TABLES
      content_in                  = lit_pdfdata
      content_out                 = lit_pdfdata_wide

*---> Call FM to send email

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = wa_document_data
      commit_work                = c_true
    TABLES
      packing_list               = it_packing_list
      contents_bin               = it_contents_bin
      contents_txt               = it_contents_txt
      receivers                  = it_reclist

  SKIP.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try this..

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
                          IN BACKGROUND TASK                " added this.
    EXPORTING
      document_data              = wa_document_data
      commit_work                = c_true
    TABLES
      packing_list               = it_packing_list
      contents_bin               = it_contents_bin
      contents_txt               = it_contents_txt
      receivers                  = it_reclist.

Thanks

Naren

Former Member
0 Kudos

Thanks Naren for your Reply. Its working .

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

In update module the commit work is not allowed...

You are passing commit work to true 'SO_NEW_DOCUMENT_ATT_SEND_API1' to this function module...

commit_work                = c_true

Remove the commit work parameter when calling the FM.

OR

Try calling the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' IN BACKGROUND TASK..

Thanks

Naren

Former Member
0 Kudos

Hi Naren,

Thanks for your Reply.

I've just tried by commenting out the commit_work = c_true : still, I couldnt resolve the issue.

How to run this FM in background .

What I observed regarding this issue is: when I am running in debug mode I am able to process the email successfully. but, getting error when processing directly .