Correct Purch Group for shopping cart
I have external requirements coming from R/3 and creating shopping carts in EBP, the problem is the puchasing groups are not correct the system uses the first PG in the organizational structure, to correct it I tried to use the badi:BBP_DOC_CHANGE_BADI, method BBP_SC_CHANGE and a source code that I find here in SDN forun, but when I send External requirements from R/3 to SRM an error occur not possible to dertmine taxes, and the shopping cart is not created , if the badi is inactive it works correctly.
The source code Iused is :
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
*--- Get the shopping cart header details
CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
I_GUID = IS_HEADER-GUID
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.
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'
READ_PURCH_ORG = 'X'
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.
READ TABLE ET_ITEM INTO LS_ITEM WITH KEY GUID = LS_ORGDATA-P_GUID.
IF SY-SUBRC EQ 0.
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
WHERE GUID = LS_ORGDATA-GUID.
ENDIF. " if sy-subrc eq 0 --> read table et_item
ENDLOOP. " loop at it_orgdata into ls_orgdata
Some help will be welcome.
Sounds like an issue with the org structure. Maybe in the purchasing group responbility tab under organization responsibility. Easy way to determine if its your org structure hiearchy is to run the function module BBP_OM_DETERMINE_RESP_PGRP. If you find all your users are returning the first group in the structure, your org hiearchy is missing something, probably the pgroups/purchasing org is not linked to company code are something along those lines.
Play with these to determine if you org structure is missing something :
You should not have to activate a badi to get the transfer program to route shopping carts to the appropriate purchasing group and display in soco.