Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

How to append lines of a dynamic internal table to another dynamic internal table of same type

$
0
0


Hi Experts,

 

Thanks for your valuable post !

 

I've one requirement and expecting the solution.

 

Requirement: How to append lines of a dynamic internal table to another dynamic internal table of same type.

 

Scenario: I've one Internal table ITAB1 having 100 records which is assigned to dynamic internal table <ITAB1>(so ITAB1 also have 100 records).

I want to get the 20 records from the dynamic internal table <ITAB1> to a second dynamic internal table <ITAB2> which is of same type as <ITAB1>.

 

I'm using the code : APPEND LINES OF <ITAB1> FROM  1 TO  20 TO  <ITAB2>.

 

But values are not getting inserted to <ITAB2>.

 

Code is below for your understanding what i'm doing: -

 

data : w_tabname TYPE w_tabname,

      w_dref
TYPE REF TO data,

      w_grid
TYPE REF TO cl_gui_alv_grid.

FIELD-SYMBOLS <ITAB1> TYPE STANDARD TABLE.

FIELD-SYMBOLS <ITAB2> TYPE STANDARD TABLE.


PARAMETERS: p_record type i.

 

PARAMETERS : p_table(50) TYPE C. "Taking Standard table from Selection Screen say "MARA"

  w_tabname
= p_table. " Getting the table name from Selection screen

 
CREATE DATA w_dref TYPE TABLE OF (w_tabname).


 
ASSIGN w_dref->* TO <ITAB1>.


 
ASSIGN w_dref->* TO <ITAB2>.

 

* Populating Dynamic internal table
SELECT * FROM (w_tabname) UP TO 20 ROWS  INTO TABLE <ITAB1>. "Values are comming in <ITAB1> without any problem

APPEND LINES OF <ITAB1> FROM  1 TO  20 TO  <ITAB2>. "This code is not getting executed successfully

Please help me with your valuable tips...


!!!! <do not post personal info>

 

 

Thanks in Advance!

Regards,

Pankaj

 

Message was edited by: Suhas Saha


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>