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

TRY..catch block in a loop.

Former Member
0 Likes
1,860

Hi Epxerts,

Can i use loop endloop for the following TRY..CATCH block as i need to send multiple records

LOOP.

TRY.

    • Assign row

it_prxstruc-MT_table_EXTRACT-record-row = wa_area1. --> one record of

CALL METHOD prxy->execute_asynchronous

EXPORTING

output = it_prxstruc --> 1 record.

COMMIT WORK

.

CATCH cx_ai_system_fault .

DATA fault TYPE REF TO cx_ai_system_fault .

CREATE OBJECT fault.

WRITE 😕 fault->errortext.

ENDTRY.

ENDLOOP.

Please suggest accordingly.

Thanks

Dany

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,149

Try-Endtry specifies the territory of exception that catch is going to handle. Do it this way..

TRY.
LOOP.
Assign row 
it_prxstruc-MT_table_EXTRACT-record-row = wa_area1. --> one record of 

CALL METHOD prxy->execute_asynchronous
EXPORTING
output = it_prxstruc --> 1 record.
COMMIT WORK
.
ENDLOOP.

CATCH cx_ai_system_fault .
DATA fault TYPE REF TO cx_ai_system_fault .
CREATE OBJECT fault.
WRITE :/ fault->errortext.
ENDTRY.

G@urav.

1 REPLY 1
Read only

Former Member
0 Likes
1,150

Try-Endtry specifies the territory of exception that catch is going to handle. Do it this way..

TRY.
LOOP.
Assign row 
it_prxstruc-MT_table_EXTRACT-record-row = wa_area1. --> one record of 

CALL METHOD prxy->execute_asynchronous
EXPORTING
output = it_prxstruc --> 1 record.
COMMIT WORK
.
ENDLOOP.

CATCH cx_ai_system_fault .
DATA fault TYPE REF TO cx_ai_system_fault .
CREATE OBJECT fault.
WRITE :/ fault->errortext.
ENDTRY.

G@urav.