cancel
Showing results for 
Search instead for 
Did you mean: 

Problems about raising exception using T100_MSG

qingda_niu
Explorer
0 Kudos

Hi, experts.

I find that if i raise an exception and use importing-parameter 'T100_MSG', the message which in the t100_msg

will not be got by method exceptionClass->get_text( ).

the following method is a method in my class zcl_wf.

method END_WORKFLOW.

  TRY.
  
CALL METHOD CL_SWF_EVT_EVENT=>RAISE
    
EXPORTING
       IM_OBJCATEG       
= 'CL'
       IM_OBJTYPE        
= 'ZCL_WF'       " This object type does not exist
       IM_EVENT          
= 'JUST_A_EVENT' " This event does not exist
       IM_OBJKEY         
= '1110'
*       IM_EVENT_CONTAINER =
    
.
CATCH cx_swf_evt_invalid_objtype.
**-- using t100 msg
   ls_t100
-msgid = 'SWF_CST'.
   ls_t100
-msgno = '006'.
   ls_t100
-msgty = 'E'.
   ls_t100
-msgv1 = 'Invalid Object Type'.
   ls_t100
-msgv2 = 'ZCL_WF'.
*      ls_t100-msgv3 =
*      ls_t100-msgv4 =
  
raise exception type cx_swf_evt_invalid_objtype
    
exporting
       t100_msg
= ls_t100.

  ENDTRY.

endmethod.

My report:

REPORT  ZDEMO_12.

data: lo_demo   type ref to zcl_demo,
     lo_cx_wf 
type ref to cx_swf_evt_exception,
     lv_text  
type string.

start-of-selection.

create object lo_demo.

try.
  
call method lo_demo->end_workflow.
catch cx_swf_evt_exception into lo_cx_wf.
   lv_text
= lo_cx_wf->get_text( ).
  
write lv_text.
endtry.

I will get this message ‘Exception CX_SWF_EVT_INVALID_OBJTYPE occurred (program: ZCL_DEMO======================CP, include: ZCL_DEMO======================CM004, line: 25).’ after I run this report.

But what I want get is ‘Invalid Object Type ZCL_WF’.

I debugged the SAP Original Standard program, I found that in method CL_MESSAGE->CREATE_FOR_EXCEPTION Line 43 the exporting parameter subst_table does not contain the T100_MSG informations.

I debug into the method 'get_attribute_values', find that it will only return attributes value when the attribute type is one of 'NDPTXCFIsbwgy'(Line 16 of method CL_INSTANCE_DESCRIPTION->GET_ATTRIBUTE_VALUES).

I will get this message ‘Exception CX_SWF_EVT_INVALID_OBJTYPE occurred (program: ZCL_DEMO======================CP, include: ZCL_DEMO======================CM004, line: 25).’ after I run this report.

But what I want get is ‘Invalid Object Type ZCL_WF’.

  I debugged the SAP Original Standard program, I found that in method CL_MESSAGE->CREATE_FOR_EXCEPTION Line 43 the exporting parameter subst_table does not contain the T100_MSG informations.

Is it a bug or something wrong in my code?

My environment: ECC6.0


Accepted Solutions (0)

Answers (3)

Answers (3)

qingda_niu
Explorer
0 Kudos

I got the answer from other member of SCN,

Using the attribute 'T100_MS' of exceptionClass can get the message stored in 'T100_MSG' instead of using method 'get_text( )' .

Best Regards

qingda

Former Member
0 Kudos

Duplicated Issue.

Correct answer Provided by Alex in your other thread

http://scn.sap.com/thread/3367942

Cheers,

anjan_paul
Active Contributor
0 Kudos

Hi,

Your code lookin ok to me