Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Add database field to the change pointers list...

Former Member
0 Likes
956

Hi Experts,

I implemented an Outbound Scenario of triggering the DEBMAS IDoc for Customer Master. But now there is a special requirement indeed.

Whenever an user changes / updates E-Mail field (SMTP_ADDR) in Customer Master then it has to trigger an IDoc. Currently i do an explicit mapping inside the function module EXIT_SAPLVV01_001 (Customer Exit) for E-Mail to point to URL field of IDoc.

But the challenge is now there is no E-Mail field in IDoc as well as in the list of change pointers. So, how to trigger a DEBMAS Idoc based on E-Mail field change in the customer master..?

Any suggesstions / advice would be of great help.

Thanks in advance.

Hi Experts,

I implemented an Outbound Scenario of triggering the DEBMAS IDoc for Customer Master. But now there is a special requirement indeed.

Whenever an user changes / updates E-Mail field (SMTP_ADDR) in Customer Master then it has to trigger an IDoc. Currently i do an explicit mapping inside the function module EXIT_SAPLVV01_001 (Customer Exit) for E-Mail to point to URL field of IDoc.

But the challenge is now there is no E-Mail field in IDoc as well as in the list of change pointers. So, how to trigger a DEBMAS Idoc based on E-Mail field change in the customer master..?

Any suggesstions / advice would be of great help.

Thanks in advance.

3 REPLIES 3
Read only

Former Member
0 Likes
680

Karsar,

When you change Email in a customer master neither a change pointer not a change document is created. You have to use BTE's (Business Transaction Events) for creating change documents for this purpose and create debmas idocs by reading those change documents.

Here are the config steps required.


In t-code FIBF:
Set up a 'product of a customer' 
Set up a 'P/S module of a customer' for Business Transcation Events 00504004, 00504005 and 00504006 to call function Z_BTE_KUNHIER_CHANGES. 


Create function Z_BTE_KUNHIER_CHANGES (example below)


Create report that selects records from CDHDR where OBJECTLAS = 'KUNHIER' within your date parameters and calls function 'CHANGEDOCUMENT_READ' for each row selected from CDHDR. This will give you the change documents, so you can continue the logic to do whatever else you need.

FUNCTION z_bte_kunhier_changes.
*"----------------------------------------------------------------------
""Local interface:
*" IMPORTING
*" VALUE(FVI_EVENT) TYPE BUS_EVENT DEFAULT '00504005'
*" TABLES
*" FTR_NODE_LIST STRUCTURE BAPIKNA1_KNVH OPTIONAL
*" FTR_NODE_LISTX STRUCTURE BAPIKNA1_KNVHX OPTIONAL
*"----------------------------------------------------------------------
*

Called by BTE's: 
00504004 - Create Customer Hierarchy 
00504005 - Change Customer Hierarchy 
00504006 - Delete Customer Hierarchy 
----------------------------------------------------------------------

DATA:
lv_objectid TYPE cdobjectv.

STATICS:
lt_xknvh TYPE STANDARD TABLE OF vknvh,
ls_xknvh TYPE vknvh,
lt_yknvh TYPE STANDARD TABLE OF vknvh,
ls_yknvh TYPE vknvh.

CLEAR: lt_xknvh[],
lt_yknvh[].


process BTE for add or change of a customer hierarchy 
IF fvi_event = '00504004' OR fvi_event = '00504005'.
LOOP AT ftr_node_list.

CLEAR: ls_xknvh, ls_yknvh.
REFRESH: lt_xknvh, lt_yknvh.

MOVE sy-mandt TO ls_xknvh-mandt.
MOVE ftr_node_list-customer TO ls_xknvh-kunnr.
MOVE ftr_node_list-sales_org TO ls_xknvh-vkorg.
MOVE ftr_node_list-distr_chan TO ls_xknvh-vtweg.
MOVE ftr_node_list-division TO ls_xknvh-spart.
MOVE ftr_node_list-valid_from TO ls_xknvh-datab.
MOVE ftr_node_list-custhityp TO ls_xknvh-hityp.
MOVE ftr_node_list-parent_customer TO ls_xknvh-hkunnr.
MOVE ftr_node_list-parent_sales_org TO ls_xknvh-hvkorg.
MOVE ftr_node_list-parent_distr_chan TO ls_xknvh-hvtweg.
MOVE ftr_node_list-parent_division TO ls_xknvh-hspart.
MOVE ftr_node_list-valid_to TO ls_xknvh-datbi.
MOVE ftr_node_list-routine TO ls_xknvh-grpno.
MOVE ftr_node_list-rebate_rel TO ls_xknvh-bokre.
MOVE ftr_node_list-pric_rel TO ls_xknvh-prfre.
MOVE ftr_node_list-assign_hi TO ls_xknvh-hzuor.
CASE fvi_event.
WHEN '00504004'.
MOVE 'I' TO ls_xknvh-kz.
WHEN '00504005'.
MOVE 'U' TO ls_xknvh-kz.
ENDCASE.
APPEND ls_xknvh TO lt_xknvh.

