‎2007 Jun 28 7:44 PM
Hi,
Below is my code;
*********SAP Code********
TYPES: BEGIN OF v54a0_scdd,
fknum LIKE vfkk-fknum,
change LIKE vfkkd-updkz,
x TYPE v54a0_scd,
y TYPE v54a0_scd,
tvtf LIKE tvtf,
END OF v54a0_scdd.
SCD table for dialog
TYPES: v54a0_scdd_tab TYPE v54a0_scdd OCCURS 1.
*********SAP Code********
*Custom declaration*****
data: wa_freight_costs type v54a0_scdd_tab.
data: it_freight_costs type v54a0_scdd_tab occurs 0.
*****Here data is getting appended to it_freight_costs. P_frieght_costs is coming from standard program.
move p_freight_costs TO wa_FREIGHT_COSTS.
append wa_freight_costs to it_freight_costs.
clear wa_freight_costs.
***Now the problem is here. I am not able to read the data from the nested internal table x-item.
if i use <fs_f_costs> to move data from it_freight_costs in the outer loop, i get a syntax error; <i> "the line type of the table it_freight_costs is not compatible with field symbol type <fs_f_costs>" </i>
FIELD-SYMBOLS: <fs_f_costs> type line of v54a0_scdd_tab.
LOOP AT it_freight_costs assigning <fs_f_costs>.
LOOP AT <fs_f_costs>-x-item ASSIGNING <fs_freight_item>.
<b> I want to read <fs_freight_item>-vfkp-netwr.</b>
ENDLOOP.
Can anyone guide me?
‎2007 Jun 28 7:57 PM
You should move <b><fs_f_costs>-x</b> to a new internal table and then read <b>item</b> from that IT....Then you could assign values to the FS....
Greetings,
Blag.
‎2007 Jun 29 12:26 AM
Thanks Blag. But as i said i am getting the sytax error at the outer loop itself. Once i pass this only then i can think about the second loop.
‎2007 Jun 28 10:44 PM
Please note that TYPE v54a0_scdd_tab is already an internal table type. Instead of try to declare your custom declarations as follows.
*Custom declaration*****
data: wa_freight_costs type v54a0_scdd.
data: it_freight_costs type v54a0_scdd occurs 0.
‎2007 Jun 29 12:30 AM
I have tried this one. in this case when i am trying to <b>append</b> the data to it_freight_costs, during the runtime it is giving me a dump which says <b><i>conversion from V54A0_SCDD_TAB to V54A0_SCDD is not supported.</i></b>
‎2010 Dec 06 4:15 PM
‎2010 Dec 06 8:55 PM
A quick look at how I would do this. Note I haven't checked if this compiles just done a quick brain-dump.
DATA: lr_f_costs TYPE REF TO v54a0_scdd_tab,
lr_f_cost TYPE REF TO v54a0_scdd.
LOOP AT it_freight_costs REFERENCE INTO lr_f_costs.
LOOP AT lr_f_costs->* REFERENCE INTO lr_f_cost.
ENDLOOP.
ENDLOOP.
As you can see I personally prefer pointers to field symbols - I don't believe there is any performance differences and because of my background in other languages pointers make more sense to me.
Cheers
Graham Robbo