Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

copying an internal table into a range

Former Member
0 Kudos

I want to copy an internal table into a range

declared as

DATA: r_mtart TYPE RANGE OF mtart.

please also some other way to declare range suggest

5 REPLIES 5

Former Member
0 Kudos

Hello,

DATA: r_mtart TYPE RANGE OF mtart,

wa_mtart like r_mtart.

loop at itab.

wa_mtart-sign = 'I'.

wa_mtart-option = 'EQ'.

wa_mtart-sign = itab-mtart.

append wa_mtart to r_mtart.

endloop.

If useful reward.

Vasanth

Former Member
0 Kudos

u can declare a range as follows

DATA : v_mtart TYPE mtart.

RANGES : r_mtart FOR v_mtart.

Then loop at the itab and populate the range

LOOP AT itab.

r_mtart-sign = 'I'.

r_mtart-option = 'EQ'.

r_mtart-low = itab-mtart.

APPEND r_mtart.

CLEAR r_mtart.

ENDLOOP.

Thanks

Elan

Former Member
0 Kudos

Ranges : r_mtart for mara-mtart

Former Member
0 Kudos

Hi,

Create an internal table including the fields sign, opti, low, high.

sign = I

opti = EQ

perform a read statement on that internal table and move the values in to the range table.

Declare the range as

RANGES : r_mtart FOR table-field.

" Reward points if helpful "

Mallika.

Former Member
0 Kudos

Hi Naval,

You can do in the following way.

DATA : BEGIN OF g_t_itab OCCURS 0,

sign(1) TYPE c,

option(1) TYPE c,

low LIKE mara-mtart,

high LIKE mara-mtart,

END OF g_t_itab.

RANGES : r_mtart FOR mara-mtart.

g_t_itab-sign = 'I'.

g_t_itab-option = 'EQ'.

g_t_itab-low = 'YFER'.

APPEND g_t_itab.

CLEAR g_t_itab.

g_t_itab-sign = 'I'.

g_t_itab-option = 'EQ'.

g_t_itab-low = 'COUN'.

APPEND g_t_itab.

CLEAR g_t_itab.

g_t_itab-sign = 'I'.

g_t_itab-option = 'EQ'.

g_t_itab-low = 'SEPR'.

APPEND g_t_itab.

CLEAR g_t_itab.

LOOP AT g_t_itab.

r_mtart = g_t_itab.

APPEND r_mtart.

ENDLOOP.

Reward if useful.

Thank you.