on 09-16-2011 3:05 AM
Hello All,
I have a requirement to update a Z field on save which is being added by AET in table BUT000.
I don't want to do it in WEBUI, I have tried BADI 'PARTNER_UPDATE,its working fine from tcode BP But not from WEBUI .
I tried following FM's but none of them is reflecting any change to Zfield.
BUPA_CENTRAL_CI_CHANGE
BUP_MEMORY_BUT000_FILL
'BUP_BUPA_UPDATE'
BUPA_GENERAL_UPDATE
Pls help me out!
Thanks much.
Priya.
Hi Priya,
I am also paced with same problem, what was your solution ?
Regards
Chan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chan,
I would be happy to help you. please use the below code. In badi "BUPA_GENERAL_UPDATE" .
FIELD-SYMBOLS :<fs> TYPE ANY TABLE,
<fs2> TYPE bus000___i,
* business partners
CALL FUNCTION 'BUPA_GENERAL_CALLBACK'
TABLES
et_but000_old = lt_but000_old
et_but000_new = lt_but000_new
EXCEPTIONS
OTHERS = 0.
IF lt_but000_old IS NOT INITIAL.
READ TABLE lt_but000_old ASSIGNING <ls_but000_old> INDEX 1.
IF <ls_but000_old> IS ASSIGNED.
ls_partner_guid = <ls_but000_old>-partner_guid.
ls_partner = <ls_but000_old>-partner.
ENDIF.
ELSE.
READ TABLE lt_but000_new ASSIGNING <ls_but000_new> INDEX 1.
IF <ls_but000_new> IS ASSIGNED.
ls_partner_guid = <ls_but000_new>-partner_guid.
ls_partner = <ls_but000_new>-partner.
ENDIF.
ENDIF.
*.. GUI
IF sy-tcode = 'BP'.
*.. Get Country
CALL FUNCTION 'BUA_BUPA_MEMORY_ADDRESSES_GET'
EXPORTING
i_partner = ls_partner
TABLES
t_address = lt_address
EXCEPTIONS
partner_not_in_memory = 1
no_address_found = 2
date_invalid = 3
OTHERS = 4.
CHECK sy-subrc = 0.
READ TABLE lt_address INTO wa_address INDEX 1.
SELECT SINGLE target1 INTO ls_zone FROM zcountry_zon_map
WHERE sour1_from = wa_address-country.
CHECK sy-subrc = 0.
*.. GUI
IF sy-tcode = 'BP'.
ASSIGN ('(SAPLBUD0)MEM_BUT000[]') TO <fs>.
IF <fs> IS ASSIGNED.
LOOP AT <fs> ASSIGNING <fs2>.
IF <fs2> IS ASSIGNED.
IF <fs2>-partner_guid = ls_partner_guid.
<fs2>-zzafld000006 = ls_zone.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
UNASSIGN : <fs>, <fs2>.
*.. WEBUI
ELSEIF sy-tcode IS INITIAL.
IF lt_but020_old IS NOT INITIAL.
READ TABLE lt_but020_old ASSIGNING <ls_but020_old> INDEX 1.
IF <ls_but020_old> IS ASSIGNED.
lv_adrnumber = <ls_but020_old>-addrnumber.
ENDIF.
ELSE.
READ TABLE lt_but020_new ASSIGNING <ls_but020_new> INDEX 1.
IF <ls_but020_new> IS ASSIGNED.
lv_adrnumber = <ls_but020_new>-addrnumber.
ENDIF.
ENDIF.
*.. Country
CALL FUNCTION 'BUPA_ADDRESS_GET_DETAIL'
EXPORTING
iv_partner_guid = ls_partner_guid
* iv_addrnumber = lv_adrnumber
IMPORTING
es_address = ls_address.
CHECK sy-subrc = 0.
*..Zone
SELECT SINGLE target1 INTO ls_zone FROM zcountry_zon_map
WHERE sour1_from = ls_address-country.
CHECK sy-subrc = 0.
ASSIGN ('(SAPLBUD_MEM)gt_but000_mem[]') TO <fs>.
IF <fs> IS ASSIGNED.
LOOP AT <fs> ASSIGNING <fs2>.
IF <fs2> IS ASSIGNED.
IF <fs2>-partner_guid = ls_partner_guid.
<fs2>-zzafld000006 = ls_zone.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
UNASSIGN : <fs>, <fs2>.
ENDIF.
Let me know in case o any questions.
Thanks,
Priya
Hi Priya,
Many thanks for your prompt response. I would just like to check before I procedd further that the FM
CALL FUNCTION 'BUPA_GENERAL_CALLBACK'
TABLES
et_but000_old = lt_but000_old
et_but000_new = lt_but000_new
does return data in the lt_but000_old and lt_but000_new tables. I had used this FM in PARTNER_UPDATE and these tables are empty when I save a BP via the CRM WEBUI.
appreciate your feedback.
Regards
Chan
Hi Priya,
In th BADI BUPA_GENERAL UPDATE , there is an implementation
CMS_CM_BUPA_GENERAL Business Partner Central Block, I set a break point in the Method CHANGE_BEFORE_UPDATE and made a chnage to a BP. The breakpoint was triggered and when I checked the contents of the BUT000_xxx tables they were empty.
We are on CRM 2007, are you using this same version?
Please see code below in standard implementation.
method IF_EX_BUPA_GENERAL_UPDATE~CHANGE_BEFORE_UPDATE.
DATA: lt_but000_old TYPE TABLE OF but000,
lt_but000_new TYPE TABLE OF but000,
lt_but000_td_new TYPE TABLE OF but000_td,
lt_but000_td_old TYPE TABLE OF but000_td.
CALL FUNCTION 'BUPA_GENERAL_CALLBACK' <---- BREAKPOINT HERE
TABLES
et_but000_old = lt_but000_old <---- Empty
et_but000_new = lt_but000_new <------ Empty
* et_but000_td_new = lt_but000_td_new
* et_but000_td_old = lt_but000_td_old
.
IF lt_but000_new IS NOT INITIAL.
CALL FUNCTION 'CMS_CM_BUPA_CBLOCK_SAVE'
EXPORTING
it_but000_old = lt_but000_old
it_but000_new = lt_but000_new
.
ENDIF.
endmethod.
Regards
Chan
User | Count |
---|---|
8 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.