Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAdI PT_BLP_USER, error messages e_messages and the portal

Former Member
0 Kudos

I have implemented the BAdI PT_BLP_USER, in order to restrict the request for approval for certain kind of absences, to certain start and end times.

The idea is to have a message appear in the portal when the user enters different hours than the fixed ones.

The PROCESS_DATA method returns a table, E_MESSAGES, which is a table with BAPIRET2 lines. When I try to fill that table, I get the following error in the portal:

Exception condition "MSGCATEGORY_INVALID" raised., error key: RFC_ERROR_SYSTEM_FAILURE

The code I'm trying to use is this:

method IF_EX_PT_BLP_USER~PROCESS_DATA.

 method IF_EX_PT_BLP_USER~PROCESS_DATA.

CHECK i_record->data->category = cl_pt_tmw_tdm_const=>cat_infty.
CHECK i_record->data->type = '2001'.

data: lo_infotype_2001 type ref to if_pt_td_it2001.
data: lw_infotype_2001 type p2001.

lo_infotype_2001 ?= i_record->data.
lw_infotype_2001 = lo_infotype_2001->p2001.

DATA: mess TYPE bapiret2.

IF lw_infotype_2001-begda >= '20100101'.
  CASE lw_infotype_2001-subty.
    WHEN 'P30'.
      IF lw_infotype_2001-beguz <> '143000' AND lw_infotype_2001-beguz <> '150000'.
*        MESSAGE text-e01 TYPE 'I'.
*        SET SCREEN sy-dynnr. LEAVE SCREEN.
*        mess-type = 'E'.
*        mess-id = '00'.
        mess-type = 'I'.
        mess-number = '245'.
        mess-message = text-e01.
        APPEND mess TO e_messages.
      ENDIF.
    WHEN 'PAU'.
      IF lw_infotype_2001-beguz <> '140000' AND lw_infotype_2001-beguz <> '150000'.
*        MESSAGE text-e01 TYPE 'I'.
*        SET SCREEN sy-dynnr. LEAVE SCREEN.
        mess-type = 'A'.
        mess-id = '00'.
        mess-number = '999'.
        mess-message = text-e01.
        APPEND mess TO e_messages.
      ENDIF.
  ENDCASE.
ENDIF.

endmethod.

The id and number fields have no effect, I just tried filling them also. For the type, I tried all options (E, W, I, A) with the same effect. If I donu2019t fill the type value, I get a different error (no return data, or something like that) so it is needed.

Any advice would be highly appreciated. Thank you.

6 REPLIES 6

prasenjit_sharma
Active Contributor
0 Kudos

Hi,

Do you always use message type as 'A' for subtype PAU?? This could be the reason. 'A' stands for Abend and its a runtime error that stops the execution. Secondly, you can set a break-point at your code and see where it fails.

Regards

Prasenjit

0 Kudos

Thanks for the answer.

As I mentioned, I tried all statuses (E, I, W, A) and I get the same error.

And I cannot use debug mode, since the testing is done directly in the portal.

0 Kudos

Hi,

You can set an external/http break-point in the code for the portal user that logs on to the SAP system.

Regards

Prasenjit

0 Kudos

Sorry, it's the first time I have contact with the portal. How exactly do I set that breakpoint?

Former Member
0 Kudos

I have also been trying to use this BADI for clock in/out corr. web applications. It seems this BADI PT_BLP_USER works for only Success messages (Type 'S').

You could use BADI PT_ABS_REQ to display error messages in the web application.

0 Kudos

If you want to use error message, try out category REC_MSG instead of internal msg.