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: 

ESS Leave Request message through badi PT_ABS_REQ

former_member324070
Participant

Hi experts,

I am using the Enhancement Implementation  : PT_ABS_REQ in which

i am using the method IF_EX_PT_ABS_REQ~SIMULATE_VIA_BLOP for my validations.

i am trying to display an error in ESS/MSS portal through this method.

but getting the dump in the portal

Access using a 'ZERO' object reference is not possible.

there is also a method called IF_EX_PT_ABS_REQ~PROCESS_MESSAGES for error handling

kindly help me to know the correct way to display error in portal

the code i am using for display error :

DATA : IM_MESSAGE_TAB TYPE TABLE OF PTREQ_MESSAGE_STRUC.

  WA_IM_MESSAGE_TAB-TYPE = 'E'.

WA_IM_MESSAGE_TAB-MESSAGE = 'You Cannot Apply CL With Any Other Leave'.

APPEND WA_IM_MESSAGE_TAB to IM_MESSAGE_TAB.

   CALL METHOD message_handler->get_messages

     EXPORTING

*       im_transform_msg = 'X'

*       im_pernr         =

       im_appid         'ESS_LR'

     IMPORTING

       ex_message_tab   = IM_MESSAGE_TAB

     EXCEPTIONS

       webmo_missing    = 1

       pernr_missing    = 2

       others           = 3

           .

   IF sy-subrc <> 0.

   ENDIF.


DUMP : Access using a 'ZERO' object reference is not possible.

3 REPLIES 3

former_member324070
Participant
0 Kudos

Dear Guru's,


awaiting for your response.

0 Kudos

hi ,

can u try below method .

*" Pass error : leave cannot be applied before 15 days

    CALL METHOD message_handler->add_message

      EXPORTING

        im_type       = lc_im_type                                 "Type of Message

        im_cl         = lc_im_cl                                   "Message class that you created

        im_number     = lc_msgno5                                  "Message no

        im_par1       = lc_im_par1

        im_par2       = lc_im_par2                                 "Method name as in your impl.

        im_par3       = lc_im_par3

        im_context    = lc_im_context

        im_subcontext = lc_im_subcontext

        im_classname  = lc_im_classname

        im_methodname = lc_im_methodname.

Regards,

Raju.

nishantbansal91
Active Contributor
0 Kudos

Dear Swapnil,


We had implement the same badi but in our case it's working fine. Please check with other employee.

Please paste your ST22 dump.

Please find the Reference code for the same.

METHOD if_ex_pt_abs_req~simulate_via_blop .

   TYPES: BEGIN OF p2006_recuid,

             include TYPE p2006,

             quota_recuid TYPE tim_tmwrecuid,

          END OF p2006_recuid.

   TYPES: BEGIN OF p2007_recuid,

             include TYPE p2007,

             quota_recuid TYPE tim_tmwrecuid,

          END OF p2007_recuid.

   TYPES: BEGIN OF it_quota,

             include TYPE ptarq_bapiabwkon,

             docnr TYPE ptm_docnr,

          END OF it_quota.

   DATA: lt_blop_tab    TYPE tim_tmw_blprequest_tab,

         blop_wa        TYPE LINE OF tim_tmw_blprequest_tab,

         lt_blop_temp   TYPE tim_tmw_blprequest_tab,

         lt_match_tab   TYPE ptarq_attabsdata_tab,

         lt_attabs_tab  TYPE ptarq_attabsdata_tab,

         attabs_deduct_wa TYPE LINE OF ptarq_attabs_deduct_tab,

         attabs_temp    TYPE LINE OF ptarq_attabsdata_tab,

         lt_quota_tab   TYPE TABLE OF it_quota,

         quota_wa       TYPE it_quota.

   DATA: l_selcat      TYPE tim_tmw_selcattype_entry,

         lt_selcat_tab TYPE tim_tmw_selcattype_tab,

         lt_timedata_tab TYPE tim_tmw_blprequest_tab,

         lt_pergrp_tab TYPE tim_tmw_pernr_group_tab,

         l_timedata_cmdwa  TYPE tim_tmw_commtab_entry,

         quotaded_tab  TYPE tim_quotaded_tab,

         lt_quotaded_tab  TYPE tim_quotaded_tab,

         l_ptquoded    TYPE ptquoded,

         l_p2001      TYPE p2001,

         p2001_tab    TYPE TABLE OF p2001,

         l_p2002      TYPE p2002,

         p2002_tab    TYPE TABLE OF p2002,

         l_p2006      TYPE p2006,

         l_p2006_recuid TYPE p2006_recuid,

         p2006_tab    TYPE TABLE OF p2006_recuid,

         l_p2007      TYPE p2007,

         l_p2007_recuid TYPE p2007_recuid,

         p2007_tab    TYPE TABLE OF p2007_recuid,

         l_retcd      TYPE sysubrc,

         l_556b       TYPE t556b,

         l_556q       TYPE t556q,

         l_538t       TYPE t538t,

         sel_begda    TYPE d,

         sel_endda    TYPE d.

   FIELD-SYMBOLS <timedata_blpwa> TYPE tim_tmw_blprequest_entry.

   lt_match_tab = im_attabs_tab.

