cancel
Showing results for 
Search instead for 
Did you mean: 

Upating pricing agreements via FM CRM_PRICE_AGRMNTS_MAINTAIN_OW is not getting updated on service contract?

former_member198180
Active Participant
0 Kudos

Hi Team,

My requirement is ,i want to develop one report program to update pricing agreements on service contracts.but unfortunately i could n't able to update the pricing agreements. Could you please help here.

IF lt_appointment IS NOT INITIAL.

      READ TABLE lt_appointment INTO ls_appointment WITH KEY appt_type = 'LTTAPPEND' ref_kind = 'A'.

      IF ls_appointment IS NOT INITIAL.

        lv_end = ls_appointment-date_to.

      ENDIF.

      READ TABLE lt_appointment INTO ls_appointment WITH KEY appt_type = 'LTTAPPSTART' ref_kind = 'A'.

      IF sy-subrc = 0.

        lv_start = ls_appointment-date_from.

     ENDIF.

    ENDIF.

    IF lv_start IS NOT INITIAL AND lv_end IS NOT INITIAL.

      clear : ls_agreements, lt_price_agr,ls_price_agr.

      READ TABLE  lt_agreements INTO ls_agreements INDEX 1.

      lt_price_agr = ls_agreements-price_agreements_crm.

      READ TABLE lt_price_agr INTO ls_price_agr INDEX 1.

      ls_pri_agr-dbaction_supp = ls_price_agr-dbaction_supp.

      ls_pri_agr-dbaction_tabl = ls_price_agr-dbaction_tabl.

      ls_pri_agr-kappl = ls_price_agr-kappl.

      ls_pri_agr-kbetr = ls_price_agr-kbetr.

      ls_pri_agr-kopos = ls_price_agr-kopos.

      ls_pri_agr-kotabnr = ls_price_agr-kotabnr.

      ls_pri_agr-krech = ls_price_agr-krech.

      ls_pri_agr-kschl = ls_price_agr-kschl.

      ls_pri_agr-kvewe = ls_price_agr-kvewe.

      ls_pri_agr-mnt_ow_exists_at_db = ls_price_agr-mnt_ow_exists_at_db.

      ls_pri_agr-mnt_ow_maint_mode_on_select = ls_price_agr-mnt_ow_maint_mode_on_select.

      ls_pri_agr-prod_pr_group = ls_price_agr-prod_pr_group.

*      ls_pri_agr-varnumh = ls_price_agr-varnumh.

      CONCATENATE lv_start

               '000000'

          INTO ls_pri_agr-timestamp_from.

      CONCATENATE lv_end

              '000000'

         INTO ls_pri_agr-timestamp_to.

      INSERT ls_pri_agr INTO TABLE ls_pri_agr_crm-price_agreements_crm.

      ls_pri_del_rec  = ls_price_agr-varnumh.

      INSERT  ls_pri_del_rec INTO TABLE ls_pri_agr_crm-del_records.

      ls_pri_agr_crm-ref_handle = '0000000001'.

      ls_pri_agr_crm-ref_guid = ls_orderadm_i-guid.

      ls_pri_agr_crm-ref_kind = 'B'.

      INSERT LS_PRI_AGR_CRM INTO TABLE LT_PRI_AGR_CRM.

      CALL FUNCTION 'CRM_PRICE_AGRMNTS_MAINTAIN_OW'

        EXPORTING

          is_price_agreements_crm = ls_pri_agr_crm

        EXCEPTIONS

          error_occurred          = 1

          OTHERS                  = 2.

Thanks & Regards

Kalpana

Accepted Solutions (0)

Answers (2)

Answers (2)

Webster_Cui
Advisor
Advisor
0 Kudos

Hello Kalpana,

After CALL FUNCTION 'CRM_PRICE_AGRMNTS_MAINTAIN_OW', what's the value of  sy-subrc?


Have you tried to debug into the function module and find out why the value is not updated?

In face, the function module is not released for custom usage.


Regards,

Webster

samantak_chatterjee
Active Contributor
0 Kudos

Hi Kalpana,

Did you get any errors or exceptions ? Are all the key fields like Header ref guids and ref kind fields are populated properly ?

Also, at the end did you call the BAPI_TRANSACTION_COMIT along with CRM_ORDER_SAVE.

Hope this help.

Thanks,

Samantak.