ā2013 Dec 14 6:27 AM
hi,
We are in SRM7. we need to create SCs using FM. we were using BBP_PD_SC_CREATE FM for this. It is working fine for normal SCs. But when we try to use this to create SCs which have LIMIT items, then it is failing. After some debugging i found that issue is happening because in form procdoc_create inside BBP_RPOCDOC_CREATE where there is a call to FM like below
* create limit
CALL FUNCTION 'BBP_PDLIM_CREATE'
EXPORTING
i_p_guid = i_header-guid
i_new_guid = new_guid
i_ref_p_guid = p_ref_guid
i_object_type = l_object_type
iv_park_or_save = lv_park_or_save
IMPORTING
e_com = l_lim_ecom
TABLES
i_limit = i_limit.
Here for i_new_kind they are passing value 'A', and because of this this FM always ends up in error.
Now I am trying to create SC using SRM4 approach as below
first call BBP_PD_SC_CREATE as below
CALL FUNCTION 'BBP_PD_SC_CREATE'
EXPORTING
i_header = ls_header
IMPORTING
e_header = ls_header_out
TABLES
e_messages = lt_message_out.
then i call BBP_PD_SC_UPDATE passing all other data
move-corresponding ls_header_out to ls_header_u.
CALL FUNCTION 'BBP_PD_SC_UPDATE'
EXPORTING
i_header = ls_header_u
i_save = 'X'
IT_ATTACH = lt_attachment
TABLES
i_item = lt_item
i_account = lt_account
i_partner = lt_partner
i_longtext = lt_longtext
i_limit = lt_sc_limit
i_orgdata = lt_org_data
e_messages = lt_message_out.
The call BBP_PD_SC_SAVE as below
CALL FUNCTION 'BBP_PD_SC_SAVE'
EXPORTING
iv_header_guid = ls_header_u-guid.
COMMIT WORK.
I am getting below error when i do this, even though i am passing item details
TYPE E
ID BBP_PD
NUMBER 238
MESSAGE Enter at least one item or one limit
Am i missing something here?
thanks
ā2013 Dec 15 10:17 AM
ā2013 Dec 14 7:30 AM
Hii Sankara,
This code is working fine for me.
Its the test program.
*&---------------------------------------------------------------------*
*& Report ZCREATE_SC_VP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zcreate_sc_vp.
DATA: ls_header TYPE bapi_sc_header_c,
ls_item TYPE bapi_sc_item_c,
lt_item TYPE TABLE OF bapi_sc_item_c,
ls_acc TYPE bapi_acc_c,
lt_acc TYPE TABLE OF bapi_acc_c,
ls_bup TYPE bapi_bup_c,
lt_bup TYPE TABLE OF bapi_bup_c,
ls_limit TYPE bapi_limit_c,
lt_limit TYPE TABLE OF bapi_limit_c,
ls_org TYPE bapi_org_c,
lt_org TYPE TABLE OF bapi_org_c,
ls_text TYPE bapi_text_i,
lt_text TYPE TABLE OF bapi_text_i,
lt_return TYPE TABLE OF bapiret2.
* Prepare header data
ls_header-businessprocess = 'BUS2121'.
ls_header-currency = 'USD'.
ls_header-description = 'Shopping cart - VP 30Jan'.
ls_header-doc_date = sy-datum.
ls_header-process_type = 'SHC'.
* Prepare item data
ls_item-item_guid = '00000000000000000000000000000002'.
ls_item-item_number = '0000000001'.
ls_item-parent = '00000000000000000000000000000001'.
ls_item-description = 'MONITOR'.
ls_item-partner_prod = 'CAM102'.
ls_item-category_id = '42310000'.
ls_item-quantity = 1.
ls_item-currency = 'USD'.
ls_item-deliv_date = sy-datum.
ls_item-unit = 'EA'.
ls_item-unit_iso = 'EA'.
ls_item-co_code = '1004'.
ls_item-gross_price = 1.
ls_item-price_unit = 1.
INSERT ls_item INTO TABLE lt_item.
* Prepare account data
ls_acc-parent_guid = '00000000000000000000000000000001'.
ls_acc-distr_perc = 100.
ls_acc-acc_no = '0001'.
ls_acc-g_l_acct = '61100600'.
ls_acc-acc_cat = 'OR'.
ls_acc-acc_str = '10016300'.
INSERT ls_acc INTO TABLE lt_acc.
* Create Shopping Cart
CALL FUNCTION 'BAPI_SCEC_CREATE'
EXPORTING
i_header = ls_header
* I_HEADER_CUST =
* I_TESTRUN =
* IMPORTING
* E_HEADER =
* E_HEADER_CUST =
TABLES
i_items = lt_item
* I_ITEMS_CUST =
i_acc = lt_acc
* I_ACC_CUST =
* I_BUP =
* I_LIMIT =
* I_ORG =
* I_TEXTS =
* I_ATTACH =
* I_ADDON_FIELDS =
* E_ITEM =
* E_ITEMS_CUST =
* E_ACCOUNT =
* E_ACCOUNT_CUST =
* E_PARTNER =
* E_TEXT =
* E_LIMIT =
* E_ORGDATA =
* E_STATUS =
* E_ATTACH =
return = lt_return .
* Save shopping cart
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
Regards.
Nishant Bansal
ā2013 Dec 14 12:48 PM
HI,
It works fine for me for normal item. But can u test this with limit item. Populating I_LIMIT table.
ā2013 Dec 14 1:17 PM
Hi,
Also if I use your code mentioned in BBP_PD I can see the SC is in HELD status without having any item data or partner data.
ā2013 Dec 15 10:17 AM