*---Fill BLoP structure and add RECUID to match table

   LOOP AT lt_match_tab INTO attabs_temp.

     CLEAR lt_attabs_tab[].

     CLEAR lt_blop_temp[].

     APPEND attabs_temp TO lt_attabs_tab.

     IF attabs_temp-operation EQ cl_pt_tmw_tdm_const=>op_ins.

       CALL METHOD cl_pt_arq_badi=>convert_attabs_to_blop_ins

         EXPORTING

           im_attabs_tab = lt_attabs_tab

         IMPORTING

           ex_blop_tab   = lt_blop_temp.

     ELSE.

       CALL METHOD cl_pt_arq_badi=>convert_attabs_to_blop_del

         EXPORTING

           im_attabs_tab = lt_attabs_tab

         IMPORTING

           ex_blop_tab   = lt_blop_temp.

     ENDIF.

     READ TABLE lt_blop_temp INDEX 1 INTO blop_wa TRANSPORTING control-recuid.

     attabs_temp-tmw_recuid = blop_wa-control-recuid.

     MODIFY lt_match_tab FROM attabs_temp.

*---Use special authority status '3' for all records to disable     "INS Note1043502

*   authority check during simulation                               "INS Note1043502

     blop_wa-control-authstat = 3.                                   "INS Note912250

     MODIFY lt_blop_temp INDEX 1 FROM blop_wa                        "INS Note1043502

                         TRANSPORTING control-authstat.              "INS Note1043502

*    MODIFY lt_blop_temp FROM blop_wa TRANSPORTING control-authstat "DEL Note1043502

*     WHERE control-authstat IS INITIAL.         "INS Note912250    "DEL Note1043502

     APPEND LINES OF lt_blop_temp TO lt_blop_tab.

   ENDLOOP.

*---Get item id of record to be checked (always in first line of table)

   CLEAR attabs_temp.

   READ TABLE lt_match_tab INDEX 1 INTO attabs_temp TRANSPORTING tmw_recuid.

*---Sort LT_BLOP_TAB so that record to be checked is at first index position

   READ TABLE lt_blop_tab WITH KEY control-recuid = attabs_temp-tmw_recuid INTO blop_wa.

   IF sy-subrc EQ 0.

     DELETE lt_blop_tab INDEX sy-tabix.

     INSERT blop_wa INTO lt_blop_tab INDEX 1.

   ENDIF.

*---Call BLoP to fill TMW buffer and - if requested - add messages to message handler

   CALL METHOD cl_pt_arq_badi=>blop_maintain_timedata

     EXPORTING

       im_check_mode       = space

       im_collect_messages = im_collect_messages

     CHANGING

       ch_blop_tab         = lt_blop_tab.

*---Fill table of PERNRGROUPs and selection time period with data from checked record

   LOOP AT lt_blop_tab INTO blop_wa WHERE control-prstat NE 'ERR'.

     INSERT blop_wa-control-pernrgroup INTO TABLE lt_pergrp_tab.

     IF sel_begda IS INITIAL OR blop_wa-control-begda < sel_begda.

       sel_begda = blop_wa-control-begda.

     ENDIF.

     IF sel_endda IS INITIAL OR blop_wa-control-endda > sel_endda.

       sel_endda = blop_wa-control-endda.

     ENDIF.

   ENDLOOP.

*---Fill table of selection categories

*---Quota deduction

   l_selcat-category                  = cl_pt_tmw_tdm_const=>cat_deduct.

   l_selcat-type                      = cl_pt_tmw_tdm_const=>type_quotaded.

   APPEND l_selcat TO lt_selcat_tab.

