Skip to Content
Author's profile photo Mohammed Muzammil

Change the start date of non billable service contract through ABAP program

Background:

We have been using the BOR object ISUNBSERVC to create and end the non billable service in our present project. We were able to accomplish most of the requirements such as enrolling the customer into a service provider portfolio ( through BOR method Create ), terminating the service of a service provider ( BOR method End ) and the change of supplier scenario ( working out through End and Create BOR methods ).

It was while working on one of the interface which required changing the start date of an existing service contract we got stuck with no standard method / function in hand to do the job. So we had to write a custom method following the logic of the BOR object method ISUNBSERVC.End.

This document details the development done to achieve the task of changing the start date of a non billable service through ABAP program.

Solution:


A custom method with the existing service contract ( ESERVICE-VERTRAG ) and the to be service start date as input parameters. The sample code is as below,

DATA : lwa_eservice          TYPE eservice,

            lwa_eservice_auto  TYPE isuedi_nbservice_auto.

*–Get the contract details


     CALL FUNCTION ‘ISU_DB_ESERVICE_SINGLE’

       EXPORTING

         x_vertrag  = i_service_contract

       IMPORTING

         y_eservice = lwa_eservice

       EXCEPTIONS

         OTHERS     = 1.


            IF sy-subrc NE 0.

*–               Handle Exception

*–               Exit Out

            ENDIF.

*–Get the entire information in the deep structure


     CALL FUNCTION ‘ISU_S_NBSERVICE_PROVIDE’

       EXPORTING

         x_vertrag             = i_service_contract

         x_wmode            = ‘2’

       IMPORTING

         y_auto                = lwa_eservice_auto

       EXCEPTIONS

         not_found            = 1

         foreign_lock        = 2

         general_fault       = 3

         not_authorized    = 4

         invalid_wmode    = 5

         OTHERS           = 6.

    

         IF sy-subrc <> 0.

*         Handle Exception

*         Exit Out

         ENDIF.

*–Change the start date


      lwa_eservice_auto-eserviced_use = abap_true.

     IF i_service_start_date IS SUPPLIED.

           lwa_eservice_auto-eserviced-service_start = i_service_start_date.

     ENDIF.

     CALL FUNCTION ‘ISU_S_NBSERVICE_CHANGE’

       EXPORTING

         x_vertrag             = i_service_contract

         x_upd_online       = abap_true

         x_no_dialog        = abap_true

         x_auto                 = lwa_eservice_auto

       EXCEPTIONS

         not_found            = 1

         foreign_lock        = 2

         general_fault       = 3

         input_error          = 4

         not_authorized    = 5

         OTHERS             = 6.


       IF sy-subrc <> 0.

*       Handle Exception

*       Exit Out

       ENDIF.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.