Skip to Content
author's profile photo Former Member
Former Member

CRM: Creating a new Condition within Copy Control

Hi SAP Experts,

we are facing the following challenge within CRM copy control:


- Creating/adding a new manual Z* condition during the copy from service contract into pl service order.


- Create copy control BADI and implement the methode orderadm_i (see below)

System Behavior

- Copy control creates new z* condition but in error status and without conditon value

The following Badi code seems to be incorrect. Unfortunately we could not use CRM_OrderMaintain, because the Badi is called within CRM_OrderMaintain. So we implement FM 'CRM_PRIDOC_MAINTAIN_MUL_OW', to avoid recursive execution of CRM_OrderMaintain.

Perhaps you have face a similar problem and give me hint.

Thanks in advance for your help.



**Preparing add Condition from the preceeding Doc

LOOP AT lt_pridoc_s INTO ls_pridoc_s.

MOVE-CORRESPONDING ls_pridoc_s TO ls_pridoc_t.

**Read Condition from source

lt_p_cond = ls_pridoc_t-pric_cond.

LOOP AT lt_p_cond INTO ls_p_cond where KSCHL = 'ZCUS'.

MOVE-CORRESPONDING ls_p_cond TO ls_add_con.

  • ls_add_con-WAERS = currency

  • ls_add_con-KBETR = netto value

ls_add_con-KPEIN = 1.

ls_add_con-KMEIN = 'PU'.

APPEND ls_add_con TO lt_add_con .


ls_PRidoc_t-ref_kind = 'A'.

ls_pridoc_t-ref_guid = cs_orderadm_i-guid.

ls_pridoc_t-cond_add = lt_add_con.

ls_pridoc_t-ref_handle = cs_orderadm_i-handle.

REFRESH ls_pridoc_t-pric_cond.


ls_PRidoc_t-PRICING_TYPE = 'B'.

*A Copy price components and redetermine scales

*B Carry out new pricing

*C Copy manual pricing elements and redetermine the others

*D Copy pricing elements unchanged

*E Adopt price components and fix values

*F Copy pricing elements, turn value and fix

*G Copy pricing elements unchanged and redetermine taxes

APPEND ls_pridoc_t TO lt_pridoc_t.


**Target Item Guid

REFRESH Lt_guid_pr.

Ls_guid_pr-guid = cs_orderadm_i-guid.

Ls_guid_pr-ITEM_MAINTAIN = cs_orderadm_i-NUMBER_INT.

Ls_guid_pr-Handle = cs_orderadm_i-handle.

APPEND Ls_guid_pr TO Lt_guid_pr.



it_trusted_items = Lt_guid_pr

it_pridoc = lt_pridoc_t


error_occurred = 1


Edited by: Ole Sylvester on Apr 3, 2009 10:50 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 13, 2009 at 08:49 AM

    Hi, we met the same problem. we done it with event.

    First, we define a new event with Execute time 50(End of Document Processing) and Event Name AFTER_CREATE_WITH_REFERENCE.

    And the event major doing is copy and change the condition value, the code block is following:

      ls_cond_change-waers = 'USD'.
      ls_cond_change-stunr = '012'.
      ls_cond_change-zaehk = '001'.
      ls_cond_change-kbetr = '1351'.
      INSERT ls_cond_change INTO TABLE lt_cond_change.
      READ TABLE lt_orderadm_i INTO ls_orderadm_i INDEX 2.
      ls_new_pridoc-ref_guid    = ls_orderadm_i-guid.
      ls_new_pridoc-cond_change = lt_cond_change.
      INSERT ls_new_pridoc INTO TABLE lt_new_pridoc.
      ls_input_field-ref_guid   = ls_orderadm_i-guid.
      ls_input_field-ref_kind   = 'B'.
      ls_input_field-objectname = 'PRIDOC'.
      ls_field_names-fieldname  = 'KBETR'.
      INSERT ls_field_names INTO TABLE ls_input_field-field_names.
      INSERT ls_field_names INTO TABLE lt_field_names.
      INSERT ls_input_field INTO TABLE lt_input_field.
      ls_guid_handle-guid = ls_orderadm_i-guid.
      INSERT ls_guid_handle INTO TABLE lt_guid_handle.
          it_trusted_items       = lt_guid_handle
          it_pridoc              = lt_new_pridoc
          error_occurred         = 1
          OTHERS                 = 2

    Hope it's useful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 13, 2009 at 08:49 AM

    Sorry, it's post double.

    Edited by: deripmav on Nov 13, 2009 9:52 AM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.