cancel
Showing results for 
Search instead for 
Did you mean: 

Prevent Deletion of posted conditions in an RE Contract

Former Member
0 Kudos

Dear One,

Greetings.

We are facing issue where it is possible to delete already posted conditions in an RE Contract.

We try to check the same using BADI_RECN_CONTRACT & BADI_RECD_CONDITION through validation or substitution methods but it is not triggering any method when break point is set as a result we are unable to find the enhancement point to achieve it.

Appreciate your quick response.

Kind regards,

Kishore

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Kishore,

I did have the same requirement before. This can be done through BADI implementation.

BADI name is BADI_RE_CN_CN. You can try to use following code(with some adjustment - variable name, and logic if you would like) :

IF id_activity = '02'.

    IF if_before_store = lc_set_x.

      lo_check_cond ?= io_object.

      IF lo_check_cond IS BOUND.

        CLEAR : lwa_cond_det.

        CALL METHOD lo_check_cond->if_recn_contract~get_detail    " Get the Document Details

          RECEIVING

            rs_detail = lwa_cond_det.

        IF lwa_cond_det-intreno IS NOT INITIAL.

          REFRESH : lit_vicdcond_check, lit_vicdcfpay_check.

          CLEAR   : lwa_vicdcond_check, lwa_vicdcfpay_check.

          lfd_continue_check = 'X'.

          SELECT * FROM vicdcond INTO TABLE lit_vicdcond_check WHERE intreno = lwa_cond_det-intreno.

          IF sy-subrc = 0.

            SELECT * FROM vicdcfpay INTO TABLE lit_vicdcfpay_check FOR ALL ENTRIES IN lit_vicdcond_check

            WHERE condguid = lit_vicdcond_check-condguid.

            IF sy-subrc = 0.

              DELETE lit_vicdcfpay_check WHERE cfstatus <> 'I'.

              IF lit_vicdcfpay_check[] IS INITIAL.

                CLEAR lfd_continue_check.

              ENDIF.

            ELSE.

              CLEAR lfd_continue_check.

            ENDIF.

          ELSE.

            CLEAR lfd_continue_check.

          ENDIF.

          IF lfd_continue_check IS NOT INITIAL.

            CALL METHOD lo_check_cond->if_recd_has_condition~get_condition_mngr

              RECEIVING

                ro_condition_mngr = lo_cond_mgr.

            IF lo_cond_mgr IS BOUND.

              REFRESH : lit_condition_list.

              CALL METHOD lo_cond_mgr->get_list

                EXPORTING

                  if_incl_deleted_condition = 'X'

                IMPORTING

                  et_detail                 = lit_condition_list.

              LOOP AT lit_condition_list INTO lwa_condition_list WHERE conddelete = 'X'.

                CLEAR : lwa_vicdcfpay_check, lwa_vicdcond_check.

                READ TABLE lit_vicdcfpay_check INTO lwa_vicdcfpay_check WITH KEY condguid = lwa_condition_list-condguid.

                IF sy-subrc = 0.

                  READ TABLE lit_vicdcond_check INTO lwa_vicdcond_check WITH KEY condguid = lwa_condition_list-condguid.

                  IF sy-subrc = 0.

                    IF lwa_vicdcond_check-conddelete IS INITIAL.

                      CLEAR ls_message.

                      ls_message-msgty = 'E'.

                      ls_message-msgid = 'ZFRE_MESSAGE'.

                      ls_message-msgno = '024'.

                      APPEND ls_message TO ct_message.

                      lfd_error_occured = 'X'.

                      EXIT.

                    ENDIF.

                  ENDIF.

                ENDIF.

              ENDLOOP.

            ENDIF.

          ENDIF.

        ENDIF.

      ENDIF.

    ENDIF.

  ENDIF.

Thanks And Best Regards,

Aloysius

Former Member
0 Kudos

Dear Aloysius,

Please tell me in which method, you have applied this piece of code. I tried to apply it in method "Check All" but that method was not triggering. The methods which triggering are "SUBSTITUTE &

GET_BEHAVIOR_CONTEXT". And there in substitute method we don't have parameter 'if_before_store'. Please help me.

Regards,

Prameet

Answers (2)

Answers (2)

andre_nakratzas
Advisor
Advisor
0 Kudos

Hi Kishore,

In some cases you might have to delete an already posted condition in case of a correction that has to be made retrospectively. Have you activated the following sub function : CD01 UI for Retroactive Changes? This function reduces the risk of deleting the condition by accident, but doesn't prevent it.

See help text below:

UI for Retroactive Changes

If you activate this subfunction, the UI changes when you process contracts and rental objects in order to prevent accidental, retroactive changes that are relevant to the cash flow and result in receivables or credit memos.

Fields are initially displayed as not ready for input where changes to these fields could lead to follow-up postings. To be able to make changes, you must choose <pencil> Change A dialog box appears where you enter the date from which the change should be valid.

Activating this function does not change the existing functions but it makes them more user-friendly. We recommend that you activate the function regardless of which functions you use.

You should have activated this UI function in particular if you also use the subfunction Condition
Split
, since there is more danger of accidental, retroactive changes during the processing of shares for partners.

In addition, refer to the prerequisites for activating switches.

Regards, Andre

Former Member
0 Kudos

Hi Gurus,

Thanks for your replies.

The issue is resolved.

Kind regards,

Kishore

former_member197737
Contributor
0 Kudos

Hi,

Try with Badi BADI_RECD_CONDITION and method GET_LOCK_CONTEXT. Check the badi documentation.

Best Regards!