cancel
Showing results for 
Search instead for 
Did you mean: 

Prevent confirmation for non-released PO

former_member114630
Active Participant
0 Kudos

I am trying to generate a message to the user when they try to process a confirmation in SRM for a PO that is not yet released. All approvals are done in SRM. However, after the PO is created on the backend, workflow could restart if a change is made.

In SAP, if you try to process a GR you get a message that the PO is not released. In SRM, if I try and process a confirmation, nothing happens. This could frustrate our users because they will continue to click on the confirmation icon.

I set up message BBP_CF 057 in SRM as an error message. But, if I try to do a confirmation, nothing happens.

We are on SRM 4.0 and SAP ECC 5.0.

How do I get a message to appear on the confirmation screen so that a user knows why they cannot do a confirmation?

Accepted Solutions (0)

Answers (2)

Answers (2)

yann_bouillut
Active Contributor
0 Kudos

Hi,

You can simply add an error message in the confirmation screen with bbp_doc_check badi.

In this badi, you read the backend PO release status and issue an error message for the end user in the SRM confirmation screen.

With the error message, the confirmation cannot be processed.

Kind regards,

Yann

former_member114630
Active Participant
0 Kudos

Thanks for the advice. I will look into the BADI because I did set up the message in SRM and nothing happened.

former_member114630
Active Participant
0 Kudos

Our programmer looked at the BADI. He says that it will not work because the BADI actually looks at the shopping cart number. The shopping cart may have multiple PO's. One PO may be released and the other may not. Therefore, based on that logic, we would not be able to do a confirmation on either one if we implement the BADI. Is this correct?

yann_bouillut
Active Contributor
0 Kudos

Hi,

I don't understand why the programer is speaking about the SC ??

What you want here is to check PO from confirmation ! (no matter if the PO was created from multiple different SC).

In SRM, you can confirm only one PO for a confirmation !

Thus starting from BUS2203 (confirmation) and check BUS2201 PO release status should not be an issue ???

Am i missing something ?

Kind regards,

Yann

Former Member
0 Kudos

Hi

<b>You need to Implement the BBP_DOC_CHECK_BADI for 2 seperate - BUS2201 and BUS2203 filter types and then ask your programmer to go through this SAMPLE BADI Code below -></b>

<u>Instead of Function modules -></u>

CALL FUNCTION 'BBP_PD_INV_GETDETAIL'

CALL FUNCTION 'BBP_PD_INV_GETLIST'

<u>Your progrmmaer need to use</u>

CALL FUNCTION 'BBP_PD_PO_GETDETAIL'

CALL FUNCTION 'BBP_PD_PO_GETLIST'

METHOD if_ex_bbp_doc_check_badi~bbp_doc_check.

************************************************************************
* Check if an invoice with same ref_doc_no was already created this year
************************************************************************

  INCLUDE bbp_pd_con_cl.

  DATA: ls_header               TYPE bbp_pds_inv_header_d,
        lt_partner_i            TYPE TABLE OF bbp_pds_partner,
        lt_partner_e            TYPE TABLE OF bbp_pds_partner_get,
        ls_partner              TYPE bbp_pds_partner,
        ls_partner_e            TYPE bbp_pds_partner_get,
        lt_partner_fct          TYPE bbpt_partner_fct_tab,
        lv_partner_fct_vendor   TYPE crmt_partner_fct,
        lv_partner_fct_ord_prty TYPE crmt_partner_fct,
        lv_vendor_no            TYPE crmd_partner-partner_no,
        lv_ref_doc_no           TYPE bbp_xblnr,
        lv_date                 TYPE sy-datlo,
        lt_messages             TYPE TABLE OF bbp_pds_messages,
        lt_status               TYPE TABLE OF bbp_pds_status,
        ls_status               TYPE bbp_pds_status,
        lt_invoices             TYPE TABLE OF bbp_pds_pdlist,
        ls_invoices             TYPE bbp_pds_pdlist,
        ls_messages_e           TYPE bbp_smessages_badi.

  CONSTANTS: lc_cancelled       TYPE JSTAT-STAT VALUE 'I1045'.


* get data of the invoice from guid
  CALL FUNCTION 'BBP_PD_INV_GETDETAIL'
    EXPORTING
      i_guid    = iv_doc_guid
    IMPORTING
      e_header  = ls_header
    TABLES
      e_partner = lt_partner_i.

  lv_ref_doc_no = ls_header-ref_doc_no.
  CHECK lv_ref_doc_no IS NOT INITIAL.

