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

Customer master!

Former Member
0 Likes
2,252

Hello all,

In IDOC interface, I need to pass customer hierarchy information along with customer master DEBMAS to a third party system. I should not extend IDOCS. Need to use RFC function calls.

We can use RFC calls, but my question is how can we trap customer hierarchy changes in the change pointers table? Is there any way we can trap those changes and process them?

Thanks,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,322

Hi,

Check the object KUNHIER for customer hierarchy changes.

I think standard SAP will automatically take care of the changes...

Thanks,

Naren

7 REPLIES 7
Read only

Former Member
0 Likes
1,323

Hi,

Check the object KUNHIER for customer hierarchy changes.

I think standard SAP will automatically take care of the changes...

Thanks,

Naren

Read only

0 Likes
1,322

Can someone please extend this thread?

Read only

0 Likes
1,322

In 4.6c, the KUNHIER change document is not active in the standard system. The change document is set up and the functions are there, but is is not called from VDH1 or VDH1N.

We are using a BTE (Business Transaction Event) to create a KUNHIER change document when the hierarchy changes, then a report to process the KUNHIER change documents and the DEBI change documents.

If you are not familiar with BTE's, the t-code is FIBF and the BTE's for customer hierarchy are 00504004, 00504005 and 00504006.

Good luck.

Read only

0 Likes
1,322

Tim,

Can you please explain me in steps how to do this?

Anyone has any idea about the steps which needs to perform?

Thanks,

Message was edited by: Somen

Read only

0 Likes
1,322

A little hard to document within the confines of this forum, but I'll give it a try.

> 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.

Good luck,

Tim

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.

Message was edited by: Tim Walker

Read only

0 Likes
1,322

Tim,

Thanks a lot. It solved my problem. Points are awarded.

Thanks,

Read only

0 Likes
1,322

Hi Somen/Tim

Is there a way we could get the customer hierarchy data onto the change pointer tables - i.e the BDCP* tables ? Or will data be automatically written onto change pointer tables ( once data gets to change document tables ) if we have entries for KNVHHIER class in a Z* change pointer message type definition ??

Reading CDHDR table could be a performance intensive operation.....