Skip to Content
author's profile photo Former Member
Former Member

BAdI to change pur group

Hi guys.

SRM 4.0, server 5.0. We have several different company codes within our PPOMA, and in our case 1 company code equals 1 purchasing group. Some users are what we call "cross functional" meaning that they can buy from other company codes than the one they are usually assigned to. Additional company codes and locations are simply added as attributes, but when it comes to the purchasing group I need some kind of automatic behaviour. This is what I have in mind:

When the user is changing the company code the location is also changed in the same run. I would like to use the BAdI BBP_PGRP_ASSIGN_BADI to then also trigger an automatic change of the purchasing group that would then match the company code. Something like "when company code '1001' then purchasing group = '547'."

Doesn't this sound possible? Or have I perhaps misunderstood the use of the BAdI mentioned?

Thanks for info.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 06:48 AM

    Hi,

    You can use various Business Add-Ins provided by SRM system to meet your requirements.

    Technically, it's possible using the BADIs

    BBP_DOC_CHANGE_BADI BAdI for Changing EBP Purchasing Documents

    BBP_PGRP_ASSIGN_BADI EBP Purchasing Documents: Assign Purchasing Group(s)

    BBP_PGRP_FIND Shopping Cart: Determine Responsible Purchasing Group(s)

    BBP_CREATE_BE_RQ_NEW Exit while creating a purchase requisition in backend system

    BBP_CREATE_REQ_BACK OLD Exit while creating a purch. req. in backend system

    Here is the sample code for changing the already determined Purchasing groups in SRM System.

    METHOD if_ex_bbp_doc_change_badi~bbp_sc_change.

    data:

    ls_header TYPE bbp_pds_sc_header_d,

    ls_item TYPE bbps_sc_item_badi,

    ls_orgdata TYPE bbp_pds_org,

    ls_purch_grps TYPE bbps_om_pgr_light,

    lt_purch_grps TYPE TABLE OF bbps_om_pgr_light INITIAL

    SIZE 5.

    *--- Get the shopping cart header details

    CALL FUNCTION 'BBP_PD_SC_GETDETAIL'

    EXPORTING

    i_guid = is_header-guid

    IMPORTING

    e_header = ls_header.

    • Map header data

    MOVE-CORRESPONDING is_header TO es_header.

    • Map Item data

    LOOP AT it_item INTO ls_item.

    APPEND ls_item TO et_item.

    ENDLOOP.

    et_orgdata[] = it_orgdata[].

    • For every purchasing organization, get the corresponding

    • purchasing group assigned in the Organization structure

    CALL FUNCTION 'BBP_OM_FIND_PURCH_GRPS_BEI'

    EXPORTING

    read_purch_org = 'X'

    IMPORTING

    pgrp_tab_ext = lt_purch_grps.

    • change the purch org id and purch grp id in et_orgdata

    LOOP AT it_orgdata INTO ls_orgdata.

    CLEAR: ls_item.

    READ TABLE et_item INTO ls_item WITH KEY guid = ls_orgdata-p_guid.

    IF sy-subrc EQ 0.

    CLEAR: ls_purch_grps.

    • Use ls_purch_grps to update org data based on changed purch org

    LOOP AT lt_purch_grps INTO ls_purch_grps.

    IF ls_purch_grps-purch_orgx+10(4) EQ ls_item-be_pur_org AND

    ls_purch_grps-purch_grpx+10(3) EQ ls_item-be_pur_group.

    ls_orgdata-proc_group_ot = ls_purch_grps-purch_grp-otype.

    ls_orgdata-proc_group_id = ls_purch_grps-purch_grp-objid.

    ls_orgdata-proc_org_resp_ot = ls_purch_grps-purch_org-otype.

    ls_orgdata-proc_org_resp_id = ls_purch_grps-purch_org-objid.

    ls_orgdata-proc_org_ot = ls_purch_grps-purch_org-otype.

    ls_orgdata-proc_org_id = ls_purch_grps-purch_org-objid.

    MODIFY et_orgdata FROM ls_orgdata TRANSPORTING proc_group_ot

    proc_group_id

    proc_org_resp_ot

    proc_org_resp_id

    proc_org_ot

    proc_org_id

    WHERE guid = ls_orgdata-guid.

    EXIT.

    ENDIF.

    ENDLOOP.

    ENDIF. " if sy-subrc eq 0 --> read table et_item

    ENDLOOP. " loop at it_orgdata into ls_orgdata

    ************************************************************************

    Hope this will help.

    Refer the foll thread for more details:

    changing-p-grp-in-shopping-cart-item

    BR,

    Disha.

    Pls reward points for useful answers

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 06:27 AM

    Oh and also; does anybody know of a template for using this BAdI?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.