cancel
Showing results for 
Search instead for 
Did you mean: 

how to avoid ERROR_MESSAGE_STATE exception?

Former Member
0 Kudos

Hi gurus,

in our wda application, we call an abap funcion module,under certain cases, the funciton module will issue a statement like

message exxx.

then our webdynpro will dump ,with message show:

termination :ERROR_MESSAGE_STATE

...

could you please tell me how to avoid this?

thanks and best regards.

Jun

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jun,

Catch the error message in some variable, like

call function xxxx

importing

error = i_error_variable.

then

if i_error_variable is not initial.

call logic to display error.

else.

logic to be continued

endif.

Regards

Sarath

Answers (7)

Answers (7)

Former Member
0 Kudos

hi jun,

make the standard FunctionModule as Z (copy the Standard into new Z Or Y Function module)

then enable the RFC .

Regards,

janakiram.

Former Member
0 Kudos

hi,

i tried, but i still can not find the solution

1. i tried to add exception error_message = 98 when calling the function module, but the webdynpro still dump with the same exception, it seems that this is not working for webdynpro

2. Sarath Satheesan ,

call function xxxx

importing

error = i_error_variable.

will not dump the program because there is error in the importing parameter list

3. the called funciton module is sap standard , so i can not change its way on how to handling error messages

4. for some reasons i can not create a wrapper RFC around the function module (rfc does not allow generic data type as parameters)

so , i have no idea on how to do further to solve this,

could you please help me on this?

br.

jun

Former Member
0 Kudos

Jun, you can wrap the function by changing all the LIKE to TYPE in the parameter definition. Unfortunately if your RFC-enabled function simply wraps the normal FM it will not help: you will still get the ERROR_MESSAGE_STATE error. I think the only way is to actually copy the entire FM including the implementation and remove the MESSAGE commands. Depending on how the FM depends on global variables available only inside the standard Function Group this may not be possible. I'm still looking for a solution...

raja_thangamani
Active Contributor
0 Kudos

There are couple of way you can avoid the ERROR_MESSAGE_STATE exception.

1. Handle all the exception when you call the FM. For example:

Sample code:

<div class="jive-quote">

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

id = im_textid

language = im_textlanguage

name = l_textname

object = 'TEXT'

ARCHIVE_HANDLE = 0

LOCAL_CAT = ' '

IMPORTING

header = ex_header

TABLES

lines = li_tline

EXCEPTIONS

id = 1

language = 2

name = 3

not_found 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

</div>

2. If it doesnt have exception: If its custom FM, make it as remote enabled, In case of SAP FM, try to wrap up the FM into remote enabled FM.

Hope this helps you.

Raja T

Former Member
0 Kudos

i think i found the solution from

/people/mark.finnern/blog/2003/09/16/bsp-in-depth-message-statement-handling

it' s for bsp, but i think wda is the same, i will try it tomorrow in the office.

thanks for your help anyway.

jun

Former Member
0 Kudos

hi, buddies,

i found a solution that is:

append the destination 'none' to the call function.

eventhough the called function module is not rfc ready, it will not dump in WDA anyway,

but,

the sy-msgid will set to a message says , the function module is not an rfc.

any idea on how to solve this?

the solutions you proposed will not work, the WDA will dump if the called funciton module issue a message E statement directy.

br.jun

Former Member
0 Kudos

Hi

Create a structure of type symsg let's say ls_msg.

when you call the function module, in the if sy-subrc<> 0 endif block, store message id, message no and message type into

ls_msg-msgid, ls_msg-msgty, ls_msg-msgno.

then call the error message from code wizard in the same block and pass the structure

Regards

Vishal kapoor

Former Member
0 Kudos

Hi,

pls try with the following code by replacing that particular code in FM

PERFORM <method> USING '<message class>' '<message type>' <msg no> msgvar space space space

regards,

kishor.