on 03-05-2012 1:08 PM
hi experts,
i want to use the above BAPI to create cancellations and return deliveries in SRM 7. i am not able to figure out the exact data that needs to be passed to the BAPI to create cancellation/return delivery. i have used class approach to do the same and able to create them, but i am specifically interested in FM/BAPI
does anybody used this BAPI to create cancellations?
thanks
i solved it my self
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
any replies or suggestions?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
i could not make this BAPI work for cancellations but found another way of doing confirmations and cancellations using std FMs
here is the code for confirmation
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
I_OBJECT_ID = is_conf_header-po_number
I_WITH_ITEMDATA = 'X'
IMPORTING
E_HEADER = ls_header
ET_ATTACH = lt_attach
TABLES
E_ITEM = lt_item
E_ACCOUNT = lt_account
E_PARTNER = lt_partner
E_LONGTEXT = lt_longtext
E_ORGDATA = lt_orgdata
E_TAX = lt_tax
move-corresponding ls_header to ls_new_header.
ls_new_header-process_type = 'CONF'.
ls_new_header-subtype = 'CF'.
ls_new_header-src_object_type = 'BUS2201'.
ls_new_header-src_guid = ls_header-guid.
clear ls_new_header-object_id.
loop at lt_item into ls_item.
read table it_conf_items into ls_conf_items with key po_item_number = ls_item-number_int.
if sy-subrc ne 0.
continue.
endif.
move-corresponding ls_item to ls_new_item.
ls_new_item-src_object_type = 'BUS2201001'.
ls_new_item-src_guid = ls_item-guid.
ls_new_item-final_entry = ls_conf_items-final_entry.
ls_new_item-quantity = ls_conf_items-quantity.
append ls_new_item to lt_new_item.
endloop.
loop at lt_partner into ls_partner.
move-corresponding ls_partner to ls_new_partner.
append ls_new_partner to lt_new_partner.
endloop.
loop at lt_orgdata into ls_orgdata.
move-corresponding ls_orgdata to ls_new_orgdata.
append ls_new_orgdata to lt_new_orgdata.
endloop.
loop at lt_account into ls_account.
move-corresponding ls_account to ls_new_account.
append ls_new_account to lt_new_account.
endloop.
lv_src_guid = ls_header-guid. .
CALL FUNCTION 'BBP_PD_CONF_CREATE'
EXPORTING
I_SAVE = 'X'
I_HEADER = ls_new_header
I_SRC_GUID = lv_src_guid
IT_ATTACH = lt_new_attach
IMPORTING
E_HEADER = ls_e_header
ET_ATTACH = lt_e_attach
TABLES
I_ITEM = lt_new_item
I_PARTNER = lt_new_partner
I_ORGDATA = lt_new_orgdata
E_ITEM = lt_e_item
E_ACCOUNT = lt_e_account
E_PARTNER = lt_e_partner
E_ORGDATA = lt_e_orgdata
e_messages = lt_new_message
et_msg[] = lt_new_message[].
ls_conf_documents-doc_number = ls_e_header-object_id.
append ls_conf_documents to et_conf_documents.
CALL FUNCTION 'BBP_PD_CONF_SAVE'
EXPORTING
IV_USERTYPE = 'X'
IV_HEADER_GUID = ls_e_header-guid
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT
code for cancellation
get all the confirmations created for the PO
CALL FUNCTION 'BBP_PD_CONF_GETLIST'
EXPORTING
i_for_po_id = is_conf_header-po_number
TABLES
e_pdlist = lt_pdlist
e_messages = lt_msgs.
delete GRS which are cancelled
LOOP AT lt_pdlist INTO ls_pdlist WHERE subtype EQ 'CA'.
DELETE lt_pdlist WHERE guid = ls_pdlist-src_guid.
ENDLOOP.
delete the cancelllation documents. we don't need them anymore
DELETE lt_pdlist WHERE subtype EQ 'CA'.
loop at lt_pdlist into ls_pdlist.
CALL FUNCTION 'BBP_PD_CONF_GETDETAIL'
EXPORTING
I_GUID = ls_pdlist-guid
I_WITH_ITEMDATA = 'X'
IMPORTING
E_HEADER = ls_conf_hdr
TABLES
E_ITEM = lt_con_items
E_PARTNER = lt_con_partner
move-corresponding ls_conf_hdr to ls_new_header.
ls_new_header-process_type = 'CONF'.
ls_new_header-subtype = 'CA'.
ls_new_header-src_object_type = 'BUS2203'.
ls_new_header-src_guid = ls_conf_hdr-guid.
clear ls_new_header-object_id.
loop at lt_con_items into ls_con_items.
move-corresponding ls_con_items to ls_new_item.
ls_new_item-src_object_type = 'BUS2203001'.
ls_new_item-src_guid = ls_con_items-guid.
append ls_new_item to lt_new_item.
endloop.
loop at lt_con_partner into ls_con_partner.
move-corresponding ls_con_partner to ls_new_partner.
append ls_new_partner to lt_new_partner.
endloop.
lv_src_guid = ls_conf_hdr-guid.
after that call BBP_PD_CONF_CREATE as we did for the confirmation followed by BBP_PD_CONF_SAVE and commit work.
Edited by: SRM7CON on Mar 7, 2012 12:04 PM
Edited by: SRM7CON on Mar 7, 2012 12:25 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.