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: 

Exception CX_DOCUMENT_BCS occurred

Former Member
0 Kudos

Hi all.

We have a program which reads file content from AL11 and send an email to User's. We are trying to send an 'XLS' file as an attachment of an email and using I  the cl_document_bcs->add_attachment. I am getting an error 'Exception CX_DOCUMENT_BCS occurred (program: CL_DOCUMENT_BCS===============CP, include: CL_DOCUMENT_BCS===============CM01C, line: 64).' while executing this report. Email has been successfully sent but attachment is missing. I debugged the program and found that in include LSOB2U02, program is calling exit SO_EXT_DB_EXIT and giving error as FM does not exists. I tried to change the xls in below code to caps but still getting error. please suggest.

  LOOP AT zcl_vcvp_logger=>i_singleton INTO lwa_objs.

*   Get data into Excel format

    lwa_objs-obj->get_xls(

      IMPORTING

        ei_xls_data = li_xls

        ev_size     = lv_size ).

*   Add attachment

    TRY.

        lv_subject = lwa_objs-file.

        document->add_attachment(

          i_attachment_type    = 'xls'                     

          i_attachment_subject = lv_subject

          i_attachment_size    = lv_size

          i_att_content_hex    = li_xls ).

      CATCH cx_document_bcs INTO lo_exc.

        lv_string = lo_exc->get_text( ).

        MESSAGE 'Error while adding attachment'(m03) TYPE 'S'.

        MESSAGE lv_string TYPE 'S'.

    ENDTRY.

    CLEAR: li_xls.

  ENDLOOP.

Thanks

Shilpa


2 REPLIES 2

rahul_negi
Explorer
0 Kudos

I know it is a bit late to reply to this question . But I was also looking for solution for the same issue .

I was getting X_ERROR = 5 as exception . It got resolved by reducing the size of the attachment.

Former Member
0 Kudos

if there is an exit, trying to call a not-existing FM, you have already the solution to your problem or don't you? Either create the FM or stop calling it.