2014 Nov 26 8:51 AM
Hi Experts,
I am encountering a run time error shown below while creating service purchase requisition.
Category ABAP Programming Error
Runtime Errors MESSAGE_TYPE_UNKNOWN
ABAP Program SAPLMEREQ
Application Component MM-PUR
Date and Time 26.11.2014 13:11:46
We have implemented an enhancement - MEREQ001 and exit - EXIT_SAPLMEREQ_010 for validation for G/L and cost centre.
Its function is that it checks whether GL and Cost centre combination is maintained in a Z-table or not. If not then it gives error message.
Now if I create a PR with only acc assignment category K (cost center), then it works properly.
The problem only comes when the item category is D (services).
For this case it goes to the user exit and while giving error message, the above mentioned run time error comes.
I have dubugged many times with both the case and found out that below system fields gets blank in services PR resulting to runtime error.
sy-msgty
sy-msgid
sy-msgno
Above system fields come in the include LMEREQF56 which I suppose is used to fetch data of PR to screen .
Pls find the screen shots for above issue and help to find out the problem.
Thanks,
Vishal.
2014 Nov 26 9:44 AM
Hello Vishal,
Please check the TYPE of the error message returned by your exit. Apparently, this is blank.
Alex
2014 Nov 26 9:51 AM
Hi Alex,
The TYPE of message returned from the exit is BAPIRET2-TYPE which is standard type.
And apparently this same error message works find with any other item category except for Services.
I am pasting my code for the user exit below for your reference.
+++++++++++++++++++++++++++++++++++++++++++++++++
DATA : v_mtart TYPE mtart,
wa_msg TYPE bapiret2.
DATA l_s_eban TYPE ueban.
DATA ls_ebkn TYPE ebkn.
DATA : iwbs TYPE STANDARD TABLE OF zwbs_mm WITH HEADER LINE,
wwbs TYPE zwbs_mm.
DATA : itemp TYPE TABLE OF zibs_validation,
wtemp TYPE zibs_validation.
DATA : itemp1 TYPE TABLE OF zibs_validation,
wtemp1 TYPE zibs_validation.
DATA : psp_pnr TYPE zibs_validation-psp_pnr.
DATA : weban TYPE ebkn.
DATA : mde TYPE string.
DATA : flag1 TYPE c.
SELECT * FROM zibs_validation INTO CORRESPONDING
FIELDS OF TABLE itemp
FOR ALL ENTRIES IN im_t_eban
WHERE werks EQ im_t_eban-werks.
SELECT * FROM zwbs_mm INTO CORRESPONDING FIELDS OF TABLE iwbs
FOR ALL ENTRIES IN im_t_eban
WHERE werks EQ im_t_eban-werks.
LOOP AT im_t_eban INTO l_s_eban.
IF l_s_eban-ebakz <> 'X' AND l_s_eban-loekz <> 'X'. "Added by Vishal bhatt - MoJo # 6907356 : if item is deleted or closed then it wont go for check
IF l_s_eban-knttp EQ 'Q' AND l_s_eban-matnr EQ space.
MESSAGE e001(zm_msg) WITH 'You cannot create' 'a PR without material number'.
ENDIF.
IF l_s_eban-knttp EQ 'P'.
LOOP AT im_t_ebkn INTO ls_ebkn WHERE banfn = l_s_eban-banfn
AND bnfpo = l_s_eban-bnfpo.
IF ls_ebkn-kostl IS NOT INITIAL.
CLEAR sy-ucomm.
wa_msg-type = 'E'.
wa_msg-id = 'ZM_MSG'.
wa_msg-number = '002'.
APPEND wa_msg TO ex_messages.
RAISE error_messages.
ENDIF.
CLEAR ls_ebkn.
ENDLOOP.
ENDIF.
REFRESH itemp1[].
itemp1[] = itemp[].
CLEAR weban.
READ TABLE im_t_ebkn INTO weban
WITH KEY banfn = l_s_eban-banfn
bnfpo = l_s_eban-bnfpo.
IF sy-subrc EQ 0.
IF weban-kostl IS NOT INITIAL.
IF itemp1[] IS NOT INITIAL.
DELETE itemp1[] WHERE NOT sakto EQ weban-sakto.
IF itemp1[] IS NOT INITIAL.
DELETE itemp1[] WHERE NOT kostl EQ weban-kostl.
IF itemp1[] IS INITIAL.
CLEAR sy-ucomm.
wa_msg-type = 'E'.
wa_msg-id = 'ZM_MSG'.
wa_msg-number = '003'.
APPEND wa_msg TO ex_messages.
RAISE error_messages. "HERE ITS GIVING ERROR. The control is moved to the include whose screen shot i have posted in my original post
ENDIF.
ENDIF.
ENDIF.
ELSEIF weban-ps_psp_pnr IS NOT INITIAL.
CLEAR psp_pnr.
CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
EXPORTING
input = weban-ps_psp_pnr
IMPORTING
output = psp_pnr.
LOOP AT iwbs INTO wwbs.
IF psp_pnr = wwbs-psp_pnr.
MESSAGE 'Insufficient balance in WBS. Please contact F&A' TYPE 'E'.
ENDIF.
CLEAR wwbs.
ENDLOOP.
ENDIF.
ENDIF.
CLEAR l_s_eban.
ENDIF.
ENDLOOP.
++++++++++++++++++++++++++++++++++++++++++++++++
2014 Nov 26 10:27 AM
Hi Vishal,
you mustn't use
RAISE error_messages.
Special exception error_messages must be called by throwing a message without raising an exception, for example
MESSAGE e000(38) WITH text-m01.
Even messages with RAISING can be caught this way, if the exception isn't used in the interface of the fm call.
Regards,
Klaus
2014 Nov 26 10:28 AM
Hi Vishal,
As it is a SAP program, open a service message for SAP on that issue.
Cheers,
Martin
2014 Nov 26 10:31 AM
Hi Martin,
this is caused by user exit EXIT_SAPLMEREQ_010 or ZXM02U12.
Regards,
Klaus
2014 Nov 26 10:35 AM
Dear sir,
can you send me full analyasis error details. so i can check
Thanks & regards,
kaustav das
2014 Nov 26 10:41 AM
Hi Klaus,
Thanks for replying.
It was cause by ZXM02U12.
I had tried using MESSAGE e000(38) .option already but once it goes to Error message,
it wont let me exit the screen by clicking on any of the back , cancel or exit buttons.
But I searched other threads and found below code line and added to my code.
mmpur_message_forced 'E' 'ZM_MSG' '003' '' '' '' '' .
Its working properly so far.
just wanted to know whether this line is a correct way to display message or not ?
Thanks,
Vishal
2014 Nov 26 11:11 AM
Hi Vishal,
mmpur_message is a macro defined in include MM_MESSAGES_MAC and can be used, where it is available. For example in SAPLMEREQ (= function group MEREQ) it is included within include LMEREQDXX.
Your user exit belongs to function group XM02 (which is program SAPLXM02).
I don't think that it will be useful here, because you will not have access to the same instance of global class CL_MESSAGE_MM.
So it should result in the same way, as if you'll throw the message directly.
Regards,
Klaus
2014 Nov 26 1:32 PM