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: 

Error message handling in badi PT_ABS_REQ?

satish_kumar127
Participant
0 Kudos

Hi guys,

Implementing BADI "PT_ABS_REQ" in order to validate Attachment while sending sick leave in the method "CHECK_ATTACHMENT_MANDATORY". There is no exception parameter in this method. Was trying to implement below logic to raise then exception nin ESS Portal.

Data: MESSAGE_HANDLER Type Ref To IF_PT_REQ_MESSAGE_HANDLER.

CALL METHOD message_handler->add_message
EXPORTING
im_type = 'E'
im_cl = 'HRTIM_ABS_REQ'
im_number = '927'
im_par1 = 'CHECK_ATTACHMENT_MANDATORY'
im_par2 = 'IF_EX_PT_ABS_REQ~CHECK_ATTACHMENT_MANDATORY'
im_par3 = 'ATTACHMENT'
im_par4 = 'CHECK'
im_context = 'CHECK_ATTACHMENT'
im_subcontext = 'MANDATORY'
im_classname = 'ZHCM_CL_PT_ARQ_REQ_EXIT'
im_methodname = 'CHECK_ATTACHMENT_MANDATORY'.

and gettig dump in the portal as "ERROR: Access using a ''NULL' object reference is not possible."

tryig to figure out what went wrong......any suggestions please

Thanks & Regards,

Satish

1 REPLY 1

AndyBoolean
Participant
0 Kudos

Hi satish.kumar127,

This error tells you that you don't have a valid reference when calling the ADD_MESSAGE method. So you no object exists for the MESSAGE_HANDLER.

According to your example I assume that you haven't created an instance.

But if I remember correctly the BAdI PT_ABS_REQ has a fallback class. It's best to inherit from this class and redefine the method CHECK_ATTACHMENT_MANDATORY.

Youe should then have a protected method available with which you can collect messages. But don't ask me the name of this method. I don't have a system at hand to check this.

Best regards,
Andy