This website is not affiliated with, sponsored by, or approved by SAP AG.

Resumable exception won't allow MESSAGE statement

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Resumable exception won't allow MESSAGE statement

Postby chris55 » Mon Feb 24, 2014 11:06 am

I'm implementing a resumable exception, but there's a MESSAGE statement within the CATCH block. This causes a CX_SY_ILLEGAL_HANDLER exception immediately after execution of the MESSAGE statement but before the RESUME statement. This doesn't happen with a non-resumable exception. Can anyone explain what's going on?

Thanks,
Chris.
chris55
 
Posts: 274
Joined: Wed Apr 02, 2003 8:29 am
Location: England, Middlesbrough

Re: Resumable exception won't allow MESSAGE statement

Postby Gothmog » Mon Feb 24, 2014 11:24 am

Are you sure it's the MESSAGE statement that's causing the error?
For RESUME to be allowed, you need:
- to use a CATCH BEFORE UNWIND block
- to raise (and propagate) the exception using the RESUMABLE addition
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Resumable exception won't allow MESSAGE statement

Postby chris55 » Mon Feb 24, 2014 11:33 am

Yes, it's definitely the MESSAGE statement causing the problem. If I remove it the problem goes away. The exception is raised via RAISE RESUMBALE EXCEPTION. The CATCH statment incorporates the BEFORE UNWIND addition, and the RESUME command is used.

Code: Select all
TRY.

.....

  CATCH BEFORE UNWIND LCX_EQCHECK INTO OB_EQCHECK.


    MESSAGE ..... TYPE 'I'.

    RESUME.    "CX_SY_ILLEGAL_HANDLER raised here

ENDTRY.
chris55
 
Posts: 274
Joined: Wed Apr 02, 2003 8:29 am
Location: England, Middlesbrough

Re: Resumable exception won't allow MESSAGE statement

Postby Gothmog » Mon Feb 24, 2014 11:46 am

Interesting. :)
Could you try to catch the CX_SY_ILLEGAL_HANDLER exception to get more details on the error encountered?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Resumable exception won't allow MESSAGE statement

Postby chris55 » Mon Feb 24, 2014 11:49 am

Yes, good idea. I'll report back tomorrow.
chris55
 
Posts: 274
Joined: Wed Apr 02, 2003 8:29 am
Location: England, Middlesbrough

Re: Resumable exception won't allow MESSAGE statement

Postby Gothmog » Mon Feb 24, 2014 12:13 pm

I tried a test program, and indeed ABAP seems to hate messages in CATCH BEFORE UNWIND blocks, even without RESUME:
UNSUPPORTED_CONTINUATION - "An attempt was made to continue the handler after a statement that had triggered its temination."
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Resumable exception won't allow MESSAGE statement

Postby chris55 » Tue Feb 25, 2014 9:43 am

Yes, that's exactly what I get: UNSUPPORTED_CONTINUATION ... I stepped through the message helper and service request classes as the message output was being processsed, but I couldn't see anything to cause the ABEND. Bit of a mystery. Easy to work around, of course, but it would be good to be able to output a message in the CATCH block.
chris55
 
Posts: 274
Joined: Wed Apr 02, 2003 8:29 am
Location: England, Middlesbrough


Return to ABAP

Who is online

Users browsing this forum: No registered users and 7 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.