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: 

How to use commit work in class cl_bls

Former Member
0 Kudos

Hi,

When i have used commit work after email sent,

it goes into dump.

Here is the code segment:

try.

  • -------- create persistent send request ------------------------

send_request = cl_bcs=>create_persistent( ).

  • -------- create and set document -------------------------------

pdf_content = cl_document_bcs=>xstring_to_solix( pdf_tab ).

document = cl_document_bcs=>create_document(

i_type = 'PDF'

i_hex = pdf_content

i_length = bytecount

i_subject = sub ). "#EC NOTEXT

  • add document object to send request

send_request->set_document( document ).

  • --------- add recipient (e-mail address) -----------------------

  • create recipient object

recipient = cl_cam_address_bcs=>create_internet_address( recip-recip ).

  • add recipient object to send request

send_request->add_recipient( recipient ).

  • ---------- send document ---------------------------------------

sent_to_all = send_request->send( i_with_error_screen = 'X' ).

commit work.

if sent_to_all is initial.

message i500(sbcoms) with recip.

else.

message s022(so).

endif.

  • ------------ exception handling ----------------------------------

  • replace this rudimentary exception handling with your own one !!!

catch cx_bcs into bcs_exception.

message i865(so) with bcs_exception->error_type.

endtry.

What could be the reason?

Is there any way to use commit work in class while sending email as in SO_NEW_DOCUMENT_ATT_SEND_API1 fm?

Thanks.

6 REPLIES 6

former_member555112
Active Contributor
0 Kudos

Hi,

what dump do you get?

Regards,

Ankur Parab

0 Kudos

Hi,

I have used

submit program.....

but in update task i have used it.

"Z_SD_ORDER_UPDATE". program is a print driver program.

However error says:

There is probably an error in the program

"Z_SD_ORDER_UPDATE".

This program is triggered in the update task. There, the

following ABAP/4 statements are not allowed:

- CALL SCREEN

- CALL DIALOG

- CALL TRANSACTION

- SUBMIT

I used submit as:

WAIT UP TO 2 SECONDS.

SUBMIT rsconn01 WITH mode = 'INT'

WITH output = ' '

AND RETURN.

Instead of submit i want to use commit work but i also get a dump after commit work too.

How can i use commit work in above code?

Thanks.

0 Kudos

Hi,

Instead of commit work try using following statement.

TRY.

          CALL METHOD lref_send_request->release
            EXPORTING
              i_with_error_screen = c_x.

        CATCH cx_send_req_bcs INTO lref_bcs_exception.
          error_handling 'send_request->release'
                          lref_bcs_exception->error_type.
      ENDTRY.

KR Jaideep,

0 Kudos

Hi,

You cannot use a commit work statement in update task.

Since update task will be called after commit work; so do not call the commit else you will get a dump.

Regards,

Ankur Parab

0 Kudos

Hi,

So how can i make waiting emails to be at queue, instead of a grey X on emails?

Thanks.

former_member194669
Active Contributor
0 Kudos

Why don't you use this way


          send_request->set_send_immediately( 'X' ).
          send_request->send( ).

without a commit