*---Absences

   l_selcat-category                  = cl_pt_tmw_tdm_const=>cat_infty.

   l_selcat-type                      = '2001'.

   APPEND l_selcat TO lt_selcat_tab.

*---Attendances

   l_selcat-category                  = cl_pt_tmw_tdm_const=>cat_infty.

   l_selcat-type                      = '2002'.

   APPEND l_selcat TO lt_selcat_tab.

*---Absence quota

   l_selcat-category                  = cl_pt_tmw_tdm_const=>cat_infty.

   l_selcat-type                      = '2006'.

   APPEND l_selcat TO lt_selcat_tab.

*---Attendance quota

   l_selcat-category                  = cl_pt_tmw_tdm_const=>cat_infty.

   l_selcat-type                      = '2007'.

   APPEND l_selcat TO lt_selcat_tab.

*---Get all specified data records

   CALL FUNCTION 'HR_BLP_READ_TIMEDATA'

     EXPORTING

       pernrgroup    = lt_pergrp_tab

       selcattype    = lt_selcat_tab

       record_status = 0

       fromdate      = sel_begda

       todate        = sel_endda

       get_dependent = 'X'

       no_authcheck  = 'X'

     IMPORTING

       time_data     = lt_timedata_tab

       retcd         = l_retcd

     EXCEPTIONS

       OTHERS        = 1.

   IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

   ELSE.

*---Fill internal tables containing quotas, absences and attendances

     LOOP AT lt_timedata_tab ASSIGNING <timedata_blpwa>.

       CLEAR l_timedata_cmdwa.

       MOVE-CORRESPONDING <timedata_blpwa>-control TO l_timedata_cmdwa.

       l_timedata_cmdwa-data = <timedata_blpwa>-data.

       CASE l_timedata_cmdwa-type.

         WHEN 'QUOTADED'.

           CALL FUNCTION 'HR_TMW_QLDDATA_FROM_COMMTAB'

             EXPORTING

               commtab_entry   = l_timedata_cmdwa

             IMPORTING

               quoded_day      = l_ptquoded

             EXCEPTIONS

               wrong_category  = 1

               parameter_error = 2

               no_entry_found  = 3

               OTHERS          = 4.

           IF sy-subrc EQ 0.

             APPEND l_ptquoded TO quotaded_tab.

           ENDIF.

         WHEN '2001'.

           CALL FUNCTION 'HR_TMW_ITDATA_FROM_BLPREQUEST'

             EXPORTING

               blprequest_entry = <timedata_blpwa>

             IMPORTING

               infty_record     = l_p2001

             EXCEPTIONS

               wrong_category   = 1

               parameter_error  = 2

               no_entry_found   = 3

               OTHERS           = 4.

           IF sy-subrc EQ 0.

             APPEND l_p2001 TO p2001_tab.

           ENDIF.

         WHEN '2002'.

           CALL FUNCTION 'HR_TMW_ITDATA_FROM_BLPREQUEST'

             EXPORTING

               blprequest_entry = <timedata_blpwa>

             IMPORTING

               infty_record     = l_p2002

             EXCEPTIONS

               wrong_category   = 1

               parameter_error  = 2

               no_entry_found   = 3

               OTHERS           = 4.

           IF sy-subrc EQ 0.

             APPEND l_p2002 TO p2002_tab.

           ENDIF.

         WHEN '2006'.

           CALL FUNCTION 'HR_TMW_ITDATA_FROM_BLPREQUEST'

             EXPORTING

               blprequest_entry = <timedata_blpwa>

             IMPORTING

               infty_record     = l_p2006

             EXCEPTIONS

               wrong_category   = 1

               parameter_error  = 2

               no_entry_found   = 3

               OTHERS           = 4.

           IF sy-subrc EQ 0.

             MOVE-CORRESPONDING l_p2006 TO l_p2006_recuid-include.

             l_p2006_recuid-quota_recuid = <timedata_blpwa>-control-recuid.

             APPEND l_p2006_recuid TO p2006_tab.

           ENDIF.

         WHEN '2007'.

           CALL FUNCTION 'HR_TMW_ITDATA_FROM_BLPREQUEST'

             EXPORTING

               blprequest_entry = <timedata_blpwa>

             IMPORTING

               infty_record     = l_p2007

             EXCEPTIONS

               wrong_category   = 1

               parameter_error  = 2

               no_entry_found   = 3

               OTHERS           = 4.

           IF sy-subrc EQ 0.

             MOVE-CORRESPONDING l_p2007 TO l_p2007_recuid-include.

             l_p2007_recuid-quota_recuid = <timedata_blpwa>-control-recuid.

             APPEND l_p2007_recuid TO p2007_tab.

           ENDIF.

       ENDCASE.

     ENDLOOP.

