cancel
Showing results for 
Search instead for 
Did you mean: 

How to change Preferred Vendor to Fixed Vendor in SC - SRM-5.0

Former Member
0 Kudos

SRM Experts,

We are using SRM 5.0, ECC 6.0 and PI-7.0.

We are using classic scenario in SRM. When user selects the vendor with Outline agreement in SOS tab then SC creates PO in backend system because it has Fixed Vendor otherwise SC creates PR in the backend system.

We have a new requirement in SRM to create PO instead of PR in the backend system if Purchasing Org=5xxx and total value of SC is less than USD 5XXX and Vendor is a Preferred Vendor in the SC.

Do I need to use the Check Document BADI to check the total value of the SC and to check whether it is a Preferred Vendor and then in the Change Document BADI, change the value from Preferred Vendor to the Fixed Vendor before SC is saved?

OR someone has any other suggestions on this?

Which BADI is called first Check Document or Change Document before saving the SC?

Thanks in advance!

MP

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Disha,

I tried to use the Document change BADI but I am getting an error-Partner Function May not be Changed and it shows SC contains error and nothing is saved in the SC. Do you know how to bypass this error.

Now you talked about using BADI-DETERMINE_TARGET_OBJECT to force PO creation if SC meets the requirement, do you have a sample code for this BADI.

Can you please email it to me at mru_patel@yahoo.com

Thanks in advance!

MP

Former Member
0 Kudos

Hi,

Here is a sample code i used and it works for the CHANGE badi:

method IF_EX_BBP_DOC_CHANGE_BADI~BBP_SC_CHANGE .

Constants : c_vendor type BBP_PDS_PARTNER-PARTNER_FCT

value '00000019',

c_preferred_vend type BBP_PDS_PARTNER-PARTNER_FCT

value '00000039'.

Data : ls_partner type BBP_PDS_PARTNER.

*Read Table it_partner into ls_partner With key PARTNER_FCT = c_vendor.

*

*If sy-subrc NE 0.

Loop at it_partner into ls_partner

where PARTNER_FCT Eq c_preferred_vend.

Move c_vendor To Ls_partner-PARTNER_FCT.

Modify it_partner from ls_partner index sy-tabix.

Endloop.

*Endif.

et_partner[] = it_partner[].

ET_ORGDATA[] = IT_ORGDATA[].

ET_ITEM[] = IT_ITEM[].

ES_HEADER = IS_HEADER.

ET_ACCOUNT[] = IT_ACCOUNT[].

*break ybo

*IT_PARTNER

*ET_PARTNER[]

endmethod.

BR,

Disha.

<b>Pls reward points for useful answers.</b>

Answers (10)

Answers (10)

Former Member
0 Kudos

Thank you Disha & Atul.

My problem is resolved. I alloted pointed to both of you.

Thanks again!

MP

Former Member
0 Kudos

Disha,

I put my usrid in the debugging section but still it did not stop it. Do you know if I have make any settings in tcode-SICF? If yes, what is it and how should I do it?

Thanks in advance!

You are a great helper

MP

Former Member
0 Kudos

Hi,

Which SRM version are you working on?

BR,

Disha.

Former Member
0 Kudos

Hi,

Set an endless "loop" within your active BADI implementation, for example:

do.

if x = 'x' .

exit.

endif.

enddo.

Now start your transaction and check via SM50 if you can find the "endless" process.

Just mark it and debug it directly from SM50.

Another way(If you are not able to debug from WEB) would be to create the SC from WINGUI and debug the process from there...You can go to tcode BBPSC01 and create SC from there.Before that put a session break point in your badi and then you will be able to debug the process which is more imp as you need to see the runtime values.

BR,

Disha.

<b>Pls reward points for useful answers.</b>

Former Member
0 Kudos

Hi Disha,

Can you please send me the steps for external debugging. I put the break-point in the change BADI and went to "utilities>>settings>>ABAP editior>>Debugging>> and click on IP matching and choose new debugger and checked the Session breakpoint active immed" but while creating SC it did not stop at the change BADI code. Do I need to do any other settings in the system?

Please help!

Thanks!

MP

Former Member
0 Kudos

Hi,

Under the debugging section,you will have to put the user name also with whose login you will be logging in the web screen.

BR,

Disha.

<b>Pls reward points for useful answers.</b>

Former Member
0 Kudos

Hi Disha,

Thanks for your reply.

How to debug BADI to see the runtime values?

What does mean by create a new BUP item?How to create it?

Thanks!

MP

Former Member
0 Kudos

Atul/Disha,

My problem is still not resolved. But I gave you both the points for your helpful tips.

Thanks a lot!

MP

Former Member
0 Kudos

Hi,

Thanks for the points but they are just a source of encouragement to help all the members better!Sometimes,some of the new members in the Forum are not aware that there is a way to reward the contributors for their time and efforts hence the reminder

Now regarding your problem...When you copy the items from an existing SC,did you try to debug the BADI and see the runtime values?Also another thing which you can do is Instead of converting the BUP Item try to create a new one...

BR,

Disha.

<b>Pls reward points for useful answers.</b>

Former Member
0 Kudos

Hi,

