‎2008 May 30 6:35 AM
i am having one internal table itab.
one of the field from itab is BUKRS.
loop at itab.
endloop.
inside the loop i need to check company code BUKRS from the ITAB with the fixed set of company codes US1 US2 US4 US5 US6 US9 US10 ....... like this i have 25 to 30 fixed set of company codes.
based on this i want to populate some other fields of the output internal table.
for eamaple if the company code is with in this set of values i wnat to polate some out fields with some constants other wise with some other value.
*example itab-bukrs* = US1 or US2 or US4 or US5 or US6 or US9 or US10 or us12 or us 14 or etc ...... like this i need to compare with some other 15 values .
can any one plesae help me is there any easy way to do this.
regards
raadha
‎2008 May 30 6:50 AM
Hi,
There are two ways of having the Company codes and can be used for validating the Internal Table.
a) You can use ITAB-BURKS IN ('B1','B2',...'Bn')
Where B1..n is company codes.
or
b) Declare a range for BURKS and add all the Company codes in the range and use it for validating as below.
ITAB-BUKRS in rng_BURKS.
where rng_BURKS is range .
Hope it helps you.
Regards,
Anbalagan.
‎2008 May 30 7:14 AM
hi velu
thanks for your responce
can you please explain first one littile bit more
‎2008 May 30 2:20 PM
The first example is an "in line" Range test
The second example was a built range
Only difference.
Because your need for 25 to 30 company codes, it would likely be more prudent to use the second option.
‎2008 May 30 6:56 AM
Hi,
You can use local ranges in program or selection-options from selection screen (using transaction variant etc.).
1) case with ranges.
DATA lr_bukrs TYPE RANGE OF burks WITH HEADER LINE.
CLEAR lr_bukrs.
lr_bukrs-opti = 'EQ'.
lr_bukrs-sign = 'I'.
lr_bukrs-low = 'US1'.
APPEND lr_bukrs.
lr_bukrs-low = 'US2'.
APPEND lr_bukrs.
" .... and so on.
LOOP AT itab.
IF itab-burks IN lr_bukrs.
" your logic
ENDIF.
ENDLOOP.
2) if you use selection screen. you can add hided selec-options s_bukrs FOR bkpf-bukrs (for example). and than create system variant for you program then fill default values in selection screen for s_burks. and check it-bukrs in s_bukrs.
Best Regards.
‎2008 May 30 12:53 PM
Hi,
You can try this...
Loop at itab.
If itab-bukrs in ('US1','US2',....... so on).
Then your functionality...
Endif.
Endloop.
******************************
Reward if helpful.