Changing the Partner in Opportunity by Funciton module

Hi,
I am trying to change the employee responsible partner of an opportunity.
I was unable to find the correct code.    I tried using the below code but i am unable to do.
Please help me in this regard.   I have tried with FM 'BAPI_OPPORTUNITY_CHANGEMULTI'   But I am unable to understand how to pass the partner values to it.
L_Guid = it_CRMD_ORDERADM_H-guid.      ."'4582EEBA723000A500000000837FBA1A'.
  INSERT L_Guid INTO TABLE Lt_Header.
*move  '43A15126B7A2006502000000837FBA1A' to Lt_Header.
  CALL FUNCTION 'CRM_ORDER_READ'
    EXPORTING
      IT_HEADER_GUID       = Lt_Header
    IMPORTING
      ET_PARTNER           = Lt_GetPartner
    EXCEPTIONS
      DOCUMENT_NOT_FOUND   = 1
      ERROR_OCCURRED       = 2
      DOCUMENT_LOCKED      = 3
      NO_CHANGE_AUTHORITY  = 4
      NO_DISPLAY_AUTHORITY = 5
      NO_CHANGE_ALLOWED    = 6
      OTHERS               = 7.
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
READ TABLE Lt_GetPartner INTO wa_GetPartner WITH KEY PARTNER_FCT = '00000014'.
if sy-subrc = 0.
data v_index like sy-tabix.
v_index = sy-tabix.
w_uname = 'salesrep1.
ls_partner_com-partner_no = w_uname.
    INSERT ls_partner_com INTO TABLE it_partner.
ls_input_field_names-fieldname = 'PARTNER_NO'.
    INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.
    INSERT ls_input_field  INTO TABLE  lt_input_fields.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
   IT_PARTNER                    = it_partner.
CHANGING
  CT_ORDERADM_H                  = CT_ORDERADM_H
  CT_INPUT_FIELDS                = lt_input_fields
EXCEPTIONS
   ERROR_OCCURRED                = 1
   DOCUMENT_LOCKED               = 2
   NO_CHANGE_ALLOWED             = 3
   NO_AUTHORITY                  = 4
   OTHERS                        = 5
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
append  L_Guid to lt_guids.
CALL FUNCTION 'CRM_ORDER_SAVE'
  EXPORTING
    IT_OBJECTS_TO_SAVE         = lt_guids
EXCEPTIONS
   DOCUMENT_NOT_SAVED         = 1
   OTHERS                     = 2

Hi,
Two problems that I found in the mentioned code are:
<b>1. ls_input_field_names-fieldname = 'PARTNER_NO'.
INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.</b>
In between these two lines you should also add the following line:
<b>ls_input_field_names-changeable = space.</b>
<b>2. w_uname = 'salesrep1.</b>
I am not sure if you can pass the user name directly instead of the BP number. There are some standard function modules for getting the BP number from user name. You can use that and then assign the BP number.
Hope this helps!
Jash

Similar Messages

  • How to change the Partner function code in Quotation

    Hi All,
    We have a requirement that whenever a Quote is cancelled,
    We need to change one of the function codes in the partner tab and also the user status should be changed.
    Can anyone give a quick solution on this?
    Your response will be appreciated.
    Thanks in advance.
    Regards,
    Ramya

    You will best implement this as an action (tx. SPPFCADM), which is called on changing the status to cancelled. In this action you can call a function module changing the partner functions using e.g. CRM_ORDER_MAINTAIN as the appropriate function module.
    Regards, Kai

  • BAPI_PO_CHANGE is not changing the PARTNER NO.

    Hello experts,
    I wanted to change the partner no. using  BAPI_PO_CHANGE, in SE37, but its not working. It saying, 'Error transferring ExtensionIn data for enhancement CI_EKPODB'. Can you please help me?
    Regards,
    David.

    Hi
    I've tried this code in my system:
    DATA: return    TYPE TABLE OF bapiret2 WITH HEADER LINE.
    DATA: popartner TYPE TABLE OF bapiekkop WITH HEADER LINE.
    DATA: error     TYPE flag.
    popartner-partnerdesc = 'GS'.
    popartner-langu       = sy-langu.
    popartner-buspartno   = '0070005647'.
    APPEND popartner.
    CALL FUNCTION 'BAPI_PO_CHANGE'
      EXPORTING
        purchaseorder = '8500000393'
      TABLES
        return        = return
        popartner     = popartner.
    LOOP AT return.
      WRITE / return-message.
    * Check error
      IF return-type = 'E' OR return-type = 'A'.
        error = 'X'.
      ENDIF.
    ENDLOOP.
    CHECK error IS INITIAL.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    It works fine
    Max

  • Need log of the users who changed the partner profiles.

    Hi,
    Some user has been changed partner profiles of the CUA configuration Setup.
    It is displaying only Agent Name. They delete the Inbound and outbound parameters of the partner profiles created by CUA. So, I need to trace out the user who changed these parameters.
    It will be appreciate if anybody can help in this issue.
    Thanks,
    Shiva.

    I resolved this issue by deleting the partner profiles created by CUA in all child clients. And delete the Distribution model in all child clients and re-distribute the distribution model from Master client.
    Now its working fine.
    But I am not able to trace out the user who changed partner profiles. I checked in ST03N but i didnt get the information abt the we20. ( I am using ECC 6.0 version).
    And in WE20 it is not showing any User ID who changed the partner profiles. I checked in following tables but I didnt find any changed details of partner profiles.
    EDIPHO
    EDMSG
    EDP12
    EDP13
    EDP21
    EDPP1
    T002T
    T005T
    Regards,
    shiva.

  • Function module to change the partner of partner function of an order

    Hi All,
          I want to change a partner of a particular partner function related to an order if a condition is satisfied. That is if a condition is satisfied then the earlier partner assigned to the partner function should be changed and new partner should be assigned to the partner function of the order. Is there any fucntion module to do this. I got the function module 'CRM_PARTNER_MAINTAIN_SINGLE_OW' but it adds one more partner of the same patner function but what i want is to add the new partner in place of the earlier partner. If anyone has some pointers plz post.
    Thanks in advance,
    Rahul.

    Hi,
    Did you try using functions like 'SD_PARTNER_UPDATE' ?
    Thanks
    Mark points if helpful.

  • How to change the Partner in Service Order

    Dear Experts,
      I am working in SAP CRM 5.0.I want to change the Partners of Service Order Using the Function Module 'BAPI_ACTIVITYCRM_CHANGEMULTI'.Can anyone give me the Sample code for Changing the Partners.It is very Urgent Requirement.Please help me.
    Thanks & Regards,
    Ashok.

    Hi,
        Following is the code for changing partner: Please go through it:
    "fill the details of partner which is
              "to be added as main partner or in place of Interaction Agent
              wa_partner_new-ref_guid = w_guid_ref.
              wa_partner_new-ref_handle = '0000000000'.
              wa_partner_new-ref_kind = 'A'.
              wa_partner_new-kind_of_entry = wa_partner-kind_of_entry.
              wa_partner_new-ref_partner_handle = '0000'.
              wa_partner_new-ref_partner_fct = 'Z_IA'. "
              wa_partner_new-ref_partner_no = wa_partner-partner_no.
              wa_partner_new-ref_no_type = wa_partner-ref_no_type.
              wa_partner_new-ref_display_type = wa_partner-ref_display_type.
              wa_partner_new-display_type = 'BP'.
              wa_partner_new-no_type = 'BP'.
              wa_partner_new-partner_fct = 'Z_IA'.
              wa_partner_new-partner_no = w_partner_no.
              wa_partner_new-mainpartner = 'X'.
              INSERT wa_partner_new INTO TABLE it_partner_new.
              wa_partner_newx-display_type = 'X'.
              wa_partner_newx-no_type = 'X'.
              wa_partner_newx-partner_fct = 'X'.
              wa_partner_newx-partner_no = 'X'.
              wa_partner_newx-mainpartner = 'X'.
              INSERT wa_partner_newx INTO TABLE it_partner_newx.
               IF it_partner_new[] IS NOT INITIAL AND it_partner_newx[] IS NOT INITIAL.
        "maintain all changes to be done
        CALL FUNCTION 'BAPI_ACTIVITYCRM_CHANGEMULTI'
          TABLES
            partner  = it_partner_new
            partnerx = it_partner_newx.
        CLEAR : wa_guid1.
        REFRESH : it_guid1.
        wa_guid1-guid = w_guid_ref.
        APPEND wa_guid1 TO it_guid1.
        "save the changes
        CALL FUNCTION 'BAPI_ACTIVITYCRM_SAVE'
          TABLES
            objects_to_save = it_guid1.
        "commit the transaction
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ENDIF.
    Please reply if anything else os required.
    Please reward points if useful.
    Regards,
    Ashlesha

  • Can we change the partner number based on the reason in CIC0 in CRM ?

    Dear Experts,
            Can we change the responsible partner number based on the reason in CIC0 in CRM ?
    regards,
    Abhijit G. Borkar
    Edited by: Abhijit Borkar on Jul 10, 2009 6:46 AM
    Can it be done by using 'Actions' ?

    Hi Abhijit,
    Yes you can do this a number of ways:
    action
    badi - partner or order
    event - custom function module
    Remember that the partner determination must allow for this partner to be changed.
    Cheers
    Andrew

  • How can I change the link color css in one module but not the whole site?

    I have a site built in muse but using modules from BC.  I changed the link color in the css for the online store and blog but of course it is applying it to everypage.  Is there a way to change the link color in an individual BC module instead of the whole site.?  I'm new to CSS obviously.
    Thanks
    Josh

    I don't think you can do it right in Muse but you can easily if you have access to the code of the page and the css file.
    You need to create a css class something like:
    .secondLink a      {     /*  secondLink can be any class name, I just chose that randomly
         color: #990000;     /* of course substitute your color code in there
    Then in your code add:
    class="secondLink"
    to your link's <a> tag. This will give any links with the class of secondLink the color assigned. Hope that helps get you started.

  • Changing the partner role

    Hello guys! How are ya'?
    I need to change an actual Business Partner Role in my CRM 2007.
    I tried to execute a FM called BAPI_BUPA_ROLE_CHANGE but, it doesn't running.
    Anybody here know how can I to do this?
    Thanks in advance.
    Regards.
    Danilo Cardoso

    Hi Danilo,
    I'm doing good! Hope life's looking great at your end too !
    I think the problem here might be that your role is not assigned a role category. For a role to get saved to database table BUT100, it is mandatory to assing the role to a role category since the code only works on role category.
    To assign a role category, go to view V_TB003, select and double click the role. On this new screen, maintain the role category--> role assignment.
    In case you are using a Z role, you have 2 options -
    a)use an existingrole category
    b) create a new Z role category and assign this new category to the Z role.
    To create role categories, you can go to view V_TB003A.
    Hope this helps.
    Cheers,
    Rishu.

  • User exit to change the partner function in VA02

    Hi experts,
    I have a requirement to increment Volume field value everytime when the end customer ( partner function) is modified  at header and item level.
    Can you suggest some exits ?
    PLease suggest

    Hi
    Try with the following exits.
    EXIT_SAPLV46H_002
    EXIT_SAPLV46H_001
    Thank you,
    Sekhar.

  • Bapi's or function modules to create, change( delete) partner functions

    Hi,
       Can anyone suggest BAPI or Function Modules for creating , changing the Partner Functions of the customer
    eg: To create customer XYZ as  bill-to-party of customer ZYX , i need  either a BAPI or Function Module.
    Thanks in Advance,
    Sabu

    Hi The following are the BAPI's to create and change the Partner Function.
    BAPI_BUS2001_PARTNER_CHANGE_M
    BAPI_BUS2001_PARTNER_CREATE_M
    Regards
    Vijay

  • Change Partner in Opportunity

    Hi all,
                 Does anyone have a clear idea about how to change a partner, for a particular partner function, in CRM 4.0 opportunity. I tried using BAPI_OPPORTUNITY_CHANGEMULTI but it returns "Document cannot be saved" . I also tried using CRM_ORDER_MAINTAIN but here I am not getting any exceptions but I am unable to modify the transaction.
    Any help is appreciated.

    Hello,
    When using CRM_ORDER_MAINTAIN and you want to change a partner (only valid for change!) you also need to tell the system the old/previous partner, else the system won't change the partner.
    E.g. In partner function 'sold-to party' (partner_fct 000001) you want to change the BP from 254 to 299.
    The ET_PARTNER table should have following entry
    ls_partner-ref_partner_fct = '000001'
    ls_partner-ref_partner_no = '254'    "OLD BP
    ls_partner-ref_no_type = 'BP'        "BP = number / US = username (mostly used for person responsible)
    ls_partner-ref_display_type = 'BP'
    ls_partner-partner_fct = '000001'
    ls_partner-partner_no = '299'        "NEW BP
    ls_partner-no_type = 'BP'       
    ls_partner-display_type = 'BP'
    And of course create the corresponding entries in the CT_INPUT_FIELDS for each field that you fill.
    The way of working is similar for the BAPI_OPPORTUNITY_CHANGEMULTI.
    Golden tip: Do exactly the same action (in you case, change a partner) as you want to code in TAC CRMD_ORDER, just before pressing <ENTER> or save, place a breakpoint in FM CRM_ORDER_MAINTAIN, then you'll see how SAP fills these tables, if you code it in exactly the same way you're 100% sure it will work!
    Reward points if useful,
    Regards,
    Joost

  • Change the backend doc type from PR to PO in BADI BBP_TARGET_OBJECTS.

    Hi,
    We have followed below approach for backend document type determination.
    1. A custom function module contains the logic to determine the backend document type of a Shopping cart line item. THis function module, performs many checks and hence cannot be called in any BADI that is executed in Foreground.
    2. I am using BADI BBP_TARGET_OBJECTS to change the follow document type by calling the custom function module.
    Issue here is, if the backend document type of a line item is Purchase requisition (2) by SAP standard, and if I try to change it to Purchase order, it gives run time error and ends up in creation of Purchase order.
    After further investigation I found that this line item (with default backend doc type as 2) has a desired vendor. If we change the desired vendor of this line item to fixed(To Partner function 19 from partner function 39), it allows us to change the doc type from Purchase requisition to purcahse order in BADI BBP_TARGET_OBJECTS.
    But changing the partner function is possible only in BBP_DOC_CHANGE BADI, and I cannot call the custom function module there, as it may impact the performance.
    Is there any other way, I can change the partner function in any of the BADIs called in background?
    Or Is there any way by which I can change the backend document type from PR to PO in BBP_TARGET_OBJECTS?

    Hi Parab
    if you swaping 39 to 19 viadoc change badi
    REQUESTER has a control on Purchase ORDER Vendor and BUYER lost a control so your business has to decide.In this case procurement department lost their control.
    Fixed vendors are like inforecord and contract negotiated for best price ..
    Muthu

  • BADI triggered in the partner & competetor tab of oppetunity & quote.

    Hi,
    Please let me know
    1. which BADI will be triggerd when we choose partner function in the parner/competer tab of quotation and opertunity.
    2. BADI triggered in the same tabs when we press enter in the partner field.
    I am using CRM_ORDERADM_H_BADI for Usage check in quotation. But it is not triggered when we change the partner function/ partner in the partner tab of quotation.
    I am using CRM_OPPORT_H_BADI for Usage check in oppertunity but it is not triggered when we change the partner function/ partner in the partner/competitor tab of opertunity.
    Please give input what BADIs need to be used.
    Thanks and in advance.
    Regds
    Harish
    Thanks and Regards
    Harish

    Hi Harish,
       Look at CRMV_EVENT transaction and assign the function module with your code in the event of partners.
    Regards.
    Manuel

  • Change of partner analyse in sales orders

    Hello,
    I changed the partner analyse for sales orders and added a new mandatory partnerrole.
    In new documents the partner analyse works fine, but in the existed sales documents I cant´t see, that a mandotory role is missing.
    How can I see that this role is missing in the exsting documents???
    Thanks for info
    Nicole

    You can create a custom report but there is no standard way to do this.
    When a document is created in SAP, it is a "snapshot" of that configuration, master data, and information as it exists when the document is created.  On the SD side there are a few things you can influence, for example, SAP contains some standard tools for mass updating of pricing information.  Most of the document exists in its unchanged state though. 
    You *may* be able to use VA05 and do this (although I doubt it, no system in front of me right now).  Other than that transaction or a custom report there really aren't a lot of options.
    If you are familiar enough with the tables, you can do a "quick view" or an ABAP Query to get the info.  However the SAP partner table is recursive so to avoid getting lots and lots of duplicates you will either have to add some code to a full query, or do offline manipulation of the data.
    If you're looking for soild SAP experience to help through some of these hurdles, please contact me.
    Bill Wood - President
    R3Now Consulting
    http://www.r3now.com SAP thought leadership!
    Platinum SAP Solutions
    (704) 905 - 5175
    http://www.linkedin.com/in/billwood

Maybe you are looking for

  • How do i get rid of the icloud backup message on my ipad?

    How do I get rid of the icloud message on my ipad?

  • External hdd and wifi problem

    I ve got a macbook pro 13' with retina (256 ssd and 8gb ram ) and when i connect an external hdd ( through usb ) wifi lost signal ( all the time ) When i disconnect it everything is fine !  The external hdd is usb 3 !! Is that a known problem ?

  • Condition types for service tax

    Hi, We are configuring the system for TAXINN. Which condition types to be usd for service tax, ECess on service tax and HECess on service tax? are their any standard condition types for it or we need to create those? Regards,

  • Suggestions on Managing mixed (NT - Unix) environments

    We are in process of implementing 11.5.5 Our Applications instances are on Unix however, we are looking for advice on what is the most effective manner of testing/moving customized forms and reports between the NT GUI environment where they are modif

  • Will upgrading to Office 2007 SP2 cause any problems with syncing?

    I've got to figure this question has been addressed somewhere, but searching for "2007 sp2" found no topics... So Microsoft's got Office 2007 SP2 available for download now. One of the highlighted changes is speedier Outlook performance which I'm anx