on 10-01-2010 1:09 PM
Hello,
I have a custom screen from where supplier adds the product category themself. Now my question is - If the supplier adds any product category, it should be added in the approved supplier list. If he deletes any product category it should be deleted. We have FM BBP_PD_AVL_UPDATE to do this job. but it not working fine. Even I am not sure whether i am using it properly or not. I have initially added the Del indicator and if I remove the Active indicator it gives an error message -"Status and active flag in one item do not match" . Can any one give some sample code or any other option to do this functionality.
Thanks
Abhi
Edited by: Abhishek Bansiwala on Oct 6, 2010 1:27 PM
Hi All,
Solved the problem. Will update the pseudo code soon.
Thanks
Abhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Below is the sample code to update the item list of Approved Supplier list number.
Call Function module - 'BBP_PD_AVL_STATUS_CHANGE' before the FM 'BBP_PD_AVL_UPDATE'.
Code -
CALL FUNCTION 'BBP_PD_AVL_RESET_BUFFER'.
****Change Item status
****Get Item details based on Object Id
CALL FUNCTION 'BBP_PD_AVL_GETDETAIL'
EXPORTING
i_guid = wa_sup_list-guid
i_object_id = wa_sup_list-object_id "object id or supplier list number whose item list need to be updated
i_with_itemdata = 'X'
IMPORTING
e_header = ls_avl_header
TABLES
e_item = it_avl_item
e_partner = it_avl_partner
e_orgdata = it_avl_orgdata.
****Update the partner list
MOVE-CORRESPONDING ls_avl_header TO ls_avl_header1.
****Fill item list
APPEND LINES OF it_avl_item TO it_avl_item1.
READ TABLE it_avl_item1 INTO wa_avl_item1 WITH KEY guid = wa_avl_partner-p_guid.
wa_avl_item1-del_ind = 'X'.
wa_avl_item1-itm_released = ' '.
MODIFY it_avl_item1 FROM wa_avl_item1 TRANSPORTING del_ind itm_released WHERE guid = wa_avl_partner-p_guid.
****Fill partner list
APPEND LINES OF it_avl_partner TO it_avl_partner1.
CALL FUNCTION 'BBP_PD_AVL_STATUS_CHANGE'
EXPORTING
iv_item_guid = wa_avl_item1-guid " Item guid for which we are updating
iv_activity = 'ITIN' " ITIN for Delete line item, ITAC for Adding line item
TABLES
et_messages = it_mess "message returned
CHANGING
ev_changed = it_xfeld. "updated if the status is changed
CALL FUNCTION 'BBP_PD_AVL_UPDATE'
EXPORTING
i_header = ls_avl_header1 "header detail
i_save = 'X'
IMPORTING
e_changed = v_field " set if the avl is updated
TABLES
i_item = it_avl_item1 "pass all existing line item and change the line item which needs to be updated
i_partner = it_avl_partner1 " pass all partners as it is
i_orgdata = it_avl_orgdata " pass org data as it is
e_messages = it_message1. "returning message
IF v_field IS NOT INITIAL.
CALL FUNCTION 'BBP_PD_AVL_SAVE'
EXPORTING
iv_header_guid = ls_avl_header1-guid.
COMMIT WORK AND WAIT.
Endif.
Let me now if you have any issues.
Thanks
Abhi
Abhi,
While searching through the net I found your code, I am looking to delete a partner from the approved vendor list so our requirement is nearly the same. However, when I try to delete I get an error:
Status and active flag in one item do not match
It suggests a simple issue with matching somewhere but I haven't been able to resolve, do you happen to have an example of where you deleted a partner from an existing AVL?
Many Thanks,
Colm
Hi Govin,
Its been 2-3 years, I have not touched the SAP SRM. But I will elaborate what I did that time.
You have to call Call Function module - 'BBP_PD_AVL_STATUS_CHANGE' before the FM 'BBP_PD_AVL_UPDATE'.
Calling function FM 'BBP_PD_AVL_UPDATE' alone will not help you. You have to call Function module - 'BBP_PD_AVL_STATUS_CHANGE' before it.
Also Function Module BBP_PD_AVL_GETDETAIL will give you the exact data form filled in the table as described in the above example.
Also please pass the indicator as mentioned above in the example for your partner data.
wa_avl_item1-del_ind = 'X'. "similarly for your parnter data work area
wa_avl_item1-itm_released = ' '. ""similarly for your parnter data work area
Hope it will resolve your issue.
Thanks
Abhishek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.