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

Looping selection screen table

Former Member
0 Likes
687

Hi All,

The selection screen has a select-option input field for Profit Center (S_PRCTR).

Hence user can enter the value like 1000 to 1200 in the selection screen.

Now in the Program, one internal table has list of Profit centers.

ex: ITAB will have following profit centers.

1000, 1001, 1002, 1200

Now, i would like to know which are the Profit centers that are missing in the ITAB from S_PRCTR.

How to write the logic?

Regards

Pavan

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
656

itab1[] = itab[].
delete itab1 where prctr in s_prctr.

The matched record will be deleted from itab1 and the unmatched record remains in itab1.

5 REPLIES 5
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
657

itab1[] = itab[].
delete itab1 where prctr in s_prctr.

The matched record will be deleted from itab1 and the unmatched record remains in itab1.

Read only

0 Likes
656

Thanks Keshav...

But in the selection screen, the user will be entering a range.. like 1000 to 1200.

The internal table ITAB in the Program will have list of Profit centers like 1000, 1001, 1002, 1150, 1200.

NOw, how can i list out the Profit centers which are missing in the ITAB within that selection screen range???

I would like list out the missing profit centers like 1003, 1004,.........1049, 1051,.......1199.

Regards

Pavan

Read only

0 Likes
656

You can try my solution

Best regards

Read only

0 Likes
656

Hi Pavan,

in your select-option field you've got a range of profit centers that need to be checked - use it in select statement on table CEPC, then you get all existing profit centers.

compare the result with values in your itab.

reagards

rea

Read only

sylvain_vels
Explorer
0 Likes
656

Hi

you need to have the exact values of the select-options. So put in an internal table the value of profit center

select prctr into table t_tab from cepc where prctr in s_prctr

after you can loop on your second tab and read the table t_tab to find the values out.

like something like this:

loop at itab.

read table t_tab with key prctr = itab-prctr.

if not sy-subrc is initial.

--> you find it

endif.

endloop.

i hope it's helpful