on 02-05-2013 4:34 AM
Hi ,
I have to copy the vendor of first line item to all line item shopping cart please tell me is ther any
FM it is urzent
Hi,
If you want to copy the vendor to the rest of the items when you are modifing the SC you can use the badi BBP_DOC_CHANGE_BADI.
If you want to copy the vendor from a custom program you can use the bapis BBP_PD_SC_GETDETAIL, BBP_PD_SC_UPDATE and BBP_PD_SC_SAVE.
What you need to do is read the line of the partner table with partner function equal to 00000019 and p_guid equal to the guid of your first item, then append a new line for the rest of the items changing the field p_guid by the guid of the current item...
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi i ma using change badi my code is
LOOP AT it_item INTO wa_item WHERE del_ind IS INITIAL.
IF sy-tabix = 1.
READ TABLE it_partner INTO ls_partner WITH KEY partner_fct = '00000019' p_guid = wa_item-guid.
IF sy-subrc = 0.
ls_partner_1 = ls_partner.
ENDIF.
ELSE .
READ TABLE it_partner INTO ls_partner WITH KEY p_guid = wa_item-guid.
IF sy-subrc = 0.
ls_partner-partner_guid = cv_guid .
ls_partner-partner_fct = ls_partner_1-partner_fct.
ls_partner-partner_no = ls_partner_1-partner_no.
APPEND ls_partner TO it_partner .
ENDIF.
ENDIF.
but iit is not working
You need to use ET tables not IT tables. And you need to delete the previous partner if exits.
Map the tables at the beginning;
Something like this:
MOVE-CORRESPONDING is_header TO es_header.
LOOP AT it_item INTO ls_i_item.
MOVE-CORRESPONDING ls_i_item TO ls_e_item.
APPEND ls_e_item TO et_item.
ENDLOOP.
et_partner[] = it_partner[].
Then try with a code similar to this:
* Read the partner of the first item:
READ TABLE et_item INTO ls_item WITH KEY del_ind = space.
lv_guid = ls_item-guid.
READ TABLE et_partner INTO ls_partner WITH KEY p_guid = ls_item-guid
partner_fct = '00000019'
del_ind = space.
IF sy-subrc EQ 0.
ls_partner_aux = ls_partner.
LOOP AT et_item INTO ls_item WHERE p_guid NE lv_guid
AND del_ind EQ space.
* Find the partner of this item (if exits ).
READ TABLE et_partner INTO ls_partner WITH KEY p_guid = ls_item-guid
partner_fct = '00000019'
del_ind = space.
* If exits delete it
IF sy-subrc EQ 0.
ls_partner-del_ind = 'X'.
MODIFY et_partner FROM ls_partner INDEX sy-tabix.
ENDIF.
* Add the new partner:
ls_partner = ls_partner_aux.
ls_partner-p_guid = ls_item-guid.
APPEND ls_partner TO et_partner.
ENDLOOP.
ENDIF.
Hope this help you.
Regards.
* Read the partner of the first item:
READ TABLE et_item INTO ls_item WITH KEY del_ind = space.
lv_guid = ls_item-guid.
READ TABLE et_partner INTO ls_partner WITH KEY p_guid = ls_item-guid
partner_fct = '00000019'
del_ind = space.
IF sy-subrc EQ 0.
ls_partner_1 = ls_partner.
LOOP AT et_item INTO ls_item WHERE guid NE lv_guid
AND del_ind EQ space.
* * Find the partner of this item (if exits ).
READ TABLE et_partner INTO ls_partner WITH KEY p_guid = ls_item-guid
partner_fct = '00000019'
del_ind = space.
* * If exits delete it
IF sy-subrc EQ 0.
ls_partner-del_ind = 'X'.
MODIFY et_partner FROM ls_partner INDEX sy-tabix.
ENDIF.
* * Add the new partner:
ls_partner = ls_partner_1.
ls_partner-p_guid = ls_item-guid.
APPEND ls_partner TO et_partner.
ENDLOOP.
ENDIF.
not working supplier is not getting copied
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.