cancel
Showing results for 
Search instead for 
Did you mean: 

Adjust existing documents with a new organizational structure

Former Member
0 Kudos

Hello,

here is the problem:

We created a new organizational structure with different org.unit IDs compared to the old organizational structure. Now we have a problem with existing documents, that were created under the old organizational structure. We cannot create a follow-up document to an existing document because the org.unit in a folow-up document is automatically the same as in the main document. And this org.unit is obsolete now under the new organizational structure.

Example:

- Main document was created on 1.12.2014 under the org.unit ID 50000178

- New organizational structure was introduced on 1.1.2015

- When creating a follow-up document on the main document, the org.unit ID is automatically 50000178, which got deactivated on 31.12.2014. SAP returns an error, that this unit does not exist

Tell me please, how can we solve this ? How can we adjust the existing documents with a new organizational structure ?

Thanks!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I met the same problem. I hade some study on it, but did not get standard solution.

And I made two solutions to resolve it as following:

1-Create a Z-program to adjust the open-status document from old org to new org.

2-Enhance the following-up BADI, and reproduce the org detemine for the problem documents.

We choosed the option 2.

Former Member
0 Kudos

Hi Zoran

Here is a code snippet for when I needed to update the Org Unit for a Business Activity.

" Organisation Tables

data: lt_orgman             type crmt_orgman_wrkt.

data: ls_orgman             type crmt_orgman_wrk.

data: lt_data               type crmxif_bustrans_t.

data: ls_data               like line of lt_data.

data: lt_return             type bapiretm.

data: ls_return             like line of lt_return.

" Prepare to Update the Campaign Activity.

  refresh lt_data.

  refresh lt_return.

" Prepare Organizational Unit Data

  lv_ordorgman-sales_org                    = 'O 50000998'.

  lv_ordorgman-sales_org_resp               = 'O 50000999'.

  lv_ordorgman-input_fields-sales_org       = 'X'.

  lv_ordorgman-input_fields-sales_org_resp  = 'X'.

" Prepare One Order Object Updates

  ls_data-orgdata-data = lv_ordorgman.

  CLEAR lv_ordorgman.

  ls_data-object_task                     = 'U'.

  ls_data-object_id                       = ls_order_adm-object_id.

  ls_data-object_guid                     = ls_order_adm-guid.

  ls_data-object_type                     = ls_order_adm-object_type.

  ls_data-process_type                    = ls_order_adm-process_type.

  ls_data-orgdata-datax                   = 'X'.

 

  ls_data-input_fields-object_id          = 'X'.

  ls_data-input_fields-object_guid        = 'X'.

  ls_data-input_fields-process_type       = 'X'.

  ls_data-input_fields-object_type        = 'X'.

  APPEND ls_data TO lt_data.

  CLEAR: ls_data.

" Finally call the FM

  if lt_data[] is not initial.  " B2

  CALL FUNCTION 'CRMXIF_ORDER_SAVE'

  EXPORTING

  data   = lt_data

  IMPORTING

  return = lt_return.

" Commit the Changes

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

"  Write the return message

  read table lt_return into ls_return

  with key object_key = ls_order_adm-guid.

  if sy-subrc eq 0.  " B3

  read table ls_return-object_msg  with key type = 'E' transporting no fields.

  if sy-subrc eq 0.  " B4

  " Error"

  else.              " X4

  " OK"

  endif.             " E4

  endif.  " E3

  endif.  " E2

Apologies for the formatting, some issues with my editor.

Hope this helps

Regards

Arden