2013 Jan 07 4:15 AM
Hello all,
I try to use methods cl_rssh_hierarchy_func=>get and cl_rssh_hierarchy_func=>update - in doing so both methods are working fine, i.e. the first delivers a subtree in parameter E_R_HTAB with Type Ref To DATA and the update method writes a subtree back to the hierarchy with parameter I_T_HTAB and Type TABLE. Unfortunately I have an issue transforming the hierarchy data from Ref To DATA into an ITAB for the TABLE parameter - one of my attempts amongst others was this one:
DATA: lt_htab TYPE rshi_t_rsnode1,
ls_htab LIKE LINE OF lt_htab,
lr_htab TYPE REF TO data,
dref TYPE REF TO data,
lt_htab_dref LIKE TABLE OF dref.
FIELD-SYMBOLS: <ls_rsthiernode> LIKE LINE OF mt_rsthiernode,
<dpak_fields> TYPE any,
<s_hieid> TYPE rshieid.
CREATE DATA lr_htab LIKE LINE OF lt_htab
*
* getting subtree with cl_rssh_hierarchy_func=>get here
*
GET REFERENCE OF lt_htab_dref INTO lr_htab.
ASSIGN lr_htab->* TO <dpak_itab>.
LOOP AT lt_htab_dref ASSIGNING <dpak_fields>.
ASSIGN COMPONENT 'RSHIEID' OF STRUCTURE <dpak_fields> TO <s_hieid>.
ls_htab-hieid = <s_hieid>.
APPEND ls_htab TO lt_htab.
ENDLOOP.
*
* writing subtree with cl_rssh_hierarchy_func=>update here
*
Sadly no data is in structure c_t_srcpak ...
Can you show me an example which solves this task?
Best regards, Martin
Hello all,
I try to use methods cl_rssh_hierarchy_func=>get and cl_rssh_hierarchy_func=>update - in doing so both methods are working fine, i.e. the first delivers a subtree in parameter E_R_HTAB with Type Ref To DATA and the update method writes a subtree back to the hierarchy with parameter I_T_HTAB and Type TABLE. Unfortunately I have an issue transforming the hierarchy data from Ref To DATA into an ITAB for the TABLE parameter - one of my attempts amongst others was this one:
DATA: lt_htab TYPE rshi_t_rsnode1,
ls_htab LIKE LINE OF lt_htab,
lr_htab TYPE REF TO data,
dref TYPE REF TO data,
lt_htab_dref LIKE TABLE OF dref.
FIELD-SYMBOLS: <ls_rsthiernode> LIKE LINE OF mt_rsthiernode,
<dpak_fields> TYPE any,
<s_hieid> TYPE rshieid.
CREATE DATA lr_htab LIKE LINE OF lt_htab
*
* getting subtree with cl_rssh_hierarchy_func=>get here
*
GET REFERENCE OF lt_htab_dref INTO lr_htab.
ASSIGN lr_htab->* TO <dpak_itab>.
LOOP AT lt_htab_dref ASSIGNING <dpak_fields>.
ASSIGN COMPONENT 'RSHIEID' OF STRUCTURE <dpak_fields> TO <s_hieid>.
ls_htab-hieid = <s_hieid>.
APPEND ls_htab TO lt_htab.
ENDLOOP.
*
* writing subtree with cl_rssh_hierarchy_func=>update here
*
Sadly no data is in structure c_t_srcpak ...
Can you show me an example which solves this task?
Best regards, Martin
2013 Jan 07 2:15 PM
Hello once more,
the problem is solved, it works like this:
DATA: lt_htab TYPE rshi_t_rsnode1,
ls_htab LIKE LINE OF lt_htab,
lr_htab TYPE REF TO data.
FIELD-SYMBOLS:
<dpak_itab> TYPE ANY TABLE,
<dpak_fields> TYPE LINE OF rshi_t_rsnode1,
<s_hieid> TYPE rshieid.
CREATE DATA lr_htab LIKE LINE OF lt_htab.
*
* getting subtree with cl_rssh_hierarchy_func=>get here
*
ASSIGN lr_htab->* TO <dpak_itab>.
LOOP AT <dpak_itab> ASSIGNING <dpak_fields> CASTING.
ASSIGN COMPONENT 'HIEID' OF STRUCTURE <dpak_fields> TO <s_hieid>.
ls_htab-hieid = <s_hieid>.
"further processing ...
APPEND ls_htab TO lt_htab.
ENDLOOP.
2013 Jan 12 7:44 AM
Hi Martin,
Hi Saw your post that with GETREFERENCE and with out GETREFERENCE and you used CASTING when Looping, can you explain why you kept CASTING in Looping and i also tried but it is giving error and i declared <dpak_fields> type any , So i changed like line of lt_htab and i am not getting error .
So , Please explain the Purpose of CASTING .
Thanks,
Raghunadh.K
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |