This website is not affiliated with, sponsored by, or approved by SAP AG.

Custom BP record changes. (Business Partner.)

CRM related discussion only

Moderators: Snowy, thx4allthefish, Lost Identity

Post Reply
CRM newbie

Custom BP record changes. (Business Partner.)

Post by CRM newbie » Wed Jun 30, 2004 10:12 am

Hi.

I need to change some z fields that have been inserted onto the BP record. BUT000-ZZXXXXX

Does anyone know what function I can use to do this?
I have looked at:
BAPI_BUSINESS_PARTNER_CHANGE
BAPI_BUPA_CENTRAL_CHANGE
BUPA_CENTRAL_CHANGE

but none of these have the custom fields available.
Please help. (I do not want to do a direct table update)

Thanks.

Jimmy_mac

Post by Jimmy_mac » Thu Jul 01, 2004 5:12 am

If your data is coming to CRM from R3 via a BDOC, you need to create a function module;

Code: Select all

FUNCTION Z_CRMIN_APPEND_FIELDS.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  EXPORTING
*"     VALUE(STATUS) TYPE  SMWVALSTAT
*"  CHANGING
*"     VALUE(C_BP_STRUCT) TYPE  BUS_EI_EXTERN
*"     VALUE(ERROR_SEGMENTS) TYPE  SMW_ERRTAB
*"----------------------------------------------------------------------

  data : w_partnerguid type but000-partner_guid,
         w_partner     type bu_partner,
         w_partnerext  type bu_bpext,
         st_bus000     type bus000___i,
         st_return     type bapiret2.

  field-symbols : <fs_bupa_addr> type bus_ei_bupa_address.

  Status = 'S'.

  w_partnerguid = c_bp_struct-header-object_instance-bpartnerguid.
  w_partnerext =
    c_bp_struct-central_data-common-data-bp_centraldata-partnerexternal.

   CALL FUNCTION 'BUPA_NUMBERS_GET'
     EXPORTING
       IV_PARTNER_GUID           = w_partnerguid
       IV_PARTNER_EXTERNAL       = w_partnerext
     IMPORTING
       EV_PARTNER                = w_partner.


   check : not w_partner is initial.

   CALL FUNCTION 'BUP_MEMORY_BUT000_GET'
     EXPORTING
       IV_PARTNER                = w_partner
     IMPORTING
       ES_BUT000                 = st_bus000
     EXCEPTIONS
       NOT_FOUND                 = 1
       PARAMETER_ERROR           = 2
       OTHERS                    = 3.

   IF SY-SUBRC <> 0.
     status = 'A'.
   Else.

move
c_bp_struct-central_data-common-data-bp_organization-zlast_order_date
         to st_bus000-zlast_order_date.

   CALL FUNCTION 'BUP_MEMORY_BUT000_FILL'
     EXPORTING
       IS_BUT000             = st_bus000
     EXCEPTIONS
       PARAMETER_ERROR       = 1
       OTHERS                = 2.

   IF SY-SUBRC <> 0.
     status = 'A'.
   ENDIF.
 endif.

 if status = 'A'.
   st_return-type = sy-msgty.
   st_return-id = sy-msgid.
   st_return-number = sy-msgno.
   st_return-message_v1 = sy-msgv1.
   st_return-message_v2 = sy-msgv2.
   st_return-message_v3 = sy-msgv3.
   st_return-message_v4 = sy-msgv4.
   message id sy-msgid type 'I' number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
              into st_return-message.

   CALL FUNCTION 'BUPA_MWX_BDOC_BUILD_ERR_MESS'
     EXPORTING
       IV_OBJ_ID      = c_bp_struct-header-object_instance-bpartnerguid
       IS_BAPIRET2    = st_return
     IMPORTING
       ET_ERR_MSG        = error_segments.

 endif.


ENDFUNCTION.


This reads the data from the BUT000 table, updates a Z field (in our case ZLAST_ORDER_DATE) and writes the data back to the BUT000 table.

You will also need to make an entry in table CRMC_BUT_CALL_FU key CRMIN BUPA.

Hope that helps

James

CRM newbie

Post by CRM newbie » Fri Jul 02, 2004 4:47 am

Hi James,

Thanks for your response.
The data is not comming from R3. I need to change already exhisting records within CRM.

Any Ideas?

Thanks.

Jimmy_Mac

Post by Jimmy_Mac » Fri Jul 02, 2004 5:30 am

Hi,

I would guess you would still need to use the Function Modules in the code example I provided because these update Z fields in BUT000.

I have no idea where you would need to add these. I would imagine there would be a BADI but I don't know which one.

Have you looked on HELP.SAP.COM for enhancing CRM

CRM newbie

Post by CRM newbie » Mon Jul 05, 2004 6:46 am

Thanks again for your help.

Wherever I try using BUP_MEMORY_BUT000_GET
it comes back with a SUBRC = 1. (Not found)

Grrrrrrrrrrrr.

Guest

Post by Guest » Mon Jul 19, 2004 9:10 am

You need to use function module BUPA_CENTRAL_CI_CHANGE
in conjunction with function module BAPI_TRANSACTION_COMMIT. Note that this will only work if you have used the EEWB to add your Z-fields.

Brad

erp_mac
Posts: 1
Joined: Fri May 12, 2006 8:29 pm

Post by erp_mac » Mon Aug 14, 2006 10:36 am

Jimmy_Mac wrote:Hi,

I would guess you would still need to use the Function Modules in the code example I provided because these update Z fields in BUT000.

I have no idea where you would need to add these. I would imagine there would be a BADI but I don't know which one.

Have you looked on HELP.SAP.COM for enhancing CRM

unclejohnsband
Posts: 1
Joined: Wed Jul 07, 2010 2:50 pm

Re: Custom BP record changes. (Business Partner.)

Post by unclejohnsband » Wed Jul 07, 2010 3:02 pm

Thanks to the person who suggested using the BUPA_CENTRAL_CI_CHANGE function module. It works!!!

Post Reply