on 02-28-2008 11:10 PM
Hi,
How to replace old user GUID with a New User GUID inside the table CRMD_PARTNER ?? and from where can we get the GUID of a particular partner ??
Please get that in the table BUT000.
Regards
Kathirvel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would recomend the use of the appropiate function modules.
For example:
Use the partners table for passing new partner ids. (If you wish to delete the existing partner set the deletion indicators)
Shopping Cart: Use BBP_PD_SC_UPDATE and BBP_PD_SC_SAVE
Purchase Order: Use BBP_PD_PO_UPDATE and BBP_PD_PO_SAVE
Confirmation: Use BBP_PD_CONF_UPDATE and BBP_PD_CONF_SAVE
Confirmation: Use BBP_PD_INV_UPDATE and BBP_PD_INV_SAVE
Regards
Kathirvel
Thanks for the answer, I have awarded you points, but it was not clear enough, I know I have use partners table CRMD_PARTNER for passing new partner ids (I will delete existing ones also), but my question is "how do I have pass a new value and replace the existing one??", is there link between the FM and passing the values??, Appreciate more clear answer please.
Thanks
Edited by: Rahul Azi on Feb 29, 2008 12:35 AM
Hi Rahul,
The CRMD_PARTNER table stores the partner details that are maintained in a document say shopping cart as example (Header and Line Items).
Now to get all the partners of a the shopping cart use BBP_PD_SC_GETDETAIL function module. This will give all the details + partner details in table form.
Now you can use the FM BBP_PD_SC_UPDATE to change the details. You can delete an existing partner by setting the deletion indicator (DEL_IND I guess) in the partner table. If you wish to add a new partner add the partner id, partner function and guid of header / item (where the partner is required) as P_GUID.
Once the above function (BBP_PD_SC_UPDATE) call is success call the BBP_PD_SC_SAVE to save the changes.
Deleting data from SAP tables is not advisable.
Note: Once partners are assigned to a document and ordered, then you have to delete that partner and assign a new one if at all they need to be changed. Just replacing the partner guid will cause data inconsistency because except the guid all other data will still be that of the old partner. The above steps explain the procedure for the same
Hope this solves your problem.
The below code will delete the existing vendor and add a new vendor for a PO
REPORT zkb_partner_chg.
DATA: lt_e_item TYPE TABLE OF bbp_pds_po_item_d.
DATA: lt_e_partner TYPE TABLE OF bbp_pds_partner.
DATA: lt_e_messages TYPE TABLE OF bbp_pds_messages.
DATA: lt_i_item TYPE TABLE OF bbp_pds_po_item_icu.
DATA: lt_i_partner TYPE TABLE OF bbp_pds_partner.
DATA: ls_e_header TYPE bbp_pds_po_header_d.
DATA: ls_e_item TYPE bbp_pds_po_item_d.
DATA: ls_e_partner TYPE bbp_pds_partner.
DATA: ls_i_item TYPE bbp_pds_po_item_icu.
DATA: ls_i_header TYPE bbp_pds_po_header_u .
DATA: ls_but000 TYPE but000.
DATA: lv_e_changed TYPE xfeld.
FIELD-SYMBOLS: <fs_partner> TYPE bbp_pds_partner.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
i_object_id = '3200000576'
i_with_itemdata = 'X'
IMPORTING
e_header = ls_e_header
TABLES
e_item = lt_e_item
e_partner = lt_e_partner
e_messages = lt_e_messages.
* Populate Header Data and Item data
MOVE-CORRESPONDING ls_e_header TO ls_i_header.
LOOP AT lt_e_item INTO ls_e_item .
MOVE-CORRESPONDING ls_e_item TO ls_i_item.
APPEND ls_i_item TO lt_i_item.
ENDLOOP.
LOOP AT lt_e_partner INTO ls_e_partner.
APPEND ls_e_partner TO lt_i_partner.
ENDLOOP.
** Delete Partner
READ TABLE lt_i_partner ASSIGNING <fs_partner>
WITH KEY partner_fct = '00000019'
p_guid = ls_i_header-guid.
IF sy-subrc EQ 0.
<fs_partner>-del_ind = 'X'.
ENDIF.
UNASSIGN <fs_partner>.
** Add Partner
SELECT SINGLE * FROM but000 INTO ls_but000 WHERE partner = '0087000004'.
CLEAR ls_e_partner.
ls_e_partner-partner_guid = 1.
ls_e_partner-partner_no = ls_but000-partner_guid.
ls_e_partner-partner_fct = '00000019'.
ls_e_partner-p_guid = ls_i_header-guid.
APPEND ls_e_partner TO lt_i_partner.
* Update Doc
CALL FUNCTION 'BBP_PD_PO_UPDATE'
EXPORTING
i_header = ls_i_header
i_save = 'X'
iv_with_change_approval = ' '
IMPORTING
e_changed = lv_e_changed
TABLES
i_item = lt_i_item
i_partner = lt_i_partner
e_messages = lt_e_messages.
* Save Doc
IF NOT lv_e_changed IS INITIAL.
CALL FUNCTION 'BBP_PD_PO_SAVE'
EXPORTING
iv_header_guid = ls_i_header-guid.
COMMIT WORK AND WAIT.
ENDIF.
Regards
Kathirvel
Edited by: Kathirvel Balakrishnan on Feb 29, 2008 12:14 PM - Added the code sample for more clarity
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.