Skip to Content
avatar image
Former Member

Item level changes not being updated.

Hi,

I am implementing BADI BBP_DOC_CHANGE_BADI, method BBP_PO_CHANGE.

The problem that I am facing is that whenever, I change anything at the Item level, after the PO has been created, (say for eg item quantity), it is not being updated to the database. I also noticed one thing. When I click on the order button (after changing the item quantity) the import parameter of the BADI it_item of the is empty. Also I am checking in transaction BBP_PD, whether the update has happened.

Thanks in advance

Pete

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 10, 2006 at 08:10 AM

    Hi Peter,

    What release and SP level have you ?

    kind regards,

    Yann

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Yann Bouillut

      Hi Yann,

      Below is the code in the BADI BBP_DOC_CHANGE_BADI.

      method IF_EX_BBP_DOC_CHANGE_BADI~BBP_PO_CHANGE.

      CLASS cl_exithandler DEFINITION LOAD.

      DATA: LV_CUF_BADI TYPE REF TO IF_EX_BBP_CUF_BADI, "ZCL_IM_SRM_TANDC_BADI, ",

      LV_CUF_BADI_ACTIVE.

      DATA: IV_MODE TYPE xfeld,

      IS_CUF_HEADER TYPE BBP_PDS_HEADER,

      IS_GETDET_HEADER TYPE BBP_PDS_PO_HEADER_D,

      ES_UPD_HEADER TYPE BBP_PDS_PO_HEADER_D,

      IS_UPD_HEADER TYPE BBP_PDS_PO_HEADER_U,

      LV_CHANGE TYPE C,

      IS_ITEM TYPE BBP_PDS_ITEM ,

      IS_ACC TYPE BBP_PDS_ACC,

      IV_DOC_TYPE TYPE CRMD_ORDERADM_H-OBJECT_TYPE VALUE 'BUS2201',

      LV_INCLUDE_NAME TYPE DD03P-TABNAME VALUE 'INCL_EEW_PD_HEADER_SSF_PO',

      LT_DDIC TYPE DD03TTYP,

      LV_REPID TYPE SY-REPID,

      LV_DYNNR TYPE SY-DYNNR,

      I_HEADER LIKE IS_CUF_HEADER,

      GV_CLAUSE_ID(256) TYPE C,

      LV_FLAG(1),

      LV_IMP(1),

      LS_COUNTER(1),

      LS_COUNT(1),

      LS_NUMB(1),

      LS_GUID(32),

      LS_GUID_INIT(32),

      LS_GUID_BLANK(32) TYPE C VALUE SPACE,

      LS_NUMB_BLANK(1) TYPE C VALUE SPACE,

      LS_CNT(1),

      LV_UCOMM(4),

      EV_OKCODE TYPE SY-UCOMM.

      DATA: WA_PDHSC TYPE BBP_PDHSC,

      WA_PDHSC_SEL TYPE BBP_PDHSC,

      *wa_it_item type BBPT_PD_PO_ITEM_ICU,

      WA_IT_ITEM TYPE BBP_PDS_PO_ITEM_ICU,

      wa_et_item TYPE BBP_PO_ITEM_BADI,

      WA_HCF TYPE BBP_PDS_HCF_PO.

      LS_COUNTER = LS_COUNTER + 1.

      IF SY-UCOMM = 'SAVE'.

      IMPORT LV_TEXT TO LV_IMP FROM MEMORY ID 'TEXT'.

      LV_IMP = LV_IMP + 1.

      EXPORT LV_TEXT FROM LV_IMP TO MEMORY ID 'TEXT'.

      ENDIF.

      IF SY-UCOMM = 'CHEC' OR SY-UCOMM = 'ENT1' OR SY-UCOMM = 'SAVE' OR SY-UCOMM = 'LIST'.

      GET PARAMETER ID 'NUMB' FIELD LS_NUMB.

      IF LS_NUMB IS INITIAL.

      MOVE IS_HEADER-GUID TO LS_GUID_INIT.

      MOVE LS_COUNTER TO LS_COUNT.

      SET PARAMETER ID 'GUID' FIELD LS_GUID_INIT.

      SET PARAMETER ID 'NUMB' FIELD LS_COUNT.

      ENDIF.

      ENDIF.

      MOVE-CORRESPONDING IS_HEADER TO I_HEADER.

      IMPORT LV_TEXT TO LV_IMP FROM MEMORY ID 'TEXT'.

      IF SY-UCOMM = 'SAVE' AND LV_IMP = 2.

      CALL METHOD cl_exithandler=>get_instance

      EXPORTING

      exit_name = 'BBP_CUF_BADI'

      IMPORTING

      act_imp_existing = LV_CUF_BADI_ACTIVE

      CHANGING

      instance = LV_CUF_BADI.

      MOVE SY-UCOMM TO LV_UCOMM.

      LV_REPID = 'SAPLZSRM_CUST_SCREEN'.

      LV_DYNNR = '1001'.

      GET PARAMETER ID 'GUID' FIELD LS_GUID.

      IF LS_GUID NE IS_HEADER-GUID.

      I_HEADER-GUID = LS_GUID.

      ENDIF.

      CALL METHOD LV_CUF_BADI->PUT_DATA

      EXPORTING

      is_header = I_HEADER

      is_item = IS_ITEM

      is_acc = IS_ACC

      iv_doc_type = 'BUS2201'

      iv_include_name = lv_include_name

      iv_mode = IV_MODE

      it_dd03p = lt_ddic

      iv_caller_dynnr = '1000'

      iv_caller_repid = SY-REPID

      IMPORTING

      ev_repid = LV_REPID

      ev_dynnr = LV_DYNNR.

      CALL METHOD LV_CUF_BADI->GET_DATA

      IMPORTING

      ev_okcode = EV_OKCODE

      CHANGING

      es_header = I_HEADER

      es_item = IS_ITEM

      es_acc = IS_ACC.

      ENDIF.

      WA_PDHSC-GUID = IS_HEADER-GUID.

      WA_PDHSC-ZZ_OPT_TERM_COND = I_HEADER-ZZ_OPT_TERM_COND.

      MOVE-CORRESPONDING IS_HEADER to ES_HEADER.

      MOVE IT_PARTNER TO ET_PARTNER.

      loop at it_item into wa_it_item.

      MOVE-CORRESPONDING wa_it_item to wa_et_item.

      append wa_et_item to et_item.

      endloop.

      MOVE IT_ACC TO ET_ACC.

      MOVE IT_HCF TO ET_HCF.

      MOVE IT_ICF TO ET_ICF.

      MOVE-CORRESPONDING WA_PDHSC TO WA_HCF.

      APPEND WA_HCF TO ET_HCF.

      IF LV_UCOMM = 'SAVE' AND LV_IMP = 2.

      SELECT * INTO WA_PDHSC_SEL FROM BBP_PDHSC WHERE GUID = IS_HEADER-GUID.

      ENDSELECT.

      IF SY-SUBRC = 0.

      UPDATE BBP_PDHSC SET ZZ_OPT_TERM_COND = WA_PDHSC-ZZ_OPT_TERM_COND WHERE GUID = IS_HEADER-GUID.

      SET PARAMETER ID 'GUID' FIELD SPACE.

      SET PARAMETER ID 'NUMB' FIELD SPACE.

      CLEAR LV_IMP.

      EXPORT LV_TEXT FROM LV_IMP TO MEMORY ID 'TEXT'.

      ELSE.

      INSERT INTO BBP_PDHSC VALUES WA_PDHSC.

      SET PARAMETER ID 'GUID' FIELD SPACE.

      SET PARAMETER ID 'NUMB' FIELD SPACE.

      CLEAR LV_IMP.

      EXPORT LV_TEXT FROM LV_IMP TO MEMORY ID 'TEXT'.

      ENDIF.

      COMMIT WORK.

      ENDIF.

      endmethod.

      Let me know if you need any clarifications.

      Thanks,

      Pete