Skip to Content
0
Jul 19, 2022 at 06:17 PM

Update Billing Plan in Service Contract

359 Views Last edit Jul 22, 2022 at 03:38 PM 6 rev

Hi Experts,

I'm building a conversion program to create service contracts in S4. I have used the FM: 'BAPI_BUSPROCESSND_CREATEMULTI' which internally calls 'CRM_ORDER_MAINTAIN' FM.

I'm trying to update the BILLPLAN data with the date rule and dates, however it's not working and no errors were returned as well.

Please provide your inputs or reference sample code.

Sample code as below:

DATA: wa_dates_rule TYPE bapibus20001_billplan_date, 
      it_dates_rule TYPE STANDARD TABLE OF bapibus20001_billplan_date,
      wa_billplan   TYPE bapibus20001_billplan,
      it_billplan   TYPE STANDARD TABLE OF bapibus20001_billplan.

wa_dates_rule-handle = '0000000001'.
wa_dates_rule-rule_per_date_t = 'BILL0004'.   "Rule ID
wa_dates_rule-rule_bill_date_t = 'BILL0002'.
wa_dates_rule-rule_inv_date_t = 'BILL0003'.
wa_dates_rule-billplan_mode = 'A'.

wa_dates_rule-bill_date = '20220701050000'.   "Date and Timestamp
wa_dates_rule-invcr_date = '20220705050000'.
wa_dates_rule-settl_from = '20220705050000'.
wa_dates_rule-settl_to = '20221005045959'.
INSERT wa_dates_rule INTO TABLE it_dates_rule.

wa_billplan-handle = '0000000001'.
wa_billplan-ref_guid = lv_item_guid.  "Item Guid
wa_billplan-ref_kind = 'B'.
wa_billplan-billplan_type = '02'.    "Periodic Billing
wa_billplan-ref_to_header = 'N'.
INSERT wa_billplan INTO TABLE it_billplan.

CLEAR ls_sls_input_fields.
ls_sls_input_fields-ref_guid    = lv_item_guid.
ls_sls_input_fields-ref_kind    = 'B'.
ls_sls_input_fields-objectname  = 'BILLPLAN'.
ls_sls_input_fields-logical_key = '0000000001'.

ls_sls_input_fields-fieldname = 'BILLPLAN_MODE'.
INSERT ls_sls_input_fields INTO TABLE lt_sls_input_fields.
ls_sls_input_fields-fieldname = 'BILLPLAN_TYPE'.
INSERT ls_sls_input_fields INTO TABLE lt_sls_input_fields.
ls_sls_input_fields-fieldname = 'RULE_PER_DATE_T'.
INSERT ls_sls_input_fields INTO TABLE lt_sls_input_fields.
ls_sls_input_fields-fieldname = 'RULE_BILL_DATE_T'.
INSERT ls_sls_input_fields INTO TABLE lt_sls_input_fields.
ls_sls_input_fields-fieldname = 'RULE_INV_DATE_T'.
INSERT ls_sls_input_fields INTO TABLE lt_sls_input_fields.
ls_sls_input_fields-fieldname = 'BILL_DATE'.
INSERT ls_sls_input_fields INTO TABLE lt_sls_input_fields.
ls_sls_input_fields-fieldname = 'INVCR_DATE'.
INSERT ls_sls_input_fields INTO TABLE lt_sls_input_fields.
ls_sls_input_fields-fieldname = 'SETTL_FROM'.
INSERT ls_sls_input_fields INTO TABLE lt_sls_input_fields.
ls_sls_input_fields-fieldname = 'SETTL_TO'.
INSERT ls_sls_input_fields INTO TABLE lt_sls_input_fields.

*-Service Contract Creation
CALL FUNCTION 'BAPI_BUSPROCESSND_CREATEMULTI'
  TABLES
    header           = lt_header_ins
    item             = lt_item
    sales            = lt_sales
    partner          = lt_partner
    organisation     = lt_orgman
    appointment      = lt_appointm
    input_fields     = lt_sls_input_fields
    created_process  = lt_created_process
    return           = lt_return
    scheduleline     = lt_sched
    condition_create = lt_condition
    billplan         = it_billplan
    billplan_date    = it_dates_rule.<br>