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

capture error messages from CLASS cx_document_bcs

Former Member
0 Likes
2,721

Hi ,

I am using the class CL_BSC for sending mail with attachment,i need to disply the messge captured in the cx_document_bcs in spool log.

  TRY.
      lo_document->add_attachment(
      EXPORTING
      i_attachment_type = 'PDF'
      i_attachment_subject = 'Test*      
      i_attachment_subject = i_attachment_subject1
      i_att_content_hex = lt_att_content_hex ).
    CATCH cx_document_bcs INTO lx_document_bcs.
  ENDTRY.

How to disply the messges in Spool,which are captured in the cx_document_bcs.

Please advise.

Thanks

Kiran

3 REPLIES 3
Read only

Former Member
0 Likes
1,486

Hi Kiran,

Catch exceptions like this.


TRY.
...
 CATCH cx_document_bcs INTO lx_document_bcs.
     MESSAGE Ennn(ZXX).
CLEANUP.
ENDTRY.

There you can check diffrent exceptions like this.. from class CX_DOCUMENT_BCS..

ERROR_TYPE parameter of lx_document_bcs contains the below values.. or you can use message parameters. Check constructore parameters in that class.

OBJECT_NOT_EXISTS

KPRO_ERROR

MIME_NOT_AVAILABLE

Based on the code you can give meaning ful message.

Read only

0 Likes
1,486

Catch the exceptions as descibed. send messages to spool with Messase ststement. Eg, message sooo(za) with 'no records found'. That message will show up in job log. Any write statement will show up in the spool.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,486

data:lf_ref type ref to cx_root.
data:lf_string type string.

TRY.
      lo_document->add_attachment(
      EXPORTING
      i_attachment_type = 'PDF'
      i_attachment_subject = 'Test*      
      i_attachment_subject = i_attachment_subject1
      i_att_content_hex = lt_att_content_hex ).
    CATCH cx_root INTO lf_ref.
    lf_string = lf_ref->get_text( ).
     MESSAGE E101(ZMM) with lf_string.
  ENDTRY.