on 04-03-2006 5:22 PM
If SRM users entered preferred vendor for only one line item in a shopping cart which has more than one line items, I tried to populate the preferred vendor for the rest of line items.
I tried to use BADI BBP_DOC_CHANGE_BADI to insert the preferred vendor data into ET_PARTNER table, but I dont know how SAP populates the PARTNER_GUID in that table. When I debugged, I can tell it was not from tables VENMAP & BUT000. It was unique in each line in imported table IT_PARTNER.
Do I need to populates the PARTNER_GUID for my records?
Or can I just overwrite one of the record in ET_PARTNER table?
Please help!
Hi Fisher,
Here is a sample code that convert preferred vendor into fixed vendor.
You can easily change it to your requirement )
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.
Kind regards,
Yann
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yann,
My problem was that I didn't want to change the "Fixed vendor" if "Fixed vendor" was chosen. If there is more than one Free Text line items in a shopping cart and user only entered "Preferred Vendor" for one line item, I would like to populate the "Preferred Vendor" for all Free Text line items, not the line items which had "Fixed Vendor".
Thanks for your help and hope you can provide me some idea!
Best regard,
Fisher Li
Hello,
You don't have to worry about the partner guid. It's just used as an internal identifier. Relation to the item is made only through the parent guid (field p_guid).
If no partner/prefered vendor or fixed vendor exist for the item, just add a line in partner table with all necessary values (parent guid, partner function, ..) and populate the field partner_guid with a new guid using the function GUID_CREATE.
Rgds,
Pierre
Pierre,
Thank you very much and you solved my problem.
I would like to share the codes with others if they are interested:
If SRM users entered preferred vendor for only one line item
in a shopping cart which has more than one line items,
populate the preferred vendor for the rest of line items.
Get the Preferred vendor that user entered
LOOP AT IT_PARTNER INTO PF_PARTNER WHERE PARTNER_FCT = '00000039' "Preferred vendor
AND PARTNER_NO <> ''. " Vendor guid number
ENDLOOP.
IF SY-SUBRC = 0.
Check if any "free text" line item existed
LOOP AT IT_ITEM INTO LS_ITEM_IMPORT WHERE CATALOGID = ''
AND CATALOGITEM = ''
AND DEL_IND IS INITIAL
AND BE_OBJECT_ID IS INITIAL. " No purchase req created yet
Check if "free text" line item has preferred vendor
LOOP AT IT_PARTNER INTO LS_PARTNER WHERE P_GUID = LS_ITEM_IMPORT-GUID
AND PARTNER_FCT = '00000039' "Preferred vendor
AND PARTNER_NO <> ''. " Vendor guid number
ENDLOOP.
IF SY-SUBRC <> 0.
this "free text" line item does not have preferred vendor assigned
populate preferred vendor for this line items.
PF_PARTNER-P_GUID = LS_ITEM_IMPORT-GUID.
CALL FUNCTION 'GUID_CREATE'
IMPORTING
EV_GUID_16 = PF_PARTNER-PARTNER_GUID.
.
APPEND PF_PARTNER TO LT_PARTNER.
ENDIF.
ENDLOOP.
ENDIF.
I have the exact requirement to auto populate preferred vendor onto the source of supply field if a user enter a sc item preferred vendor.
BUT i am getting only one sc item in the loop at sc_items. I am not getting all the sc items at once.
Edited by: BWer on Feb 4, 2009 10:08 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.