cancel
Showing results for 
Search instead for 
Did you mean: 

Catching ERROR_MESSAGE_STATE

Former Member
0 Kudos

Hello,

My webdynpro is calling a BAPI. In certain errors, the standard infotype is throwing a error message into the screen. In R/3 this works fine, but in the webdynpro the user gets a error page with an ERROR_MESSAGE_STATE.

Can I catch this message in a TRY CATCH ENDTRY segment. Which exceptions class should I use?

Tks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Sorry for the incorrection I'm using a function module. Inside this function module a MESSAGE ID x TYPE 'E' with v1 is called. In the R/3 the message is displayed. In Webdynpro or BSP an error page is shown.

The code is below.

TRY.

CALL FUNCTION 'YBPRH_BAPI_0015'

EXPORTING

IPERNR = wa_p0015-pernr

IOPER = 'INS'

IBEGDA = wa_p0015-begda

IENDDA = wa_p0015-endda

IMPORTING

ERETURN = wa_return

CHANGING

P0015 = wa_p0015

EXCEPTIONS

INVALID_OPER = 1

ERROR_IN_ENQUEUE = 2

OTHERS = 3.

CATCH cx_root.

lv_rub = 'ERROR'.

ENDTRY.

I've tried to catch the CX_ROOT exception, but the error page is still shown.

By the way, the message is throw deep inside a call to HR_INFOTYPE_OPERATION, so I can really change the logic.

Message was edited by:

Joao Sousa

Former Member
0 Kudos

Hi.

The problem is that the message command tries to write a message to the screen. In WebDynpro you do not have a connection to the screen so this dumps in some way.

You should try to only use BAPIs cause they should all work without screen connection or self developed FMs.

So you can not use this FM.

Cheers,

Sascha

Message was edited by:

Sascha Dingeldey

Former Member
0 Kudos

Hi.

What BAPI are you calling?

Cheers,

Sascha

Yashpal
Active Contributor
0 Kudos

Hi ,

i think the bapi will be giving u a return structure (BAPIRETURN )in which the error decription will be present .i dont think so that bapi throws a exception .if it throws than

u can use cx_root which is the super class for all exception

Regards

Yashpal

Message was edited by:

Yashpal Gupta

Message was edited by:

Yashpal Gupta