*---Compose deduction tables

*---Process absences

     LOOP AT p2001_tab INTO l_p2001.

       CLEAR lt_quotaded_tab.

*---For each absence, fill table PTQUODED for each day

       LOOP AT quotaded_tab INTO l_ptquoded WHERE docnr EQ l_p2001-docnr.

         APPEND l_ptquoded TO lt_quotaded_tab.

       ENDLOOP.

       LOOP AT lt_quotaded_tab INTO l_ptquoded.

         AT NEW quonr.

*---Initialize deduction workarea

           CLEAR quota_wa.

         ENDAT.

         LOOP AT p2006_tab INTO l_p2006_recuid WHERE include-quonr EQ l_ptquoded-quonr.

           IF l_ptquoded-datum > sy-datum.

*---Planned quota for the future

             ADD l_ptquoded-quode TO quota_wa-include-ordered.

           ELSE.

*---Planned quota up to (and including) today

             ADD l_ptquoded-quode TO quota_wa-include-deduct.

           ENDIF.

         ENDLOOP.

         quota_wa-include-time_unit = l_ptquoded-quoun.

         AT END OF quonr.

           quota_wa-include-quotaend = l_p2006_recuid-include-deend.

           quota_wa-include-quotabeg = l_p2006_recuid-include-desta.

           quota_wa-include-entitle = l_p2006_recuid-include-anzhl.

           quota_wa-include-quotanum = l_p2006_recuid-include-anzhl - quota_wa-include-ordered - quota_wa-include-deduct.

           quota_wa-include-begda = l_p2001-begda.

           quota_wa-include-endda = l_p2001-endda.

           quota_wa-include-qtype = 'A'.

           quota_wa-include-leavetype = quota_wa-include-quotatype = l_p2006_recuid-include-ktart.

*---Retrieve absence quota text and time unit text

           IF NOT quota_wa IS INITIAL.

             CALL METHOD cl_pt_arq_customizing=>get_abwko_customizing

               EXPORTING

                 im_pernr      = l_p2006_recuid-include-pernr

                 im_abwko      = quota_wa-include-quotatype

               IMPORTING

                 ex_556b       = l_556b

                 ex_538t       = l_538t

               EXCEPTIONS

                 error_occured = 1

                 OTHERS        = 2.

             IF sy-subrc EQ 0.

               quota_wa-include-quotatext = l_556b-ktext.

               quota_wa-include-tiunitext = l_538t-etext.

             ENDIF.

             quota_wa-docnr = l_p2001-docnr.

*            APPEND quota_wa TO lt_quota_tab.               "Note900648

             COLLECT quota_wa INTO lt_quota_tab.             "Note900648

           ENDIF.

         ENDAT.

       ENDLOOP.

     ENDLOOP.

*---Process attendances

     LOOP AT p2002_tab INTO l_p2002.

       CLEAR lt_quotaded_tab.

*---For each attendance, fill table PTQUODED for each day

       LOOP AT quotaded_tab INTO l_ptquoded WHERE docnr EQ l_p2002-docnr.

         APPEND l_ptquoded TO lt_quotaded_tab.

       ENDLOOP.

       LOOP AT lt_quotaded_tab INTO l_ptquoded.

         AT NEW quonr.

*---Initialize deduction workarea

           CLEAR quota_wa.

         ENDAT.

         LOOP AT p2007_tab INTO l_p2007_recuid WHERE include-quonr EQ l_ptquoded-quonr.

           IF l_ptquoded-datum > sy-datum.

*---Planned quota for the future

             ADD l_ptquoded-quode TO quota_wa-include-ordered.

           ELSE.

