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

Is there a Function module to get customer hierarchy data?

Former Member
0 Likes
9,426

Howdy,

I'm writing a report where the user can, on the selection screen, enter a customer number or a hierarchy node and then the program has to get all the higher level nodes and and lower level nodes for the selected Sales area.

eg. for the following hierarchy:

A

->B

--

--|-> D

--|-> E

-> C

---

---|-> F

---|-> G

if node b was selected it would pull back:

KUNNR HKUNNR

A blank

B A

C A

D B

E B

F C

G C

Anyone know if there is a Function module that can do this?

Thanks

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
4,171

You may want to check out the following BAPIs, they all belong to the same function group.

BAPI_CUSTOMER_GET_CHILDREN BAPI Customer Hierarchy GetChildren() Implementation

BAPI_CUSTOMER_GET_ROOT BAPI Customer Hiearchy getRoot() Implementation

BAPI_CUSTOMER_GET_ROOT_LIST BAPI Customer Hierarchy getRootList() Implementation

BAPI_CUSTOMER_HIERARCHIE_DEL BAPI Customer Hierarchy Delete() Implementation

BAPI_CUSTOMER_HIERARCHIE_INS BAPI Customer Hierarchy Insert() Implementation

BAPI_CUSTOMER_HIERARCHIE_UPD BAPI Customer Hierarchy Change( Implementation

Regards,

Rich Heilman

Howdy,

I'm writing a report where the user can, on the selection screen, enter a customer number or a hierarchy node and then the program has to get all the higher level nodes and and lower level nodes for the selected Sales area.

eg. for the following hierarchy:

A

->B

--

--|-> D

--|-> E

-> C

---

---|-> F

---|-> G

if node b was selected it would pull back:

KUNNR HKUNNR

A blank

B A

C A

D B

E B

F C

G C

Anyone know if there is a Function module that can do this?

Thanks

9 REPLIES 9
Read only

RichHeilman
Developer Advocate
Developer Advocate
4,172

You may want to check out the following BAPIs, they all belong to the same function group.

BAPI_CUSTOMER_GET_CHILDREN BAPI Customer Hierarchy GetChildren() Implementation

BAPI_CUSTOMER_GET_ROOT BAPI Customer Hiearchy getRoot() Implementation

BAPI_CUSTOMER_GET_ROOT_LIST BAPI Customer Hierarchy getRootList() Implementation

BAPI_CUSTOMER_HIERARCHIE_DEL BAPI Customer Hierarchy Delete() Implementation

BAPI_CUSTOMER_HIERARCHIE_INS BAPI Customer Hierarchy Insert() Implementation

BAPI_CUSTOMER_HIERARCHIE_UPD BAPI Customer Hierarchy Change( Implementation

Regards,

Rich Heilman

Read only

Former Member
0 Likes
4,171

Steve,

In addition to what Rich recommended, you could also try function: RKE_READ_CUSTOMER_HIERARCHY.

Good Luck! 🐵

Regards,

Terry

Read only

Former Member
0 Likes
4,171

Hi, I need to know If any bapi o function module similar to mentioned Ex. BAPI_CUSTOMER_GET_CHILDREN, etc. are available in BW. We have BW 3.5.

I need, get child wbs elements in the wbs elm hierarchy for a given parent wbs element, for a project definition.

The data required about wbs elm hierarchy is in Table /BI0/HWBS_ELEMT, and I know a abap program/routine could be development, but it´s a function or a bapi are available could be better.

Regards

Victoria

Read only

Former Member
0 Likes
4,171

Hi Victoria,

I use always 'RSNDI_SHIE_STRUCTURE_GET3' for my BW development.

Regards

Nicola

Read only

0 Likes
4,171

Hi Nicola, I execute function recommended by you.

I try filling in I_S_HIEKEY a value for field HIEID and in I_T_NODENAME a value for field NODEID and infobject name (0wbs_elemt)of Table /BI0/HWBS_ELEMT, but function returns to me a error message.

Can you help about the rigth way to use this function??

Thank you

Victoria

Read only

Former Member
0 Likes
4,171

Sorry for the late reply, I live in Germany so we have some time difference.

For characteristic 0WBS_ELEMT you will have to fill the import parameters the following way:

DATA: lh_hiekey TYPE rsndi_s_hiekey,

lh_hiesel TYPE rsndi_s_hiesel,

lh_subsel TYPE rssh_s_nodebynamewol,

lh_hiedir TYPE rsndi_s_hiedir,

lh_rc TYPE sysubrc,

xt_hierstruc TYPE STANDARD TABLE OF xty_hstruc

WITH HEADER LINE.

MOVE xt_dir-hieid TO lh_hiekey-hieid. (RSHIEDIR-HIEID)

MOVE 'A' TO lh_hiekey-objvers.

MOVE 'A' TO lh_hiesel-objvers.

MOVE xh_pspn-qhienm TO lh_hiesel-hienm. (RSHIEDIR-HIENM)

MOVE xh_pspn-qversion TO lh_hiesel-version. ( " -VERSION)

MOVE xt_dir-dateto TO lh_hiesel-dateto. ( " -DATETO)

MOVE xh_pspn-iobjnm TO lh_hiesel-iobjnm. ( " -IOBJNM)

MOVE xh_pspn-leaffrom TO lh_subsel-nodename. (/BI0/HWBS_ELEMT-NODENAME)

e.g. you want to get all the children of node 'A0001' you have to enter A0001 as lh_subsel-nodename.

MOVE xh_pspn-iobjnm TO lh_subsel-iobjnm.

(/BI0/HWBS_ELEMT-IOBJNM)

CALL FUNCTION 'RSNDI_SHIE_STRUCTURE_GET3'

EXPORTING

i_s_hiekey = lh_hiekey

i_s_hiesel = lh_hiesel

i_s_subtreesel = lh_subsel

IMPORTING

e_s_hiedir = lh_hiedir

e_subrc = lh_rc

TABLES

e_t_hierstruc = xt_hierstruc.

Hope that helps!

Nicola

Read only

0 Likes
4,171

Thanks Nicola,

Is there any bapi o function module similar to mentioned but it looks for the parents of the given node?

Regards

Victoria

Read only

0 Likes
4,171

Hello Victoria,

I'm not sure why you are looking for a bapi or FM because an easy select will solve the problem? If you have the ID of the hierarchy and the node you just have to read the hierarchy table with this information and you'll get the parent-id.

Regards

Nicola

Read only

0 Likes
4,171

Hi Victoria,

even i was using the same FM "RSNDI_SHIE_STRUCTURE_GET3"

my code goes like this...

i am passing hierarchy name and node name...this is for cost element hierarchy.

please check the code and tell if i am missing anything.

o/p i am getting is all 0's.

report ztest5.

tables : ZREPCODMAP.

data: itab type standard table of ZREPCODMAP with header line.

TYPES: BEGIN OF STRUC,

RESULT type RSSH_S_NODEBYNAMEWOL,

  • ZREPCODMAP-REPDSELM,

END OF STRUC.

DATA: itab1 type standard table of struc with header line.

data: w_hiesel like RSNDI_S_HIESEL.

w_hiesel = '1000KES'.

*data: w_nodebyname type RSNDI_T_NODENM.

data: tab type standard table of RSNDI_S_HTAB with header line.

data: lsubrc type SY-SUBRC.

select * from ZREPCODMAP into table itab where PROFIT_CTR <> ' '.

loop at itab.

concatenate itab-CO_AREA itab-REPDSELM INTO itab1-RESULT.

*write: itab1.

break-point.

CALL FUNCTION 'RSNDI_SHIE_STRUCTURE_GET3'

EXPORTING

  • I_S_HIEKEY =

i_s_hiesel = w_hiesel

i_s_subtreesel = itab1-result

  • I_T_NODENAME =

I_NO_NODENM_TABLE = w_flag

IMPORTING

  • E_S_HIEDIR =

e_subrc = lsubrc

TABLES

  • E_T_HIEDIRT =

e_t_hierstruc = tab.

  • E_T_MHIERNODE =

  • E_T_THIERNODE =

  • E_T_HIERINTVL =

  • E_T_NODENAMES = tab.

  • E_T_NODEATTR =

  • E_T_LEVEL =

  • E_T_MESSAGE =

write: tab.

*write: lsubrc.

endloop.

Thanks & Regards,

Vijaya