cancel
Showing results for 
Search instead for 
Did you mean: 

RFC and Exceptions.

Former Member
0 Kudos

Good Morning

I am creating a RFC for update an Infotype in HR using Webdynpro Java and RFC.

I am using the following exceptions for my RFC :

ERROR_WORKSCHEDULE

ERROR_OVERTIME

ERROR_BREAK,

In the source code of the function module Z, i call the function module

CALL FUNCTION 'HR_PROPOSE_OVERTIME_2005'

EXPORTING

ADD_BREAKS = ADD_BREAKS

TABLES

m0001 = it_0001

m0002 = it_0002

m0007 = it_0007

m2001 = it_2001

m2002 = it_2002

m2003 = it_2003

CHANGING

m2005 = it_2005

EXCEPTIONS

error_workschedule = 1

error_overtime = 2

OTHERS = 3.

if sy-subrc = 1.

raise error_workschedule.

endif.

if sy-subrc = 2.

raise error_overtime.

endif.

In the portal the system display a message ERROR_WORKCHEDULE when i press a button of SEND having in count the data entered.

How can show a message friendly for the user in the application web dynpro Java? for example:

"Overtime overlaps with working or core time, was therefore delimited"

Kind Regards,

Accepted Solutions (1)

Accepted Solutions (1)

monalisa_biswal
Contributor
0 Kudos

hi,

Instead of raise statement use MESSAGE E654 RAISING <exception_id>.

Provide your own message in the message id.

In webdynpro inside catch block of rfc execute metod write code to display this message.

catch(WDDynamicRFCExecuteException ex)

{

msgMgr.reportException(ex.getMessage(),false);

}

Former Member
0 Kudos

Hi Monalisa.

I write the following code in the RFC

if sy-subrc = 1.

MESSAGE 'Test' TYPE 'I' RAISING exc1.

  • raise error_workschedule.

endif.

and in the webdynpro

public void onActionEnviar(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionEnviar(ServerEvent)

wdContext.currentZeebep021F_InputElement().setEstatus("SEND");

wdThis.wdGetRegistrar_Horas_Extras_APPController().executeZeebep021F_Input();

catch(WDDynamicRFCExecuteException ex)

{

msgMgr.reportException(ex.getMessage(),false);

}

//@@begin others

//@@end

}

But the system display error in the source code.

Kind Regards

Answers (0)