*---Planned quota up to (and including) today

             ADD l_ptquoded-quode TO quota_wa-include-deduct.

           ENDIF.

         ENDLOOP.

         quota_wa-include-time_unit = l_ptquoded-quoun.

         AT END OF quonr.

           quota_wa-include-quotaend = l_p2007_recuid-include-deend.

           quota_wa-include-quotabeg = l_p2007_recuid-include-desta.

           quota_wa-include-entitle = l_p2007_recuid-include-anzhl.

           quota_wa-include-quotanum = l_p2007_recuid-include-anzhl - quota_wa-include-ordered - quota_wa-include-deduct.

           quota_wa-include-begda = l_p2002-begda.

           quota_wa-include-endda = l_p2002-endda.

           quota_wa-include-qtype = 'P'.

           quota_wa-include-leavetype = quota_wa-include-quotatype = l_p2007_recuid-include-ktart.

*---Retrieve attendance quota text and time unit text

           IF NOT quota_wa IS INITIAL.

             CALL METHOD cl_pt_arq_customizing=>get_anwko_customizing

               EXPORTING

                 im_pernr      = l_p2007_recuid-include-pernr

                 im_anwko      = quota_wa-include-quotatype

               IMPORTING

                 ex_556q       = l_556q

                 ex_538t       = l_538t

               EXCEPTIONS

                 error_occured = 1

                 OTHERS        = 2.

             IF sy-subrc EQ 0.

               quota_wa-include-quotatext = l_556q-ktext.

               quota_wa-include-tiunitext = l_538t-etext.

             ENDIF.

             quota_wa-docnr = l_p2002-docnr.

*            APPEND quota_wa TO lt_quota_tab.               "Note900648

             COLLECT quota_wa INTO lt_quota_tab.             "Note900648

           ENDIF.

         ENDAT.

       ENDLOOP.

     ENDLOOP.

   ENDIF.

*---TMW buffer no longer relevant

   CALL FUNCTION 'HR_TMW_BUFFER_FREE'.

*---Convert BLoP structure into infotype structure

   CALL METHOD cl_pt_arq_badi=>convert_blop_to_attabs

     EXPORTING

       im_attabs_tab = lt_match_tab

       im_blop_tab   = lt_blop_tab

     IMPORTING

       ex_attabs_tab = lt_attabs_tab.

*---Fill EX_ATTABS_DEDUCT_TAB

   LOOP AT lt_attabs_tab INTO attabs_temp.

* attabs_deduct_wa-REQUEST_ID

     CLEAR attabs_deduct_wa.

     MOVE-CORRESPONDING attabs_temp TO attabs_deduct_wa.

     IF NOT attabs_deduct_wa-abs_attribs IS INITIAL.

       READ TABLE attabs_deduct_wa-abs_attribs INDEX 1 INTO l_p2001 TRANSPORTING docnr.

       LOOP AT lt_quota_tab INTO quota_wa WHERE docnr = l_p2001-docnr.

         APPEND quota_wa TO attabs_deduct_wa-deduct_tab.

       ENDLOOP.

*      READ TABLE lt_quota_tab WITH KEY docnr = l_p2001-docnr INTO quota_wa.

*      IF sy-subrc EQ 0.

*        APPEND quota_wa TO attabs_deduct_wa-deduct_tab.

*      ENDIF.

     ENDIF.

     IF NOT attabs_deduct_wa-atts_attribs IS INITIAL.

       READ TABLE attabs_deduct_wa-atts_attribs INDEX 1 INTO l_p2002 TRANSPORTING docnr.

       LOOP AT lt_quota_tab INTO quota_wa WHERE docnr = l_p2002-docnr.

         APPEND quota_wa TO attabs_deduct_wa-deduct_tab.

       ENDLOOP.

*      READ TABLE lt_quota_tab WITH KEY docnr = l_p2002-docnr INTO quota_wa.

*      IF sy-subrc EQ 0.

*        APPEND quota_wa TO attabs_deduct_wa-deduct_tab.

*      ENDIF.

     ENDIF.

     APPEND attabs_deduct_wa TO ex_attabs_deduct_tab.

   ENDLOOP.

