Skip to Content
0
Dec 14, 2013 at 06:29 AM

SC creation using FM

41 Views

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_new_kind = gc_object_kind-orderadm_h

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