Application Development and Automation 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: 
Read only

Creating Range!!

Former Member
0 Likes
981

Hi,

I have to loop at one internal table and create a range for the same.....so that low and high value are stored in the range from the internal table field atinn...

how shall i go abt the same?

regards

Gunjan

7 REPLIES 7
Read only

Former Member
0 Likes
868

range-sign = 'I'.

range-option = 'EQ'.

loop at table.

range-low = table-atinn.

append range.

endloop.

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
868

Hi,

DATA: range_tab type range of <data type of atinn>,

wa_range like line of range_tab.

loop at itab into wa_itab.

wa_range-low = wa_itab-atinn.

wa_range-high = wa_itab-atinn.

append wa_range to range_tab.

endloop.

Regards,

Sesh

Message was edited by: Seshatalpasai Madala

Read only

FredericGirod
Active Contributor
0 Likes
868

What ??

Read only

andreas_mann3
Active Contributor
0 Likes
868

Hi,

if it's an interval - the solution is simple:

sort your table

1) read table itab index 1.

-> move value to low

2) describe table itab lines sy-tfill.

read table itab index sy-tfill.

-> move value to high

A.

Read only

gopi_narendra
Active Contributor
0 Likes
868

loop at IT_PUR into IS_PUR.

R_EBELN-SIGN = 'I'.

R_EBELN-OPTION = 'EQ'.

R_EBELN-LOW = IS_PUR-EBELN.

append R_EBELN.

endloop.

Regards

- Gopi

Read only

0 Likes
868

REPORT Z_DEL_ITAB_RANGE.

TYPES: BEGIN OF NAMETAB_TYPE,

NAME(30) TYPE C,

  num type i,

END OF NAMETAB_TYPE.

data: itab1 type table of nametab_type.

DATA: itab2 TYPE TABLE OF i.

data: wa type nametab_type.

ranges i_range for  wa-NUM.

wa-NAME = 'A'.

wa-NUM = 1.

append wa to itab1.

wa-NAME = 'b'.

wa-NUM = 2.

append wa to itab1.

wa-NAME = 'c'.

wa-NUM = 3.

append wa to itab1.

i_range-SIGN = 'I'.

i_range-OPTION = 'EQ'.

i_range-LOW = 1.

append i_range.

i_range-SIGN = 'I'.

i_range-OPTION = 'EQ'.

i_range-LOW =

3.

append i_range.

"delete nametab1 where name in i_range.

loop at itab1 into wa.

   write:/ wa-NAME, wa-NUM.

endloop.

WRITE sy-ULINE.

delete itab1 where num in i_range.

loop at itab1 into wa.

   write:/ wa-NAME, wa-NUM.

endloop.


Read only

Former Member
0 Likes
868

Hi,

you can do it in a LOOP (no SORT needed !) like:

DATA: t_atinn_range  type TT_ATINN_RANGE.

DATA: wa_atinn_range type CLATINNRANGE.

clear wa_atinn_range.

LOOP AT my_itab         INTO wa_itab.

  IF  wa_atinn_range      IS INITIAL,

    wa_atinn_range-low     = wa_itab-atinn.

    wa_atinn_range-high    = wa_itab-atinn.

    wa_atinn_range-option  = 'BT'.

    wa_atinn_range-high    = 'I'.

    CONTINUE.

  ENDIF.

  IF  wa_itab-atinn       LT wa_atinn_range-low.

    wa_atinn_range-low     = wa_itab-atinn.

    CONTINUE.

  ENDIF.

  IF  wa_itab-atinn       GT wa_atinn_range-high.

    wa_atinn_range-high    = wa_itab-atinn.

    CONTINUE.

  ENDIF.

ENDLOOP.

IF  wa_atinn_range-low    EQ wa_atinn_range-high.

  CLEAR                      wa_atinn_range-high.

  wa_atinn_range-option    = 'EQ'.

ENDIF.

IF NOT wa_atinn_range-low IS INITIAL.

  APPEND wa_atinn_range   TO t_atinn_range.

ENDIF.

Regards,

Klaus