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

Issue Commn Error msg in TRY ,,,CATCH

Former Member
0 Likes
509

Hi Experts,

I need to issue an error message in my code. I am writng this code below in SE38 for sending outbound data extract to PI(SAP Xi).

TRY.

    • Assign row

*loop at tzcaap into wa_zcaap.

it_prxkna1-MT_tablename_EXTRACT-RECORD-ROW = itab2.

it_prxkna1-MT_tablename_EXTRACT-RECORD-flag = itab1_fieldl1-filapcr.

CALL METHOD meth_prxy->execute_asynchronous

EXPORTING

output = it_prxkna1.

COMMIT WORK.

*endloop .

CATCH cx_ai_system_fault .

DATA fault TYPE REF TO cx_ai_system_fault .

CREATE OBJECT fault.

WRITE 😕 fault->errortext.

ENDTRY.

If PI message interface is not set up i need to issue an error message.

please tell me how to do this?

thanks

Dan

3 REPLIES 3
Read only

Sm1tje
Active Contributor
0 Likes
464

Try this:

DATA fault TYPE REF TO cx_ai_system_fault .

data: gv_message type string.

CATCH cx_ai_system_fault into fault.

gv_message = fault->get_text( ).

WRITE 😕 gv_message.

Read only

Former Member
0 Likes
464

Hi Micky Oestreich

Dont we need to create an object for fault?

please reply.

thanks

Dan.

Read only

Sm1tje
Active Contributor
0 Likes
464

No you don't. You are implicitely creating this object by catching the error into yours. Kind of a reference of the error into field fault.