Skip to Content
avatar image
Former Member

Creation of SC or POs based on the Company Code restriction

Dear All,

I am abaper and I am new to SRM. Ours is SRM 4.0 using Extended Classic Scenario

we got one requirement that one company ex: SE04 should be blocked for further ordering of SC and POs. i.e. when creating any SC or PO they dont want to use 'SE04'. If selected it should throw an error message "Company Code SE04 can't be used for Procurement".

I wrote code in BBP_DOC_CHECK_BADI-BBP_DOC_CHECK like this..

IF flt_val = 'BUS2121'. "When create SC

LOOP AT lt_item INTO ls_item WHERE be_co_code = 'SE04'

AND del_ind <> 'X'.

CLEAR ls_message.

ls_message-msgty = 'E'.

ls_message-msgid = 'BBP_PU'.

ls_message-msgno = '001'.

ls_message-msgv1 = text-001.

APPEND ls_message TO et_messages.

ENDLOOP.

endif.

and for po also BUS2201 we done the same.

it is working fine for creation of SC and POS, but when we are chaning old SC or POs for 'SE04' then also error is coming "Company Code SE04 can't be used for Procurement".

When I put break point in BBP_DOC_CHECK_BADI-BBP_DOC_CHECK it is not stopping there also.

Please guide me for this..

Thanks,

Kiran Madineni

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jan 08, 2011 at 07:04 PM

    Hi,

    Suggest to add condition using sy-ucomm so that this check is not done in 'Change' txns (or check is done only for 'Create').

    Another idea :

    - You can verify for document creation date. For example, the check is executed only if the document created date > 01.01.2011 . This way you can avoid checking old documents.

    Best regards,

    Ramki

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 10, 2011 at 04:51 AM

    Hi,

    Are your input data coming from other system?

    If yes, export your data wether by (cos center, wbs_element, order number),

    then from the system it is needed (e.g. S1D ) add a validation in the BBP_PD_SC_GETDETAIL

    Regards,

    Saixis

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 10, 2011 at 10:49 AM

    Hello Kiran,

    Try using IV_mode Import paramter ( U or C) to your code

    Regards,

    Neelima

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I written code like this: now working for old SC and POs.

      IF flt_val = 'BUS2121'. "When create SC

      IF cs_header-created_at >= '20110110000000'.

      *if sy-title = 'Shop' and ( sy-tcode = 'BBPSC01' or sy-tcode = 'BBPSC02' or sy-tcode = 'BBPSC03' ).

      IF sy-tcode = 'BBPSC01' OR sy-tcode = 'BBPSC02' OR sy-tcode = 'BBPSC03'

      OR ( sy-tcode = 'BBPSC04' AND sy-title = 'Change Shopping Cart' ).

      LOOP AT lt_item INTO ls_item WHERE be_co_code = 'SE04'

      AND del_ind <> 'X'.

      CLEAR ls_message.

      ls_message-msgty = 'E'.

      ls_message-msgid = 'BBP_PU'.

      ls_message-msgno = '001'.

      ls_message-msgv1 = text-001.

      APPEND ls_message TO et_messages.

      ENDLOOP.

      ENDIF.

      ENDIF.

      ENDIF.

      For POS BUS2201

      Thanks

      Kiran.