on 06-30-2007 1:56 AM
Hi Experts,
I am trying to change P Grp in shopping cart item. I have below questions.
1. I am trying to change using BADI BBP_PGRP_ASSIGN_BADI but unable to change it in shopping cart item.
2. Do i need to use BADI BBP_DOC_CHANGE_BADI?
3. Is it possible to change P grp belonging to other P org without changing P org?
Thanks & Regards,
Kamal
Hi,
Try this sample code.
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
ENDMETHOD.
The above code actually picks the right P grp from the Org structure and assigns the same in the SC.Also the assignement can be done in the way you want it .The logic needs to be written in the BADI "BBP_DOC_CHANGE_BADI".
BR,
Disha.
Pls reward points for useful answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The purchasing group and Purchasing Org in the SC can be changed to any value(not necessary the one to whcih he has been assigned in the Org structure) but accordingly the logic needs to be written in the BADI .
The sample code determines the P grp and Porg to whcih the user is assigned in the Org structure and then changes the value accordingly.You can accordingly change the Logic to determine the P grp/org as per your reqt.
BR,
Disha.
Pls reward points for useful answers.
Hi Disha,
I am testing it with hard coding P grp and P org. Here is my code, please suggest.
lw_pgrp-proc_group_ot = 'O'.
lw_pgrp-proc_group_id = '50001083'.
lw_pgrp-proc_org_resp_ot = 'O'.
lw_pgrp-proc_org_resp_id = '50001082'.
lw_pgrp-proc_org_ot = 'O'.
lw_pgrp-proc_org_id = '50001082'.
MODIFY et_orgdata FROM lw_pgrp TRANSPORTING proc_group_ot
proc_group_id
proc_org_resp_ot
proc_org_resp_id
proc_org_ot
proc_org_id
WHERE p_guid = gw_item-guid.
Thanks & Regards,
Kamal
I am testing in that area too
Here are my finding:
1) If you receive message Purchasing Group XXX is not assigned to Purchasing Organization YYY then you can deactivate it via Influence message control in customizing (message BBP_PD 019 )
2) If you problem is (in classic scenario) that what you receive as POrg and PGrp in backend are the ones before change it is because SRM does not keep consistence between ET_ORGDATA and ET_ITEM, then you need to change the fields BE_PUR_GROUP and BE_PUR_ORG in ET_ITEM too
If this helps you, assign points
Thanks
RD
Hi,
I have replied to your thread with text 'BADI BBP_PGRP_ASSIGN ' ,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
By using, Redistribute Workload one can change the Purchasing group of the shopping cart line item.
Thanks & Regards,
Ramkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.