* get partner function of ordering party
  CALL FUNCTION 'BBP_PARTNER_TYPE_TO_FUNCTION'
    EXPORTING
      iv_partner_pft     = c_ordering_party
      iv_partner_subtype = c_subtype_b2b
    IMPORTING
      et_partner_fct     = lt_partner_fct.

  READ TABLE lt_partner_fct INTO lv_partner_fct_ord_prty INDEX 1.
  READ TABLE lt_partner_i INTO ls_partner WITH KEY partner_fct = lv_partner_fct_ord_prty.

* append ordering party to lt_partner_e for inv_getlist
  IF sy-subrc = 0.
    MOVE-CORRESPONDING ls_partner TO ls_partner_e.
    APPEND ls_partner_e TO lt_partner_e.
  ENDIF.

  CLEAR lt_partner_fct. REFRESH lt_partner_fct.
  CLEAR ls_partner.

* get partner function of vendor
  CALL FUNCTION 'BBP_PARTNER_TYPE_TO_FUNCTION'
    EXPORTING
      iv_partner_pft     = c_vendor
      iv_partner_subtype = c_subtype_b2b
    IMPORTING
      et_partner_fct     = lt_partner_fct.

  READ TABLE lt_partner_fct INTO lv_partner_fct_vendor INDEX 1.
  READ TABLE lt_partner_i INTO ls_partner WITH KEY partner_fct = lv_partner_fct_vendor.

  lv_vendor_no = ls_partner-partner_no.
  CHECK lv_vendor_no IS NOT INITIAL.

* set date to check (01.01. of this year)
  CONCATENATE sy-datlo(4) '0101' INTO lv_date.

* get list of invoices with same ref_doc_no
  CALL FUNCTION 'BBP_PD_INV_GETLIST'
    EXPORTING
      i_create_date = lv_date
      i_partner     = lv_vendor_no
      i_partner_fct = lv_partner_fct_vendor
      i_ref_doc_no  = lv_ref_doc_no
      i_with_closed = space       "excludes deleted and rejected IVs
    TABLES
      i_partners    = lt_partner_e
      e_pdlist      = lt_invoices
      e_status      = lt_status
      e_messages    = lt_messages.

  LOOP AT lt_invoices INTO ls_invoices WHERE guid <> iv_doc_guid.
* Invoice with same id was found;

*   Check now if invoice is not cancelled (deleted and rejected
*   invoices have been ignored already)
    READ TABLE lt_status WITH KEY p_guid = ls_invoices-guid
                                  stat   = lc_cancelled
                                  inact  = space
                         TRANSPORTING NO FIELDS.

    IF sy-subrc <> 0.
*   Invoice has not been cancelled
*     fill message_tab
      ls_messages_e-msgty = c_msgty_e.
      ls_messages_e-msgid = 'BBP_PD'.
      ls_messages_e-msgno = 236.
      ls_messages_e-msgv1 = lv_ref_doc_no.
      APPEND ls_messages_e TO et_messages.
*     Msg 236: Invoice already entered; check your entries
      EXIT.
    ENDIF.

  ENDLOOP.

ENDMETHOD.

Hope this will help.

Do let me know.

Regards

- Atul

former_member114630
Active Participant
0 Kudos

I will double check with the programmer. I was just repeating what he told me. I will let you know if he still has issues.

Thanks for your help as always.

former_member114630
Active Participant
0 Kudos

The programmer implemented the BADI BBP_DOC_CHECK_BADI twice (one for BUS2201 and one for BUS2203) and put several stop signs to debug the program.

When there is no line item found for goods receipt or the PO is not released, none of these BADIs were called.

When the PO is released and goods receipt can be done, only one BADI for BUS2203 was called.

What are we missing?

Former Member
0 Kudos

Hi

Where you want this Error message in SRM / R/3 back-end ?

In SRM , Try to create/ change the new or standard message to Error through the foll path:

SPRO>Supplier Relationship Management>SRM Server>Cross-Application Basic Settings>Message Control-->Influence Message Control.

Pick Business Object BU2203 for confirmation goods/service and ignore the setting which you do not want.

Else, go for using bbp_doc_check_badi for filter type - BUS2203 (confirmations)

<u>Related links -></u>

Do let me know.

Regards

- Atul