cancel
Showing results for 
Search instead for 
Did you mean: 

How we find MC'S for a hierarchy level

former_member650792
Participant
0 Kudos

Hi,

I am venkat, i need some help regarding Hierarchy level and MC.

I want find all the MC for a hierarchy level.

ex: hierarchy level id of hierrarchy

1 A

2 A1

3 A11

4 A111

5 A111A

MC - 1001, 1002, 1003, 1004. ............ETC

We assigned 'A111A' contains MC'S 1001, 1002, 1003, 1004......etc.

My requirement is if i give input as 'A', i want all the hierarchy levels and MC's which are assigned to 'A'.

Plz help me.

venkat

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

kindly use T-code WGUS

Regards..

Jonk

former_member650792
Participant
0 Kudos

my requirement is getting data from sap and send it to other system.

venakt

bjoern_panter
Product and Topic Expert
Product and Topic Expert
0 Kudos

SHould be possible with IDOC type W_WGR or transaction WGSE to send to other systems.

Remark: sending th hierarchy will NOT work !!!! The classification (classes and edges) is also needed !!!!

What is your plan ?

WGUS is the right tool to display the data. Of course look at the function module behind to develop your own logic.

Remark, that to-down evaluations need a lot of performance.

bjoern_panter
Product and Topic Expert
Product and Topic Expert
0 Kudos

REPORT  Z_HIER_CHAR_BREAKDOWN                   .

tables: KLAH, kssk, ksml.
data: kinder like kssk occurs 0  with header line.
data  sohn like kssk.
data: mcs like klah occurs 0 with header line.
data: chars like KSML occurs 0 with header line.
Data: upd_char like KSML occurs 0 with header line.


parameters: wghier like klah-class.



at selection-screen.

select single * from klah where
klart = '026' and class = wghier
and wwskz = '0'.
if sy-subrc <> 0.
 MESSAGE E009(WW) WITH wghier.
*   Die Warengruppenhierarchie-Stufe & existiert nicht
 .
endif.




start-of-selection.

clear kinder.
kinder-clint = klah-clint.
append kinder.

* Ermitteln der Basiswarengruppen unterhalb des
* Hierarchieknotens.
loop at kinder.

Select * from kssk
 where klart = '026' and mafid = 'K'
  and clint = kinder-clint.
 if sy-subrc = 0.
  select single * from klah
   where clint = kssk-objek
     and klart = '026'
     and WWSKZ < '2'.
  if sy-subrc = 0.
    clear sohn.
    sohn-clint = klah-clint.
    if klah-wwskz = '0'.
     append sohn to kinder.
    elseif klah-wwskz = '1'.
     append klah to mcs.
    endif.
  endif.
 endif.
endselect.

delete kinder.

endloop.

....

Result will be available in internal table MCS

But I guess the function module you need is called

MG_GET_FOR_CLASSES_2 (fast version) or MG_GET_FOR_CLASSES (old slow version)

Edited by: Björn Panter on Dec 2, 2008 12:13 PM

former_member650792
Participant
0 Kudos

Thanks,

1.One more, is there any function module to find all hierarchy levels for MC's .

2. My requirement. in selection screen we enter first hierarchy level ( here we have 5 hierarchy levels and MC). For that particular First hierarchy levels we need to find all below hierarchy levels and MC's.

ex: in selection screen we enter A(first hierarchy level).

we need to find all below hierarchy levels and MC's for same.

venkat

bjoern_panter
Product and Topic Expert
Product and Topic Expert
0 Kudos

>

> Thanks,

>

> 1.One more, is there any function module to find all hierarchy levels for MC's .

>

> 2. My requirement. in selection screen we enter first hierarchy level ( here we have 5 hierarchy levels and MC). For that particular First hierarchy levels we need to find all below hierarchy levels and MC's.

>

>

> ex: in selection screen we enter A(first hierarchy level).

> we need to find all below hierarchy levels and MC's for same.

>

> venkat

Hi Venkat

for 1: I geuess the FM find_path_for_object will show you all upper hierarchies for a given MC

for 2: Please look at the function group where the givem FM are located. There should similar tools

Maybe you look at the given program code. It is doing you wished job.

Regards

B

Answers (0)