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

internal tbale

Former Member
0 Likes
642

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

5 REPLIES 5
Read only

Former Member
0 Likes
602

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.

Read only

0 Likes
602

hi velu

thanks for your responce

can you please explain first one littile bit more

Read only

0 Likes
602

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.

Read only

pavel_parshenkov2
Participant
0 Likes
602

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.

Read only

Former Member
0 Likes
602

Hi,

You can try this...

Loop at itab.

If itab-bukrs in ('US1','US2',....... so on).

Then your functionality...

Endif.

Endloop.

******************************

Reward if helpful.