cancel
Showing results for 
Search instead for 
Did you mean: 

Assign Purchase group based on plant on SC line item

ashish_shah
Contributor
0 Kudos

Hi Experts

,

My Current SRM version is:

SRM_PLUS          702         0006       SAPK-70206INSRMPLUS                SRM_PLUS for mySAP SRM

SRM_SERVER     702         0006       SAPK-70206INSRMSRV  SRM_SERVER

I have a requirement where I need to assign a purchasing group to a Shopping cart line item based on the plant chosen by the user.

For this I have created a Z table which has Plants(as a key) and Purchasing group , Purchasing group ID as non key field.

For this, I am using DOC Change BADI for SC.

Now when I am assigning the Purchasing group to SC item plant in DOC Change BADI in structure ET_ITEM, This purchasing group gets assigned in the structure value BBPS_SC_ITEM_BADI -BE_PUR_GROUP.

However this Purchasing group value does not get populated to its corresponding item record in ET_ORGDATA; i.e. in BBP_PDS_ORG- PROC_GROUP_ID field.

Problem:

1.       If for each SC item plant , I fill BBPS_SC_ITEM_BADI -BE_PUR_GROUP programmatically in DOC Change BADI; after the BADI call this value of BE_PUR_GROUP does not get transferred to ET_ORGDATA table.

2.       If I try to assign Purchasing group in table ET_ORGDATA in DOC change BADI, then this structure does not get populated with all the line item’s Org Data information, so this option does not work.

Solution Tried:

1.       Change SC Line item Purchasing group value in DOC Change BADI in Tables ET_ITEM and ET_ORGDATA tables; however ET_ORGDATA table does not get populated with all the line item’s Purchasing groups when SC line item plant is changed by user.

2.       Use BADI BBP_PGRP_FIND ; however this BADI’s table ET_PURCH_DATA does not pass line item GUID in its import structure; so there is no way to determine which record belongs to which line item’s plant.

3.       Applied Implicit Enhancement at the end of following methods

a.       /SAPSRM/CL_PDO_BO_SC àORGDATA_FILL  (Enhancement Works only when user tries to create SC line item for the first time)

b.      /SAPSRM/CL_PDO_BO_SCàUPDATE_ITEM_INTERNAL (Enhancement does not provide new sets of SC line item values in case when user changes value of item plant, so doesn’t Works in SC change case)

Please let me know if the behavior of following objects has any bug or not

1.       DOC Change BADI

2.       BADI BBP_PGRP_FIND

3.       Class /SAPSRM/CL_PDO_BO_SC, method UPDATE_ITEM_INTERNAL.

Or is there any other solution to this?

Regards,

Ashish

Accepted Solutions (1)

Accepted Solutions (1)

konstantin_anikeev
Active Contributor
0 Kudos

Hi Ashish,

you should change both. BE_PUR_GROUP and ET_ORGDATA in CHANGE BADI - then it should work.

Regards

Konstantin

ashish_shah
Contributor
0 Kudos

Hi Konstantin,

I tried doing this change in DOC CHANGE BADI, however DOC Change BADI does not populate values of PORG for all the line items.

I have found the solution to this problem:

1) Append GUID and BE_PLANT field in structures BBPS_OM_RESP_ITEM_DATA & BBPS_RESP_ITEM_DATA_BADI

2) Apply implicit enhancement to LBBP_OMF03 and fill these values

3) in BADI BBP_PGRP_FIND , assign PGRP based on item plant.

This took lots of time to find ... but the final solution now seems to be perfect.

Regards,

Ashish Shah

ashish_shah
Contributor
0 Kudos

Another update:

After doing these changes in BADI, looks like the values are getting overwritten in

Class : /SAPSRM/CL_CH_WD_DODM_SC_I_BD; Method : /SAPSRM/IF_CLL_MAPPER~REFRESH.


I have opened an OSS message with SAP and will keep this thread updated with the information.

Regards,

Ashish

Message was edited by: Ashish Shah

Answers (0)