on 03-13-2017 9:27 AM
Hi Friends,
Could you please help in below.
I have to derive Parent Nodename based on Parent ID of a Org Unit, and I am writing Start routine based on Attribute DS 0ORGUNIT_ATTR.
Step 1 :
types : begin of t_orghier,
hieid type rshieid,
objvers type rsobjvers,
nodeid type rshienodid,
nodename type rsshnodenamestr,
parentid type rsparent,
datefrom type /bi0/oidatefrom,
dateto type /bi0/oidateto,
end of t_orghier.
data : lt_orghier type standard table of t_orghier.
data : ls_orghier type t_orghier.
SELECT HIEID OBJVERS NODEID NODENAME PARENTID DATEFROM DATETO from
/BI0/HORGUNITINTO TABLE t_orghierFOR ALL ENTRIES IN SOURCE_PACKAGE where
NODENAME EQ SOURCE_PACKAGE-orgeh.
OBJVERS EQ 'A'.
DATETO GE Sy-datum.
DATEFROM LE Sy-datum.
Could you please help how to read Internal table and get the Parent Id
Thanks
Sri
Hello Sri,
You have come this far, I am sure if you look at a few more discussions about internal tables, you will be able to complete the code without any help 🙂
You will have to do a second select from /BI0/HORGUNIT where NODEID = t_orghier-parentid and append the result to t_orghier table. This way you will have the orgunit and it's parne tdetails in one table.
Now you can loop at SOURCE_PACKAGE or do this in your field routine
read t_orghier into ls_orghier1 where NODENAME = SOURCE_PACKAGE-orgeh
var_parent = ls_orghier1-PARENTID
read t_orghier into ls_orghier2 where NODEID = var_parent
result = ls_orghier2-NODENAME
Endloop
I have just given you the pseudo code, please go through more discussions on internal table and how to effectively use them(Binary search etc).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
check this option, download into a flatfile...thereafter you might load the flattened hierarchy into whatever you need:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
In the result package you will have one structure " _ty_s_tg_1"
Take data type of orgunit from this structure and declare nodename with this data type/
Also note there is no need to write 2 read statements as you have done...use only 1 read statement and also dont forget to use Binary search after that just before sy-subrc check
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Benedict Venmani Felix,
Thanks a lot for the reply,
I have coded as below in End Routine, Small issue in Length I am getting following message
E:When you use the addition "FOR ALL ENTRIES IN itab", the fields NODENAME" and "RESULT_PACKAGE-ORGUNIT" must have the same type and the Same length.
But I am using standard tables elements and datatypes where NODENAME is SSTRING length 1333 where as ORGUNIT is datatype of CHAR length 8.
below fine below my code.
Thanks a lot for looking into below
Declarion :
types : begin of t_orghier,
hieid type rshieid,
objvers type rsobjvers,
nodeid type rshienodid,
nodename type rsshnodenamestr,
parentid type rsparent,
datefrom type /bi0/oidatefrom,
dateto type /bi0/oidateto,
end of t_orghier.
data : lt_orghier type standard table of t_orghier.
data : lt_orghier_main type standard table of t_orghier.
data : ls_orghier1 type t_orghier.
data : ls_orghier2 type t_orghier.
Code :
select hieid objvers nodeid nodename parentid datefrom dateto from/bi0/horgunit
into table lt_orghier
for all entries in result_package where
nodename eq result_package-orgunit .
objvers eq 'A'.
dateto ge sy-datum.
datefrom le sy-datum.
sort lt_orghier by dateto ascending.
lt_orghier[] = lt_orghier_main[].
loop at result_package assigning <result_fields>.
clear ls_orghier1.
clear ls_orghier2.
read table lt_orghier into ls_orghier1 with key
nodename = <result_fields>-orgunit.
read table lt_orghier into ls_orghier2 with key
nodeid = <ls_orghier1>-parentid.
if sy-subrc = 0.
<result_fields>-/bic/zorgprnt = <ls_orghier2>-nodename.
endif.
endloop.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.