Application Development and Automation 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: 
Read only

SRM Contract change using BBP_PD_CTR_UPDATE

sagar_pawar14
Explorer
0 Likes
1,767

Dear Experts,

I am trying to update the created SRM contracts through a upload program using BAPI BBP_PD_CTR_UPDATE.

I am able to update all fields in header and item level except ITEM STATUS field. The field in I_ITEM table is ITM_RELEASED which I am trying to make as "space"(Means item should be made inactive). The field in contract is currently active X (Item is active).

But I am getting below error - "Status and active flag in one item do not match"

Can you please suggest if anyone has faced similar issue, or if I am missing something while updating the item status ?

Thanks in advance!

Thanks

Sagar

3 REPLIES 3
Read only

Former Member
0 Likes
1,026

HI Sagar

Did you check my reply ?

This is coming from BBP_PD message class and number 433 ..

You may really have to debug to be able to figure out ..

IF ( sy-subrc EQ 0 AND it_item-itm_released EQ

                            c_item_status_inactive ) OR

         ( sy-subrc NE 0 AND it_item-itm_released NE

                             c_item_status_inactive ).

Abort if status and itm_released status are not matching

    CALL FUNCTION 'BBP_PD_MSG_ADD'

      EXPORTING

        i_msgty       = c_msgty_a

        i_msgid       = 'BBP_PD'

        i_msgno       = 433

Program SAPLBBP_PD

Include LBBP_PDF17

Regards

Vinita


Read only

oliver_wurm
Active Participant
0 Likes
1,026

Hi Sagar,

the contract item status is a combination of item field ITM_RELEASED and the item status entries, If you deactivate an item you need to set item-status  I1143 to inactive and add item-status I1144 as active status. For example the following code does that:

         gt_stat_changes-guid  = ls_item-guid.

         gt_stat_changes-stat  = 'I1143'.

         gt_stat_changes-inact = 'X'.

         APPEND gt_stat_changes.

         gt_stat_changes-stat  = 'I1144'.

         gt_stat_changes-inact = ' '.

         APPEND gt_stat_changes.

         ls_item-itm_released = space.

the problem now is that function  BBP_PD_CTR_UPDATE has no tables parameter for status so you need to call function module BBP_PROCDOC_STATUS_CHANGE_DIRE. The following code may be used as an example. It runs the status update per contract item (if needed). You need to make sure that GT_STAT_CHANGES only contains records for those contract items that need a status change (of course 🙂 )

*&---------------------------------------------------------------------*

*&      Form  STATUS_UPDATES

*&---------------------------------------------------------------------*

* Update Status of Contract Items

*----------------------------------------------------------------------*

FORM STATUS_UPDATES .

data: lt_stat type jstat occurs 1 with header line,

       lv_guid type bbp_guid.

   loop at gt_stat_changes.

     if lv_guid is initial.

       lv_guid = gt_stat_changes-guid.

     elseif lv_guid ne gt_stat_changes-guid.

       perform process_status_change tables lt_stat

                                     using  lv_guid.

       lv_guid = gt_stat_changes-guid.

     endif.

     move-corresponding gt_stat_changes to lt_stat.

     append lt_stat.

   endloop.

   if not lt_stat[] is initial and

      not lv_guid is initial.

     perform process_status_change tables lt_stat

                                   using  lv_guid.

   endif.

ENDFORM.                    " STATUS_UPDATES

*&---------------------------------------------------------------------*

*&      Form  PROCESS_STATUS_CHANGE

*&---------------------------------------------------------------------*

* Update Status in DB

*----------------------------------------------------------------------*

FORM PROCESS_STATUS_CHANGE  TABLES   PT_STAT STRUCTURE JSTAT

                             USING    PV_GUID.

   CALL FUNCTION 'BBP_PROCDOC_STATUS_CHANGE_DIRE'

     EXPORTING

       IV_ITEM_GUID                = pv_guid

       IV_OBJECT_TYPE              = 'BUS2000113'

*     IV_ONLY_CHECK               =

*     IV_SAVE_DB                  =

*     IV_SET_OLD_CHANGED_BY       = ' '

*   IMPORTING

*     EV_CHANGED                  =

     TABLES

       IT_STATUS                   = pt_stat.

ENDFORM.                    " PROCESS_STATUS_CHANGE


Regards

Oliver

Read only

Former Member
0 Likes
1,026

Hello,

please, how did you solve it? I have the same problem.

Thank you in advance.

Best regards.

Carlos.