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: 

help in range

Former Member
0 Kudos

hallow

i have table with emp nun(pernr) how i can invert this table

to range table becouse i wont to use delete for other table

like delete itab where pernr is not in pernr_tab.

regards

1 ACCEPTED SOLUTION

Former Member
0 Kudos

RANGES : pernr LIKE PERNR-pernr.

loop at itab.

pernr-sign = 'I'.

pernr-option = 'EQ'.

pernr-low = itab-pernr.

APPEND pernr.

endloop.

6 REPLIES 6

Former Member
0 Kudos

Hi ,

Two options :

1.

field-symbols : <ls_pernr_tab> like line of pernr_tab .

Loop at pernr_tab assigning <ls_pernr_tab> .

delete itab where pernr ne <ls_pernr_tab>-pernr .

endloop .

2.

data : lr_pernr type range of pernr_d .

data : ls_pernr like line of lr_pernr .

field-symbols : <ls_pernr_tab> like line of pernr_tab .

ls_pernr-sign = 'I' .

ls_pernr-option = 'EQ' .

Loop at pernr_tab assigning <ls_pernr_tab> .

ls_pernr-low = <ls_pernr_tab>-pernr .

endloop .

delete itab where pernr not in lr_pernr .

Both of the ways will do the job but the runtime will the depend on the table's sizes .

Hope it helps .

Best Regards .

Avi Sarmani

former_member191735
Active Contributor
0 Kudos

Declare a range in your program and append this value to the range

RANGES: r_werks FOR marcv-werks.

r_werks-sign = 'I'.

r_werks-option = 'EQ'.

r_werks-low = wa_inventory-werks.

You will get it.

former_member156446
Active Contributor
0 Kudos

loop at itab .

MOVE 'E' TO ra_matkl-sign.

MOVE 'EQ' TO ra_matkl-option.

MOVE itab-pernr TO ra_matkl-low.

APPEND ra_matkl.

MOVE itab-pernr TO ra_matkl-low.

APPEND ra_matkl.

MOVE itab-pernr TO ra_matkl-low.

APPEND ra_matkl.

clear wa_matkl..

endloop.

u cna use this range to delete from other table as u said..

but its not prepered ranges are again like a selection screen table.. so ppl say its not prefered..

hope Rob might have weblog for this as well..

Former Member
0 Kudos

RANGES : pernr LIKE PERNR-pernr.

loop at itab.

pernr-sign = 'I'.

pernr-option = 'EQ'.

pernr-low = itab-pernr.

APPEND pernr.

endloop.

Former Member
0 Kudos

Just a quick one for all ...

For all I now , RANGES statement is obsolete and you should use

DATA : lr_pernr type range of pernr_d .

RANGES defines a header line which is obsolete ...

Former Member
0 Kudos

Hi,

Ranges: r_pernr for tablename-pernr.

then you can use this r_pernr like your select-option.

Reward if useful.

Thanks,

Sreeram.