cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Update Billing Plan in Service Contract

0 Likes
1,535

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>

Accepted Solutions (0)

Answers (1)

Answers (1)

Silvia_Ventura
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello Srinivasan,

I don't have any reference ...I've found a question from another customer about the same problem.

https://answers.sap.com/questions/5544134/how-to-map-billing-plan-data-in-bapibusprocessndcr.html

Check the answer where someone suggested the option "You should try use CRM_ORDER_MAINTAIN for PAYPLAN and PAYPLAN DATE instead of BAPI_BUSPROCESSND_CREATEMULTI. After calling BAPI_BUSPROCESSND_CREATEMULTI"

best regards,

Silvia