lv_objectid = ftr_node_list-customer.


the ftr_node_listx table indicates which fields 
were updated, with a series of indicators 
READ TABLE ftr_node_listx
WITH KEY
customer = ftr_node_list-customer
sales_org = ftr_node_list-sales_org
distr_chan = ftr_node_list-distr_chan
division = ftr_node_list-division
valid_from = ftr_node_list-valid_from
custhityp = ftr_node_list-custhityp.
IF sy-subrc = 0.
MOVE-CORRESPONDING ls_xknvh TO ls_yknvh.
IF ftr_node_listx-valid_to = 'X'.
MOVE space TO ls_yknvh-datbi.
ENDIF.
IF ftr_node_listx-parent_customer = 'X'.
MOVE space TO ls_yknvh-hkunnr.
ENDIF.
IF ftr_node_listx-parent_sales_org = 'X'.
MOVE space TO ls_yknvh-hvkorg.
ENDIF.
IF ftr_node_listx-parent_distr_chan = 'X'.
MOVE space TO ls_yknvh-hvtweg.
ENDIF.
IF ftr_node_listx-parent_division = 'X'.
MOVE space TO ls_yknvh-hspart.
ENDIF.
IF ftr_node_listx-routine = 'X'.
MOVE space TO ls_yknvh-grpno.
ENDIF.
IF ftr_node_listx-rebate_rel = 'X'.
MOVE space TO ls_yknvh-bokre.
ENDIF.
IF ftr_node_listx-pric_rel = 'X'.
MOVE space TO ls_yknvh-prfre.
ENDIF.
IF ftr_node_listx-assign_hi = 'X'.
MOVE space TO ls_yknvh-hzuor.
ENDIF.
APPEND ls_yknvh TO lt_yknvh.
ENDIF.

CALL FUNCTION 'KUNHIER_WRITE_DOCUMENT' IN UPDATE TASK
EXPORTING
objectid = lv_objectid
tcode = sy-tcode
utime = sy-uzeit
udate = sy-datum
username = sy-uname
planned_change_number = space
objeci_change_indicator = 'U'
planned_or_real_changes = space

upd_knvh = upd_knvh 
upd_knvh = 'U'

upd_icdtxi_kunhier = space 
TABLES

ICDTXI_KUNHIER = I_ICDTXI_KUNHIER 
xknvh = lt_xknvh " new values
yknvh = lt_yknvh. " old values

ENDLOOP.
ENDIF.


process BTE for delete of a customer hierarchy 
IF fvi_event = '00504006'.
LOOP AT ftr_node_listx.

CLEAR: ls_xknvh, ls_yknvh.
REFRESH: lt_xknvh, lt_yknvh.

MOVE sy-mandt TO ls_yknvh-mandt.
MOVE ftr_node_listx-customer TO ls_yknvh-kunnr.
MOVE ftr_node_listx-sales_org TO ls_yknvh-vkorg.
MOVE ftr_node_listx-distr_chan TO ls_yknvh-vtweg.
MOVE ftr_node_listx-division TO ls_yknvh-spart.
MOVE ftr_node_listx-valid_from TO ls_yknvh-datab.
MOVE ftr_node_listx-custhityp TO ls_yknvh-hityp.
APPEND ls_yknvh TO lt_yknvh.

lv_objectid = ftr_node_listx-customer.

CALL FUNCTION 'KUNHIER_WRITE_DOCUMENT' IN UPDATE TASK
EXPORTING
objectid = lv_objectid
tcode = sy-tcode
utime = sy-uzeit
udate = sy-datum
username = sy-uname
planned_change_number = space
objeci_change_indicator = 'U'
planned_or_real_changes = space

upd_knvh = upd_knvh 
upd_knvh = 'U'

upd_icdtxi_kunhier = space 
TABLES

ICDTXI_KUNHIER = I_ICDTXI_KUNHIER 
xknvh = lt_xknvh " new values
yknvh = lt_yknvh. " old values

ENDLOOP.
ENDIF.


ENDFUNCTION.

Thanks,

Naren

Edited by: Naren Someneni on Feb 20, 2008 5:23 PM

Read only

0 Likes
680

Hi Naren,

Thansk for your quick response. Can you explain me in detail how to implement that ( i have not done this in the past ).

Thanks again.

Read only

0 Likes
680

Karsar,

The events mentioned in my message are for customer hierarchy changes. Let me check whether there are any BTE's available for customer changes.

Rgds,

Naren