Put a break point in the BADI(If you are on SRM 5.0,you can directly put an external breakpoint in the BADI and debug from Web).At runtime ,you can see which statement of yours in the code fails for the 'COPY' action.

Do let me know.

BR,

Disha.

<b>Pls reward points for useful answers.</b>

Former Member
0 Kudos

Hey SRM experts,

Please read my previous conversation with Atul/Disha,

Can someone please help me. This is very urgent issue.

Thanks!

MP

Former Member
0 Kudos

Hi Atul/Disha,

I sent you my code and problem in detail at your email address.

Here is the requirement for Changing Preferred Vendor to Fixed Vendor. We are on SRM 5.0 and using classic scenario. I am new to SRM world. I also checked the note- 962474 in our system and it has been applied. We upgraded to SRM 5.0 in Oct-07.

1. My client has customization for sources of supply tab. It shows the vendor information in SOS tab based Product category, Plant and Purchasing group selected in the SC. If SC contains Vendor with Outline agreement then SC creates PO in the backend system. So in Change BADI logic for new enhancement of converting Preferred vendor into Fixed Vendor should not change anything in the SC using Outline agreement.

2. We have created Custom table-zsrm_fix_vend with fields, purchasing group, company code, currency and total value.

3. We need to convert the preferred vendor into fixed vendor

if the SC’s 1st line item purchasing group = zsrm_fix_vend-ekorg and

SC’s 1st line item company code = zsrm_fix_vend-bukrs and

SC’s currency = zsrm_fix_vend-currency and

SC’s Total value less than(<)zsrm_fix_vend-totalvalue.

My testing results and problems…

1. When I create a new SC with less value than totalValue from the custom table, change document BADI is changing the preferred vendor into fixed vendor and it is creating PO in the backend system. So this is working as expected.

2. When I create a new SC with greater value than totalValue from the custom table, change document BADI is NOT changing the preferred vendor into fixed vendor and it is creating PR in the backend system. So this is working as expected.

3. When I use Outline agreement in the SC, it is creating PO in the backend so change BADI logic is not affecting this existing functionality which is good.

4. Problem - When I copy a new SC from existing SC with less value than totalValue from the custom table and then changing the amount with the greater value than the custom table, change document BADI is not changing the fixed vendor to the preferred vendor and when I click on sources of supply tab - it is giving me an error “Partner Function may not be Changed” and it exits me to main shopping cart screen.

5. Problem - When I copy a new SC from existing SC with greater value than totalValue from the custom table and then changing the amount with the lessser value than the custom table, change document BADI is not changing the preferred vendor to the fixed vendor and when I click on sources of supply tab - it is giving me an error “Partner Function may not be Changed” and it exits me to main shopping cart screen.

6. When I copy the SC with Outline Agreement and change the amount it works all the time it is not affected by the change document BADI which is good.

Please help me to resolve this issue.

Millions thanks to you!

MP

Former Member
0 Kudos

Hi Disha and Atul,

Thanks for your helpful answers and efforts.

I will change my code and let you know the results and will also reward both of you with the points as I always do that.

Thanks again!

MP

Former Member
0 Kudos

Hi Disha,

The code you sent me worked as expected in the condition to change the preferred vendor to the fixed vendor when it falls under the condition. Thank you very much.

Now here is another problem....

If SC has fixed vendor and it does not fall into the condition to have a fixed vendor, so I would like to change the fixed vendor to the preferred vendor. I wrote the elseif condition to my existing code to convert fixed vendor into preferred vendor but I am getting an error-Partner Function May not be Changed and it shows SC contains error and nothing is saved in the SC. Do you know how to bypass this error?

Please help!

Thanks!

MP

Former Member
0 Kudos

Hi

Yes, you can use BBP_DOC_CHANGE_BADI and flip partner function 19 to partner function 39 and vice versa to flip from Fixed to preferred vendors !! Yes... we have done this long back successfully..

<u>Please go through the following SAP OSS Note as well -></u>

<b>Note 962474 - Error after changing partner data</b>

<u>Also go through the related links -></u>

Note 787426 - Mapping back-end purchasing group to SRM purchasing group

<u>Hope this will help. Do let me know incase you still have any queries.</u>

Regards

- Atul

Former Member
0 Kudos

Hi,

You can chnage the partner function as Atul has suggested.Its just how you write the code in the BADI.Also if the answers are helpful,please reward the contributors for their time and efforts!

Do let me know if you need any further help.

BR,

Disha.

<b>Pls reward points for useful answers.</b>

Former Member
0 Kudos

Hi,

First BBP_DOC_CHANGE_BADI is called and then BBP_DOC_CHECK_BADI .

<b>BBP_DOC_CHANGE_BADI -


>

Short Text

Changes to Purchasing Document Data

Use

You can use the Business Add-Ins BBP_DOC_CHANGE_BADI to make changes to the document, after user entry and before saving the document to the database. These changes are subject to the document-specific checks.

The parameter FLT_VAL acts as a filter value that assigns the BAdI implementation to a particular document type.</b>

You can use BADI DETERMINE_TARGET_OBJECT to force PO creation if the SC satisfies the requirement for Purchasing org,price and vendor values.

BR,

Disha.

<b>Pls reward points for useful answers.</b>