Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Assigning data from one internal table to other.

Hi Experts,

Below is my code.

FIELD-SYMBOLS: <lfs_get_data> TYPE gty_outtab.

FIELD-SYMBOLS: <lfs_final> TYPE gty_final.

FIELD-SYMBOLS: <lfs_kostl> TYPE gty_kostl.

*Make sure gt_final is not empty.

CHECK NOT gt_final[] IS INITIAL.

*Get Cost Center description

SELECT kostl ktext INTO TABLE gt_kostl

FROM cskt

FOR ALL ENTRIES IN gt_final

WHERE kostl = gt_final-kostl

AND spras = sy-langu

AND datbi GE sy-datum

AND kokrs = gc_kokrs_1000.

LOOP AT gt_outtab ASSIGNING <lfs_get_data>.

*Read the Hash table gt_ktext to get the related Cost Center Text

READ TABLE gt_kostl ASSIGNING <lfs_kostl> WITH TABLE KEY kostl = <lfs_get_data>-kostl.

IF sy-subrc = 0.

<lfs_get_data>-ktext = <lfs_kostl>-ktext.

ENDIF.

ENDLOOP.

Now before the loop statement I have to get the data from one internal table to other. Here my gt_outtab is empty. Now I have to move the data from gt_final to gt_outtab. Please help me.

Tags:
replied

hi,

Take ITAB1 and ITAB2 ,Simply u can copy the from one internal table to another by the follwoung statement

ITAB1[] = ITAB2[] --the entire contnet will be copied

ITAB1 = ITAB2 -the header line data will be copied

if the both internal tables are of differrent structures use loop statement ans assign corresponing fields like below

loop at ITAB1 .

itab2-field1 = itab1-field1.

itab2-field2 = itab1-field2.

endloop.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question