Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Correct Purch Group for shopping cart

Hi experts

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 :

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

Some help will be welcome.

Thanks

Nilson

Former Member
Former Member replied

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 :

BBP_OM_DETERMINE_COMPANY

BBP_OM_DETERMINE_COMPANY_EXT

BBP_OM_DETERMINE_RESP_PGRP

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.

Thanks,

Justin

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question