cancel
Showing results for 
Search instead for 
Did you mean: 

Create default sales area data on BP creation using BUPA_GENERAL_UPDATE

Former Member
0 Kudos

Dear all!

We have the following requirement: whenever a user creates an organization in WCUI, we need to create some default data for the BP in the background, such as relationships (employee responsible, etc) and sales area data.

I have created an implementation for BADI BUPA_GENERAL_UPDATE and use it to add the desired data. For relationships, this is working just great, but I´m having trouble with the adding of sales area data, since the system is not properly saving the data. I use the following code:


* Assign data for sales area
  MOVE: 'O 50000632' TO ls_sales_area-sales_organization,
        '01'   TO ls_sales_area-distribution_channel,
        '01'   TO ls_sales_area-division.

  ls_data-customer_group1 = '330'.
  ls_data-customer_group2 = '003'.
  ls_data-customer_group3 = '002'.
  ls_data-customer_group4 = '006'.
  ls_data-customer_group5 = '021'.
  ls_data-pay_guar_proc   = '0001'.

  CALL FUNCTION 'CRM_BUPA_FRG0010_ADD'
    EXPORTING
      iv_partner_guid = ls_changed_instances
      is_sales_area   = ls_sales_area
      is_data         = ls_data
      iv_x_save       = ' '
    IMPORTING
      et_return       = lt_return
      ev_error        = lv_error.

  CALL FUNCTION 'CRM_BUPA_FRG0010_SAVE_COMMIT'.

Problem is, that with the call of


  CALL FUNCTION 'CRM_BUPA_FRG0010_SAVE_COMMIT'.

I get a short dump of type "SYSTEM_ON_COMMIT_INTERRUPTED", but without the call, the sales area data is not saved. I tried the same code in a Z-report (not in a BADI) and it worked just fine.

Any ideas on how to commit the data so the sales areas will be saved? Helpful answers will be rewarded!!

Thank you all & Kind regards

Christoph

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

As per my understanding, this error is coming as system is in mid of creating/updating BP using standard transaction.

You have added your piece of code within that process only hence when the u try to commit onsales area system is half done with updation using an explicit custom commit, it will result in data inconsistencey.In short this custom commit interrupts between the system commit standard process after data updation.

Hence you need not put an extra explict commit in between system updation.You can add the data and it will automatically get committed when system commits on transaction BP ( or Web Screen changes ).

It works fine for your Z code as it is not being called as part of system updation anc commit.

Hope it helps you.

Regards,

Pratyasha Shishodia

Edited by: Pratyasha Shishodia on Sep 19, 2008 2:38 PM

Edited by: Pratyasha Shishodia on Sep 19, 2008 2:39 PM

Former Member
0 Kudos

Hi Pratyasha!

Thanks for your reply. I figured, that by explicitly calling the commit FM, system commit procedures are interrupted.

The thing is, that just by calling the FM for adding the sales areas does not result in those sales areas acutally created. What I mean is, that after the BAdI is executed, no sales areas are maintained for the newly created customer. All the more funny, since this exact same procedure is working for creating relationships. See following code:


  READ TABLE it_changed_instances INTO ls_changed_instances INDEX 1.

* Get BP-Number for sy-user
  CALL FUNCTION 'CRM_ISA_IUSER_GET_BP_TO_ALIAS'
    EXPORTING
      username         = sy-uname
    IMPORTING
      business_partner = lv_user_partner.

* Map GUID to partner number
  CALL FUNCTION 'BUPA_NUMBERS_GET'
    EXPORTING
      iv_partner_guid = ls_changed_instances
    IMPORTING
      ev_partner      = lv_partner
    TABLES
      et_return       = lt_return.

  CLEAR lt_return.

* Create employee responsible
  CALL FUNCTION 'BUPR_RELATIONSHIP_CREATE'
    EXPORTING
      iv_partner_1_guid = ls_changed_instances
      iv_partner_2      = lv_user_partner
      iv_relationship   = 'BUR011'
      iv_date_from      = sy-datlo
      iv_date_to        = '99991231'
      iv_testrun        = ' '
      iv_x_save         = ' '
      iv_xdfrel         = 'X'
    TABLES
      et_return         = lt_return.

which is in the same BAdI and acutally results in this relationship beeing created for my newly created customer. Works fine, just not for sales areas.

I´ll be grateful for any comments on that issue!

Kind regards

Christoph

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,I feel the badi you are using is not the correct for updating default sales area.Hence it is not updating

the sales area.As sales area is not part of general data.You can use the badi to update the sales area?

Try with BUPA_FR*010_UPDATE.

Why dont u use mini templates for defaulting sales area?It wud avoid coding.

I hope it helps you.

Former Member
0 Kudos

Hi Pratyasha!

Thanks again for your reply. I think you´re right with BUPA_GENERAL_UPDATE beeing the wrong BAdI for my purposes. I´ll try and use mini-templates as you suggested and BAdI BADI_CRM_BP_UIU_DEFAULTS in ES CRM_UIU_BP_ENHANCEMENT for setting the mini-template upon creation.

Thanks for your help & Kind regards

Christoph

0 Kudos

Hi Christoph,

did you managed to set the mini-template upon BP creation?

If so, could you give me a short hint how you solved that issue? I am facing the same challenge.

Kind Regards,

Matthias