BW - Hierarchy function module
Is there a function module that will return all descendant leaves for HierID/NodeId across all branches?
check this code sample
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9c4de790-0201-0010-6c91-9cae75daa09f
Regards
Raja
Similar Messages
-
Account Hierarchy : Function Module to get all the nodes of a hierarchy
Hi Experts,
Is there a function module which will give as output all the Node GUIDs for a particular account hierarchy in SAP CRM,when the Node GUID of any single node in the same tree is given as input?
Best Regards,
Ashish DhagatThanks mate.
Edited by: pankaj kandhare on Aug 14, 2011 7:56 AM -
Hierarchy Function Modules (or Methods)?
I am trying to retrieve all hierarchies, and their children nodes, below a main node. Is there a function module in SEM/BCS for doing this?
Are there other function modules that come in handy with hierarchies?
Thank-You.There isn't a single FM that I'm aware of. You can piggy back the standard BCS functionality and acheive something similar.
You need to know period, year, version and fiscal year variant.
Then...for this structure:
CG1
- CG2
- CG3
- - CG4
you can pass CG1 as your "parent" and retreive CG2, CG3, and CG4 as selections (according to date-from date-to in your CG master data).
I'll try to include the relevant section for this (it's from a number of methods in a class I created for an outbound interface)....I'm sure I don't have all the data declarations, and I might have a few unnecessary sections.
global variables
data DO_AREA type ref to IF_UC_AREA .
data DO_MODEL type ref to IF_UC_MODEL .
data DO_MD_FACTORY type ref to IF_UG_MD_FACTORY .
initialize objects
*** method for initialize objects
DATA:
lo_factory TYPE REF TO if_ug_md_factory,
lo_char TYPE REF TO if_ug_md_char,
lo_value TYPE REF TO if_ug_md_char_value,
lt_field_val TYPE ugmd_ts_field_val,
ls_field_val TYPE ugmd_s_field_val.
* Initialize master data factory
CALL METHOD cl_uc_area=>if_uc_area~get_md_factory
EXPORTING
i_area = c_cons_area
IMPORTING
eo_md_factory = lo_factory.
do_md_factory = lo_factory.
* get area object, if it's not set
IF do_area IS NOT BOUND.
lo_char = do_md_factory->get_char_instance(
i_fieldname = uc00_cs_fld-area ).
ls_field_val-fieldname = uc00_cs_fld-area.
ls_field_val-value = c_cons_area.
INSERT ls_field_val INTO TABLE lt_field_val.
lo_value = lo_char->get_value_instance(
it_value = lt_field_val ).
do_area ?= lo_value.
* get data model
IF do_model IS NOT BOUND.
CALL METHOD do_area->get_model
IMPORTING
eo_model = do_model.
ENDIF.
ENDIF.
determine lower level consolidation groups
**Include lower level consolidation group nodes in cube selection.
DATA:
lo_context TYPE REF TO if_uc_context,
lt_value TYPE uc0_ts_value,
ls_value TYPE uc0_s_value,
ls_o_sel TYPE uct_sx_sel,
lt_sel TYPE uc0_ts_sel,
ls_sel TYPE uc0_s_sel,
ls_sid TYPE ucd_s_sid,
ls_sel_node TYPE uc0_s_sel_node_sid,
lt_sel_node TYPE uc0_ts_sel_node_sid,
lt_o_sel TYPE uct_t_sel.
CLEAR lt_value.
ls_value-fieldname = c_cgcomp_fieldname. ' /1FB/SEM_CGCOMP
ls_value-value = i_sem_cgcomp. ' "parent" consolidation group
APPEND ls_value TO lt_value.
CALL METHOD do_model->do_sidmap->convert_value_to_sid
EXPORTING
i_fieldname = c_cgcomp_fieldname
it_value = lt_value
IMPORTING
es_sid = ls_sid
EXCEPTIONS
not_found = 1
OTHERS = 2.
CLEAR lt_sel_node.
ls_sel_node-fieldname = c_cgcomp_fieldname.
ls_sel_node-sign = uc00_cs_ra-sign_i.
ls_sel_node-s_node = ls_sid.
INSERT ls_sel_node INTO TABLE lt_sel_node.
CLEAR lt_sel.
CLEAR lt_value.
CALL METHOD do_model->do_data_factory->create_sel
EXPORTING
it_node_sid = lt_sel_node
RECEIVING
eo_sel = ls_o_sel-o_sel.
APPEND ls_o_sel TO lt_o_sel.
CLEAR ls_value.
ls_value-fieldname = '/1FB/CS_VERSION'. " CS Version
ls_value-value = g_cs_version.
APPEND ls_value TO lt_value.
CLEAR ls_value.
ls_value-fieldname = '/BIC/BCS_VERS'. " Custom Version
ls_value-value = g_bcs_vers.
APPEND ls_value TO lt_value.
CLEAR ls_value.
ls_value-fieldname = 'FISCPERIOD'.
ls_value-value = g_fiscperiod.
APPEND ls_value TO lt_value.
CLEAR ls_value.
ls_value-fieldname = 'FISCVARNT'.
ls_value-value = g_fiscvarnt.
APPEND ls_value TO lt_value.
CLEAR ls_value.
ls_value-fieldname = 'FISCYEAR'.
ls_value-value = g_fiscyear.
APPEND ls_value TO lt_value.
CALL METHOD do_model->derive_context
EXPORTING
it_value = lt_value
IMPORTING
eo_context = lo_context
EXCEPTIONS
info_missing = 1
OTHERS = 2.
CALL METHOD ls_o_sel-o_sel->set_context
EXPORTING
io_context = lo_context.
CALL METHOD ls_o_sel-o_sel->get_sel
IMPORTING
et_sel = lt_sel.
* lt_sel will contain the lower-level consolidation groups, beneath the "parent" consolidation group (i_sem_cgcomp)
* Add cons groups to selection criteria
DELETE gt_range WHERE chanm = c_objnm_cgcomp. ' 0SEM_CGCOMP
LOOP AT lt_sel INTO ls_sel.
CLEAR gs_range.
gs_range-chanm = c_objnm_cgcomp. ' 0SEM_CGCOMP
gs_range-sign = ls_sel-sign.
gs_range-compop = ls_sel-option.
gs_range-low = ls_sel-low.
gs_range-high = ls_sel-high.
APPEND gs_range TO gt_range.
ENDLOOP.
Hope that helps...if not, you might be able to do a find for some of the sections of the code to find exactly how SAP is doing (I can only say that this functionality worked in my situation, not sure it works in all consolidation scenarios). FYI - I was using this to read from the virtual cube in a custom task in order to outbound consolidated results.
- Chris -
Function Module to get the node name in particular level name in Hierarchy
Hi All,
We have 0Material hierarchy which consists of 14 levels and materials are in the 14th level.
We have a requirement to update the 4th level node name to all materials.
So we have created the attribute to this 0Material and thought of updating in the transformation.
Could you please suggest us to which function module i can in this scenario.
Thanks in advance,..
PrasannaCan you explain in more detail what exactly you want to do?
do you want to limit hierarchy to level4?
Regards
Sudeep -
Function Module to get hierarchy details from a customer account
Hi Experts,
There is certain hierarchy maintained among Business partners. We can see that in transaction BPH.
Now What I require is a function module which takes BP number as input and gives output the
BP number of child nodes of it . Is there a standard function module for it ?
Please help me move ahead.
Thanks in advanceHi ram.mahaseth ,
There are several tables:
BUT_HIER_NODE
BUT_HIER_NODE_BP
BUT_HIER_NODE_D
BUT_HIER_STRUCT
BUT_HIER_TREE_D
BUT_HIER_TREE
Hope this helps.
Regards, Kostya Khveshchenik -
Is there a Function module to get customer hierarchy data?
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?
ThanksHi 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 -
Function Module to Read Hierarchy Node
Hi,
Is there is any function module to read from existing Node of Hierarchy (includes sub Nodes, including all its children) similar to RRH1_HIERARCHY_HELP_VALUES_GET.
Requirement is to create custom Hierarchy from existing Hierarchy (eg: 0WBSELMNT - has XXX Hierarchy, In there is (2nd level) HIER_NODE say yyy. Now read yyy node and create custom Hierarchy to 0WBSELMNT ).
If we know the Functional modules if any then we can manipulate in ABAP code and write to flat file and upload same file with different Hierarchy Name.
Thanks in Advance,
MadhuHi,
Pls try this:
RSNDI_SHIE_STRUCTURE_GET3
RSSH_HIERARCHY_READ
RSAR_HIERARCHY_GET
Looking up BW-Hierarchy with ABAP
Regards
CSM Reddy -
Functional module to obtain the Customer hierarchy
Hello Experts,
I need some information regrading Customer hierarchy step. Could anyone please assist me the function module used in customer hierarchy to obtain the hierarchy.
Thanking you,
SS.Hello Pratima.
Thank you for your quick response.
Could you please provide me the configuration steps for customer hierarchy as this is our action event.
Thanks in advance.
Regards,
SS. -
Any function module to change planning hierarchy (tcode: MC92)?
I need to change planning hierarchy for product alloction.
I have tried to do it via transaction recorder, but some screens are missing when I tried to record it.
Could any one please advise if there is any function module that can serve the same purpose? Thanks.Thanks Bhanu for ur quick reply.
Is that enough to change the technical name in the table RSZCOMPDIR.
Let me give some more information, idea is to change the technical name of all the queries present in a system based on a new naming conventions.
Eg.
Change all the technical name of queries ZQSAP to ZQXYZ.
If there is function module which allows to change the technical name of the queries that not only updates the table RSZCOMPDIR but also all the interlinked tables. -
Hierarchial Layout Saving with function modules
Hai to all
i am facing a problem while saving layout in Hierarchial list display with function module.
below error message is coming when i am going save my layout.
210 if l_def_variant-variant eq rs_variant-variant.
211 l_default = 'X'.
212 endif.
213 endif.
214
215 call function 'LT_FC_SAVE'
216 exporting
217 * I_TOOL = 'LT'
218 i_tabname = r_tabname
219 i_tabname_slave = r_tabname_slave
220 is_variant = rs_variant
221 it_fieldcat = rt_fieldcat[]
222 it_sort = rt_sort[]
223 it_filter = rt_filter[]
224 is_layout = rs_layout
225 i_default_variant = l_default
226 exceptions
227 fc_not_complete = 1
228 others = 2.
229 case sy-subrc.
230 when '0'.
231 message s018(0k).
232 when '1'.
>>>>> message x000(0k) with 'LT_FC_SAVE' sy-subrc
234 raising fc_not_complete.
235 endcase.
it is very urgent...
Subhash.Mdata: ls_vari type disvariant.
DATA: w_repid TYPE sy-repid.
ls_vari-report = w_repid.
ls_vari-username = sy-uname.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
i_callback_program = w_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
is_layout = wa_layout
it_fieldcat = i_fcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = i_sort[]
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
i_default = 'X'
i_save = 'X'
IS_VARIANT = ls_vari
it_events = i_event[]
IT_EVENT_EXIT =
i_tabname_header = 'I_FINAL1'
i_tabname_item = 'I_FINAL2'
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
is_keyinfo = wa_key
IS_PRINT =
IS_REPREP_ID =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IR_SALV_HIERSEQ_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab_header = i_final1
t_outtab_item = i_final2
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
i have passed the parameters
but i am getting same dump again..
Subhash.M -
WANTED: Function Module (Product Allocation Planning Hierarchy Upload Tool)
Hi,
I would like to seek assistance in utilizing the <b>right function module</b> in uploading Product Allocation Planning Hierarchy to MC62.
I've tried direct table update and BDC but to no avial.
Points will be rewarded.
Thanks in advanceHi,
I'm having trouble using the FM 'MCP_GET_HIERARCHY'.
CALL FUNCTION 'MCP_GET_HIERARCHY'
EXPORTING
i_gstru =
IMPORTING
RETURN =
TABLES
t_filter =
t_char_values = .
What do I put in i_gstru, t_filter, and t_char_values?
I'm very new with this.
Thanks in advance for the help. -
How to make a normal Function Module remote able function module
Hi guys,
i am a beginner in abap programming. I have made a programm in Se80 which shows all the nodes of the active hierarchies (5 stk.)
in a ALV grid. Therefore i am getting the active hierarchies from table "rshiedir" and use the normal function module "RSSH_HIERARCHY_READ" to display the nodes of the hierarchie. The problem is the hierarchies do have a different techical name in the systems (development-acceptance-productive) but the descriptive nbame is the same in all systems. Because of the difference of the technical names I can use this programm in just one system. But the hierarchy content should be comparable and be displayed in all three systems. Therefore i would like to create a remoteable function module which covers the normal one. Can i do this and how can i create a remoteable function module and use it?
If not do you know any remotable functgion module which gives back all the nodes from an active hierarchy in table "RShiedir".
Thanks and kind regards,
MuratHello,
Simple, create a wrapper RFC (similar to 'RSSH_HIERARCHY_READ' ) & call the normal FM 'RSSH_HIERARCHY_READ' inside the wrapper.
Something like this:
FUNCTION z_rssh_hierarchy_read.
*"*"Global Interface:
*" IMPORTING
*" VALUE(I_RSHIEDIRKEY) TYPE RSHI_S_RSHIEDIRKEY OPTIONAL
*" VALUE(I_RSHIEDIRLOG) TYPE RSHI_S_RSHIEDIRLOG OPTIONAL
*" VALUE(I_DATE) TYPE RSHI_DATE DEFAULT SY-DATUM
*" EXPORTING
*" REFERENCE(E_RSHIEDIR) TYPE RSHI_S_HIEDIR
*" REFERENCE(E_T_RSNODES) TYPE RSHI_T_HIENODE
*" REFERENCE(E_TH_RSINTERVAL) TYPE RSHI_TH_INTERVAL
*" REFERENCE(E_DUPLICATE_LEAFS) TYPE RS_BOOL
*" REFERENCE(E_T_RSNODES_LNK) TYPE RSHI_T_HIENODE
*" EXCEPTIONS
*" INVALID_HIERARCHY
*" NAME_ERROR
*" IOBJ_NOT_FOUND
" Don't forget to add TYPE-POOLS rshi to the FuGr. TOP include
CALL FUNCTION 'RSSH_HIERARCHY_READ'
EXPORTING
i_rshiedirkey = i_rshiedirkey
i_rshiedirlog = i_rshiedirlog
i_date = i_date
IMPORTING
e_rshiedir = e_rshiedir
e_t_rsnodes = e_t_rsnodes
e_th_rsinterval = e_th_rsinterval
e_duplicate_leafs = e_duplicate_leafs
e_t_rsnodes_lnk = e_t_rsnodes_lnk
EXCEPTIONS
invalid_hierarchy = 1
name_error = 2
iobj_not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Here Z_RSSH_HIERARCHY_READ is the wrapper RFC. Hope you get the point.
BR,
Suhas -
Function Modules / Classes to change cProject item
Hello,
I'am searching for function modules or classes to change the cProject item.
Ich want to change some fields in the task of cProject. Can everbody help me?
Kind regards AxelDear Thomas,
I've following requirements:
- Automated Creation of a cFolders folder structure/hierarchy from a structured uploaded from an excel file
from R/3 ABAP program
- Search for a particular document in cFolders using R/3 ABAP program
Would it be possible to do the above tasks using the BAPIs mentioned in your post.
Thanks. -
Function module related to release transport request
Hello experts,
I am working on product management system hierarchy. The hierarchy is like
PRODUCTSSUBPRODUCTVERSIONPACKAGE
we can create transport for VERSION directly from CONTEXT MENU. Next step is download transport to client PC I have done with it. FInal stage to release transport directly from context menu. For this i am searching for appropriate function module. If anybody know which function module to be used for transport request release please share it with me.
Thanks,
AvadhutHi,
You can use TR_RELEASE_REQUEST to release a transport request directly.
The class CL_CTS_REQUEST is also worth looking at. -
How to create Inbound Idocs in a ABAP program? Any function Module?
Hello Experts,
My requirement is : I have sales order data which I extracted from third party system in my internal tables. In the same box I need to create inbound Idocs and then consequently create sales orders.
I have used the function module IDOC_INBOUND_WRITE_TO_DB to create inbound Idocs from Sales Orders data in internal tables. I have populated all the data records with correct PSGNUM and HLEVEL values. My plan is to create inbound idocs with this function module and send those to IDOC_INPUT_ORDERS function module which creates Sales Orders.
If a sales order in the internal table in ABAP program contains only one item, then I am getting correct idocs. But if more than one item exists for a sales order then the line item segments which got repeated in Idoc are having PSGNUM and HLEVEL values as zero when I checked in WE02. As a result the hierarchy from the second item segment is getting disturbed and getting the status 60.
I populated T_EDIDD with data records from IDOC_INBOUND_WRITE_TO_DB.
To the function module IDOC_INPUT_ORDERS, T_EDIDC and T_EDIDD are the input. I observed that in T_EDIDD also the PSGNUM and HLEVEL values are blank.
I am getting Status 60 with message 'EDI: Syntax error in IDoc (segment cannot be identified)' for idocs which have more than one item.
I need to extract sales data from third party and create inbound idocs and create sales orders in one ABAP program only. I need to display corresponding Idoc numbers for the corresponding third party sales order number in a listoutput.
Can anybody please provide inputs?
Regards.Hi Anjali,
Thanks for the response.
I have passed the PSGNUM and HLEVEL values while populating the data records. Then I sent the data records and control record information to the function module IDOC_INBOUND_WRITE_TO_DB. Inside this function module there is code to clear the PSGNUM values and HLEVEL values.
for compatibility: clear administration data of data records
perform data_records_wipe
tables
t_data_records.
FORM DATA_RECORDS_WIPE
TABLES
T_DATA_RECORDS_IN STRUCTURE EDIDD.
LOOP AT T_DATA_RECORDS_IN.
CLEAR: T_DATA_RECORDS_IN-MANDT,
T_DATA_RECORDS_IN-DOCNUM,
T_DATA_RECORDS_IN-SEGNUM,
T_DATA_RECORDS_IN-PSGNUM,
T_DATA_RECORDS_IN-HLEVEL.
modify t_data_records_in.
ENDLOOP.
ENDFORM. " DATA_RECORDS_WIPE
This is the code which is clearing all the PSGNUM and HLEVEL values. After coming out of this function module we are getting the error idocs created with disturbed hierarchy.
I need to create INBOUND Idocs with the data in ABAP program.
Please let me know if any inputs? Is there any function module existing to create Inbound Idocs inside an ABAP program?
Regards
Maybe you are looking for
-
Excel 2007 and Smartview 11.1 file open slow
We are in the process of upgrading to HFM system 11.1 and smartview 11.1.1.3 and as part of this process we are starting to use Excel 2007. I am encountering an interesting problem when opening files in Excel 2007 using smartview 11.1 and I am wonder
-
When I sort by Album Artist, it sorts, but the next level of sorting seems to be the artist then I'm not sure what it sorts by? I prefer the tree to go Album Artist>Album>Track number, is there any way to modify this?
-
Fetch data from two tables and insert into one table
I have similar to the following data in two tables (@Plant, @PlantDirector) and need to consolidate into one table (@PlantNew) as follows. DECLARE @Plant TABLE (PlantID INT, PlantName VARCHAR(100)) INSERT INTO @Plant (PlantID, PlantName) VALUES (1, '
-
Hi , In the above query , it is possible for me to identify how many duplicate ITEM are present. but my output should be like this EMPID ITEM NAME 201 A D 301 A D 111 D A 11 D A 11 D A 122 E A 12 H A 11 H A 88 H A 44 H A 10 rows selected. SQL> SELECT
-
Router Crashes after entering "show run" or similar commands
Hello, Im having a problem with my Company router C3845-ADVSECURITYK9-M, software Version 15.1(4)M. After i issue "show run" it tends to crash in middle of output, router restarts itself to be precise....same thing happened when i tried "show stack"