cancel
Showing results for 
Search instead for 
Did you mean: 

display message returned by function module

Former Member
0 Kudos

Hi

I want to display messages returned by function modules in message manager.

all the error message returned by function module get displayed in the form of a dump on enterprise portal which is not user friendly. i tried to capture the messages returned in this way: but it didnt worked.

CALL FUNCTION 'HR_GETEMPLOYEEDATA_FROMUSER'

EXPORTING

username = sy-uname

validbegin = sy-datum

IMPORTING

employeenumber = v_pernr

employeesubgroup = v_subgrp

EXCEPTIONS

user_not_found = 1

countrygrouping_not_found = 2

infty_not_found = 3

OTHERS = 4.

IF sy-subrc IS NOT INITIAL.

CALL METHOD l_message_manager->report_t100_message

EXPORTING

msgid = sy-msgid

msgno = sy-msgno

msgty = sy-msgty

p1 = sy-msgv1

p2 = sy-msgv2

p3 = sy-msgv3

p4 = sy-msgv4.

ENDIF.

Kindly get back to me on the same.

Regards

Vishal Kapoor

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

What is the error you are getting now? Are you still getting a dump?

former_member515618
Active Participant
0 Kudos

Please check the system variables that are returned after the function module is executed. If the Message id is blank or unknown, an error is thrown on the portal.

If the system variables are not filled with error information, then you might have to malually code for handling the errors.

Former Member
0 Kudos

hi Nithya

It is just the example i mentioned the way i handled function modules.

the real sceaniro is while using this function module

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = v_infty

number = v_pernr

subtype = stru_leave_type-key

validityend = ls_p2002-endda

validitybegin = ls_p2002-begda

record = ls_p2002

operation = c_op_ins

nocommit = 'X'

IMPORTING

return = ls_return.

Here I am updating infotype 2001 when a person applies for leave.

If it is a holiday or person has already applied leave on that date, it gives a dump on portal but if i do the same activity through transaction "PA30" system displays standard message.

actually when this function module executes, before filling the return structure, it terminates and I dont get the message no and its type.

it is just one of the case, same problem occurs in several function module calls.

Thanks

Vishal Kapoor

Former Member
0 Kudos

Hi Vishal,

You can put this function call in a try-catch block. Find out the name of the exception is raised (from ST22). Then catch this exception and then put your code for the message manager method call inside the catch. However, this will work only if your exception is an exception class.

Regards,

Neha

<i><b>PS:Reward if helpful</b></i>

Former Member
0 Kudos

Hi Neha

The dump which appears on portal, its error message type is:ERROR_MESSAGE_STATE which can be analyze using t code ST11. I checked it but didnt got any clue.

It is not a run time error in that case the error message type would have been RABAX_STATE then we can look for exception from st22 and and can catch it using try and endtry block.

Regards

Vishal Kapoor

Former Member
0 Kudos

Hi Vishal.

To understand everything correctly, the error happens when you call the message manager method, rite?

And the ls_returnm structure is empty after callinmg the FM?

Cheers,

Sascha

Former Member
0 Kudos

Actually the error occurs even before call to message manager method.

While debugging the code if I apply the breakpoint on function module and press F6 it gives dump straightaway on poral hance i cant check the content returned in the structure ls_return. i am enclousing the detailed error.

*********************************************************************************************

Error when processing your request

What has happened?

The URL http://nerpdev.ntpc.co.in:8000/sap/bc/webdynpro/sap/zileave_req/ was not called due to an error.

Note

The following error text was processed in the system ED1 : First day 06.08.2007 of attendance/absence is a day off (att./absence type CL)

The error occurred on the application server nerpdev_ED1_00 and in the work process 1 .

The termination type was: ERROR_MESSAGE_STATE

The ABAP call stack was:

Form: SEND_MESSAGES of program MP200000

Form: GIVE_MESSAGES of program MP200000

Form: EXEC_REAKTION of program MP200000

Form: REAKTION1_2000 of program MP200000

Module: REAKTION1 of program MP200000

What can I do?

If the termination type was RABAX_STATE, then you can find more information on the cause of the termination in the system ED1 in transaction ST22.

If the termination type was ABORT_MESSAGE_STATE, then you can find more information on the cause of the termination on the application server nerpdev_ED1_00 in transaction SM21.

If the termination type was ERROR_MESSAGE_STATE, then you can search for more information in the trace file for the work process 1 in transaction ST11 on the application server nerpdev_ED1_00 . In some situations, you may also need to analyze the trace files of other work processes.

If you do not yet have a user ID, contact your system administrator.

****************************************************************************

Regards

Vishal kapoor

former_member193202
Participant
0 Kudos

try like this:

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = v_infty

number = v_pernr

subtype = stru_leave_type-key

validityend = ls_p2002-endda

validitybegin = ls_p2002-begda

record = ls_p2002

operation = c_op_ins

nocommit = 'X'

IMPORTING

return = ls_return

exceptions

error_message = 1

others = 2.

If no exceptions in function module is defined or the exception is thrown inside other FM's, with ERROR_MESSAGE you can catch all other exceptions.

regards oliver

Former Member
0 Kudos

If the error occurs even before the message manager is invoked, can you try doing an F5 in the function module call? Or please try executing the function module with your values form se37. Check if it works fine independently.

Former Member
0 Kudos

I called same function module from R/3 program as well as from se37

While execution from program the structure ls_return is getting populated and i displayed the error on screen using write statement. No dump occured. It executed well from se37 also.

Thanks

Vishal Kapoor

Former Member
0 Kudos

Ok. Its your 'write' statement that is the issue. You cannot call programs/routines that have a write statement when you use them from web dynpro. Use only bapiret/ exceptions to handle your errors. Comment out the write statement and it should work fine.

Regards

Nithya

Former Member
0 Kudos

Hi Nithya

You got me wrong. i am not using write anywhere in my dynpro program.

I called F.M in a different R/3 program code using se38. I just used "write" to display the message returned in ls_return structure and it worked fine. while the same F.M with same data input does not fill the structure ls_return when executed in web dynpro program.

Thanks

Vishal Kapoor

lajitha_menon
Contributor
0 Kudos

Hi Vishal,

Did you manage to resolve this issue with regards to HR_INFOTYPE_OPERATION returning error messages.

If you have a solution, could you please share it?

Thanks

L Menon