********** Validation for Optional Holiday ******************************

   DATA:lv_subarea TYPE btrtl,

        lv_pers_area TYPE persa,

        wa_attribs TYPE LINE OF tim_p2001_tab,

        wa_attribs1 TYPE LINE OF tim_p2001_tab,

        lv_mofid TYPE hident,

        lv_begdate TYPE scal-date,

        lv_enddate TYPE scal-date.

   DATA : gt_pernr TYPE TABLE OF pdpnr,

          wa_pernr TYPE pdpnr,

          gt_pdpsp TYPE TABLE OF pdpsp,

          wa_pdpsp TYPE pdpsp,

          gt_psp TYPE TABLE OF pdsppsp.

   DATA: idx TYPE sy-tabix.

   DATA :lt_iscal_day TYPE TABLE OF iscal_day,

         ls_iscal_day TYPE iscal_day.

     DATA: day TYPE i,

         hday TYPE i,

         month TYPE i,

         year  TYPE i,

         hdate TYPE sy-datum.

   DATA: message TYPE ptreq_message_struc.

   TYPES:

  BEGIN OF error_type,

    number TYPE sy-msgno,

    par1   TYPE sy-msgv1,

    par2    TYPE sy-msgv1,

  END OF error_type .

   TYPES error_type_tab TYPE TABLE OF error_type.

   DATA : wa_error            TYPE error_type,

       error_tab           TYPE error_type_tab.

   CONCATENATE sy-datum+0(4) '01' '01' INTO lv_begdate.

   CONCATENATE sy-datum+0(4) '12' '31' INTO lv_enddate.

*

   READ TABLE im_attabs_tab INTO attabs_temp INDEX 1.

   IF sy-subrc = 0.

     READ TABLE attabs_temp-abs_attribs INTO wa_attribs INDEX 1.

     IF sy-subrc = 0 AND wa_attribs-subty = '1060'.

       SELECT SINGLE werks btrtl FROM pa0001 INTO (lv_pers_area,lv_subarea) WHERE pernr = wa_attribs-pernr AND

                                                             begda LE wa_attribs-begda AND

                                                             endda GE wa_attribs-endda.

       SELECT SINGLE mofid FROM t001p INTO lv_mofid WHERE werks = lv_pers_area AND btrtl = lv_subarea.

       CALL FUNCTION 'HOLIDAY_GET'

         EXPORTING

           holiday_calendar           = lv_mofid

*         FACTORY_CALENDAR           = ' '

           date_from                  = lv_begdate  "wa_attribs-begda

           date_to                    = lv_enddate

         TABLES

           holidays                   = lt_iscal_day

         EXCEPTIONS

           factory_calendar_not_found = 1

           holiday_calendar_not_found = 2

           date_has_invalid_format    = 3

           date_inconsistency         = 4

           OTHERS                     = 5.

       SORT ex_attabs_deduct_tab DESCENDING.

       LOOP AT ex_attabs_deduct_tab INTO attabs_deduct_wa.

         idx = sy-tabix.

         READ TABLE lt_iscal_day INTO ls_iscal_day WITH KEY txt_long = attabs_deduct_wa-customer01.

         IF sy-subrc = 0.

           READ TABLE attabs_deduct_wa-abs_attribs INTO wa_attribs1 INDEX 1.

           IF sy-subrc = 0.

             wa_attribs1-begda = ls_iscal_day-date.

             wa_attribs1-endda = ls_iscal_day-date.

             MODIFY attabs_deduct_wa-abs_attribs INDEX 1 FROM wa_attribs1.

             MODIFY ex_attabs_deduct_tab INDEX idx FROM attabs_deduct_wa .

           ENDIF.

         ENDIF.

       ENDLOOP.

     ENDIF.

   IF sy-subrc = 0 AND wa_attribs-subty = '1040'.

     CALL FUNCTION 'RP_GET_HIRE_DATE'

             EXPORTING

               persnr          = wa_attribs-pernr

               check_infotypes = '0000'  "c_infty0

             IMPORTING

               hiredate        = hdate.

           CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

             EXPORTING

               begda     = hdate

               endda     = wa_attribs-begda

             IMPORTING

               days      = hday

               c_months  = month

               c_years   = year

             .

             IF hday LE '160'.

              wa_error-number = '003'.

              wa_error-par1 =' '.

                   wa_error-par2 =' '.

                   APPEND wa_error TO error_tab.

            ENDIF.

       endif.

   ENDIF.

   CLEAR wa_error.

   LOOP AT error_tab INTO wa_error.

     CALL METHOD message_handler->add_message

       EXPORTING

         im_type       = 'E'

         im_cl         = 'ZHR_MSGCL'

         im_number     = wa_error-number

         im_par1       = wa_error-par1

         im_par2       = wa_error-par2

         im_context    = 'CHECK TIME CONSTRAINTS'

         im_subcontext = ''

         im_classname  = 'IF_EX_PT_ABS_REQ'

         im_methodname = 'SIMULATE_VIA_BLOP'.

   ENDLOOP.

ENDMETHOD.




Thanks and Regards,