cancel
Showing results for 
Search instead for 
Did you mean: 

Shopping cart changes during the approval limit

0 Kudos

The requester creates a shopping cart with one item:

Item: pins

amount: 5

price: 1€

The approver can reduce or increase the amount of the pins.

But the amount of the pins should only be reduced!

How can I achieve this?

environment: SRM 7.01

workflow: process controlled workflow

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi David,

You will have to compare the number of pins from the FM that Ritesh pointed out which is BBP_PD_SC_GETDETAIL and that of the buffer and see if it has changed then raise a message. All this has to be done in the DOC_CHECK_BADI.

The buffer can be arrived at using the factory class/sapsrm/cl_pdo_model_factory 's Get_instance method and inturn the get_detail method.

Regards,

Naveen

0 Kudos

Hi all,

many thanks for the quick responses.

I implemented the "DOC_CHECK_BADI" Badi.

In Badi method I call the function module "BBP_PD_SC_GETDETAIL" and the Method "get_detail" of the class "class/sapsrm/cl_pdo_model_factory".

I get the return parameters "item_tab (table, BBP_PD_GETDETAIL FM)",es_headerand et_item (get_detail Method).

I can not find the buffer for the old value (amount). --> only the current value.

In other export parameters (fm, and the class) I could not find a old value (field "amount").

Where are the old values (prior to the change of approver) are stored?

With Regards,

David

Former Member
0 Kudos

Hi David,

In the check badi the iv_doc_guid that you get is the changed version guid of the header when you pass this guid to bbp_pd_sc_getdetail you get changed version of the actual data.

Now to get the old data, in the bbp_pd_sc_getdetail- ES_HEADER structure there is a field called ACTIVE_HEADER which holds the active version of the guid. If you pass this to bbp_pd_sc_Getdetail again you will get the old data and hence you can compare.

Hope it fixes your issue. -)

Regards,

Naveen

0 Kudos

Hi Naveen,

thanks for your help 🙂

In the function module "bbp_pd_sc_getdetail" does not exist the parameter "es_header",only the "e_header" return parameter.

- e_header type BBP_PDS_SC_HEADER_D

In BBP_PDS_SC_HEADER_D i can't find the field "active_header".

The GET_DETAIL method (class /SAPSRM/CL_PDO_MODEL_FACTORY) has the return parameter "es_header" with the field "active_Header".

The value is only a amount of 0.

Where is the mistake?

Former Member
0 Kudos

Hi,

Sorry for the late reply.

If you place the breakpoint in the change badi then you will notice the above solution that I gave works. As the buffer is not updated.

But when you place a breakpoint in the check badi then the above doesnt work , since the buffer is already updated.

I cant think of anyother solution apart from the two that  I list below

1. Create another zfield of boolean type in the item structure.

Set this  field in the change badi based on the below logic

it_item of change badi will have the new value for the field.

BBP_PD_SC_GETDETAIL-et_item will have the old value.

check the difference and set the zfield .

Now in the check badi see the value of the zfield and based on that show the message

2. Use import- export parameters. ( I dont like this solution )

Hope this helps.

Regards,

Naveen

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi David,

Are you only looking to flag the error whenever Approver change the Price i.e. increase then the original one? If so then you could utilize DOC_CHECK_BADI with FM BBP_PD_SC_GETDETAIL where you can get details of shopping cart with GUID or SC number and validate it accordingly.

Hope this helps.

Thank you

Ritesh

Former Member
0 Kudos

Hi,

BADI "bbp_doc_change_badi " triggers during sc approval.

You can put a check in the BADI with shopping cart status in "awaiting approval".

With Regards,

Malay